Documentation
¶
Index ¶
- func Anonymize(source RecordSource, factory GeneralizerFactory, k int, l int, dim int, ...) error
- func BoxMuller() (float64, float64)
- func Camberra(x, y map[string]float64) float64
- func Chebyshev(x, y map[string]float64) float64
- func ComputeDistance(name string, x, y map[string]float64) float64
- func Contains(slice []string, str string) bool
- func Cosine(x, y map[string]float64) float64
- func CountValues(sensitives []string) map[string]int
- func Euclidean(x, y map[string]float64) float64
- func Exist(filename string) bool
- func ExpNumber(mean float64) float64
- func Find(slice []string, val string) bool
- func GaussianNumber(loc float64, scale float64) float64
- func IQR(values []float64) float64
- func IsUnique(sensitives map[string][]interface{}) map[string]bool
- func LaplaceNumber() float64
- func ListValues(data []map[string]interface{}, s []string) (mapValues map[string][]interface{})
- func Manhattan(x, y map[string]float64) float64
- func MapItoMapF(m map[string]interface{}) map[string]float64
- func Max(listValues []float64) float64
- func Mean(listValues []float64) (m float64)
- func Median(listValues []float64) (m float64)
- func Min(listValues []float64) float64
- func Minkowski(x, y map[string]float64, p float64) float64
- func NewNode(tree *KDTree, path string, rot int) node
- func RandFloat() (float64, error)
- func RandInt(max int64) (int, error)
- func Rescaling(value float64, listValues []float64, method string) (rescale float64)
- func Scale(value interface{}, mean float64, std float64) float64
- func Scaling(value float64, listValues []float64, method string) float64
- func Shuffle(s []float64) []float64
- func Similarity(distance float64) float64
- func SliceString(slice []interface{}) (res []string)
- func SliceToFloat64(slice []interface{}) (res []float64)
- func Std(listValues []float64) (s float64)
- func Sum(listValues []float64) (sum float64)
- func TopSimilarity(s map[float64]interface{}) (float64, interface{})
- func Unique(slice []map[string]interface{}, qi []string) bool
- type AggregationAnonymizer
- type AnonymizedRecord
- type Anonymizer
- type Cluster
- type CodingAnonymizer
- type Debugger
- type Definition
- type GeneralAnonymizer
- type Generalizer
- type GeneralizerFactory
- type InfosRecord
- type KDTree
- type KDTreeFactory
- type NoAnonymizer
- type NoDebugger
- type NoiseAnonymizer
- type Quartiles
- type Record
- type RecordSink
- type RecordSource
- type Reidentification
- func (r Reidentification) Anonymize(rec Record, clus Cluster, qi, s []string) Record
- func (r Reidentification) ComputeSimilarity(rec Record, clus Cluster, qi []string, s []string) map[float64]interface{}
- func (r Reidentification) ComputeStatistics(data []map[string]interface{}, clus Cluster, s []string)
- func (r Reidentification) InitReidentification(clus Cluster, qi []string, s []string)
- func (r Reidentification) Statistics(idCluster string, q string) (mean float64, std float64)
- type Rules
- type SequenceDebugger
- type SwapAnonymizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Anonymize ¶
func Anonymize(source RecordSource, factory GeneralizerFactory, k int, l int, dim int, anonymyzer Anonymizer, sink RecordSink, debugger Debugger) error
func BoxMuller ¶ added in v0.2.0
BoxMuller generates pairs of independent random numbers following a normal distribution. (https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform).
func ComputeDistance ¶ added in v0.4.0
func CountValues ¶ added in v0.4.0
CountValues returns a map with the number of occurrences for each sensitive data value.
func ExpNumber ¶
ExpNumber generates safe exponential random value. (https://dzone.com/articles/generating-laplace-distributed-random-values).
func GaussianNumber ¶
GaussianNumber generates safe Gaussian value.
func LaplaceNumber ¶
func LaplaceNumber() float64
LaplaceNumber generates Laplace value. (https://dzone.com/articles/generating-laplace-distributed-random-values).
func ListValues ¶ added in v0.4.0
Returns the list of values present in the slice of map[string]interface{}.
func MapItoMapF ¶ added in v0.4.0
MapItoMapF convert a map[string]interface{} to a map[string]float64.
func Scale ¶ added in v0.4.0
Scale returns the scaled value to ensure the mean and the standard deviation to be 0 and 1, respectively.
func Scaling ¶ added in v0.2.0
Scaling returns the scaled value to range [-2;2] for Laplace number and [-1;1] for Gaussian Number. (https://en.wikipedia.org/wiki/Normalization_(statistics)). If no method is mentioned, standardization is used.
func Similarity ¶ added in v0.4.0
func SliceString ¶ added in v0.4.0
func SliceString(slice []interface{}) (res []string)
SliceString convert a slice of interface into a slice of string.
func SliceToFloat64 ¶ added in v0.4.0
func SliceToFloat64(slice []interface{}) (res []float64)
SliceToFloat64 convert a slice of interface into a slice of float64.
func Std ¶
Std returns the standard deviation of listValues. (https://fr.wikipedia.org/wiki/%C3%89cart_type).
func TopSimilarity ¶ added in v0.4.0
Types ¶
type AggregationAnonymizer ¶
type AggregationAnonymizer struct {
// contains filtered or unexported fields
}
func NewAggregationAnonymizer ¶
func NewAggregationAnonymizer(typeAgg string) AggregationAnonymizer
func (AggregationAnonymizer) Anonymize ¶
func (a AggregationAnonymizer) Anonymize(rec Record, clus Cluster, qi, s []string) Record
Anonymize returns the record anonymized with the method meanAggregarion or medianAggregation the record takes the aggregated values of the cluster.
func (AggregationAnonymizer) ComputeAggregation ¶ added in v0.1.1
func (a AggregationAnonymizer) ComputeAggregation(clus Cluster, qi []string)
ComputeAggregation calculates the mean (method meanAggreagtion) or median (method medianAggregation) value of the cluster for each qi.
type AnonymizedRecord ¶
type AnonymizedRecord struct {
// contains filtered or unexported fields
}
func (AnonymizedRecord) QuasiIdentifer ¶
func (ar AnonymizedRecord) QuasiIdentifer() []float64
func (AnonymizedRecord) Row ¶
func (ar AnonymizedRecord) Row() map[string]interface{}
func (AnonymizedRecord) Sensitives ¶
func (ar AnonymizedRecord) Sensitives() []interface{}
type Anonymizer ¶
type CodingAnonymizer ¶
type CodingAnonymizer struct{}
func NewCodingAnonymizer ¶
func NewCodingAnonymizer() CodingAnonymizer
func (CodingAnonymizer) Anonymize ¶
func (a CodingAnonymizer) Anonymize(rec Record, clus Cluster, qi, s []string) Record
Anonymize returns the record anonymized with the method outlier if the record is in the interval [Q1;Q3] then we don't change its value if the record is > Q3 then it takes the Q3 value if the record is < Q1 then it takes the Q1 value.
type Debugger ¶
func NewNoDebugger ¶
func NewNoDebugger() Debugger
type Definition ¶ added in v0.3.0
type Definition struct {
Version string `yaml:"version"`
K int `yaml:"kAnonymity"`
L int `yaml:"lDiversity"`
Sensitive []string `yaml:"sensitives"`
Aggregation string `yaml:"aggregation"`
Rules []Rules `yaml:"rules"`
}
func LoadConfigurationFromYAML ¶ added in v0.3.0
func LoadConfigurationFromYAML(filename string) (Definition, error)
LoadConfigurationFromYAML returns the configuration of the yaml file in a Definition object.
type GeneralAnonymizer ¶
type GeneralAnonymizer struct {
// contains filtered or unexported fields
}
func NewGeneralAnonymizer ¶
func NewGeneralAnonymizer() GeneralAnonymizer
func (GeneralAnonymizer) Anonymize ¶
func (a GeneralAnonymizer) Anonymize(rec Record, clus Cluster, qi, s []string) Record
Anonymize returns the record anonymize with the method general the record takes the bounds of the cluster.
func (GeneralAnonymizer) ComputeGeneralization ¶ added in v0.4.0
func (a GeneralAnonymizer) ComputeGeneralization(clus Cluster, qi []string)
ComputeGeneralization calculates the min and max values of the cluster for each qi.
type Generalizer ¶
type GeneralizerFactory ¶
type GeneralizerFactory interface {
New(k int, l int, dim int, qi []string) Generalizer
}
type InfosRecord ¶
type InfosRecord struct {
// contains filtered or unexported fields
}
func (InfosRecord) QuasiIdentifer ¶
func (ir InfosRecord) QuasiIdentifer() []float64
func (InfosRecord) Row ¶
func (ir InfosRecord) Row() map[string]interface{}
func (InfosRecord) Sensitives ¶
func (ir InfosRecord) Sensitives() []interface{}
type KDTree ¶
type KDTree struct {
// contains filtered or unexported fields
}
type KDTreeFactory ¶
type KDTreeFactory struct{}
func NewKDTreeFactory ¶
func NewKDTreeFactory() KDTreeFactory
func (KDTreeFactory) New ¶
func (f KDTreeFactory) New(k int, l int, dim int, qi []string) Generalizer
type NoAnonymizer ¶
type NoAnonymizer struct{}
func NewNoAnonymizer ¶
func NewNoAnonymizer() NoAnonymizer
type NoDebugger ¶
type NoDebugger struct{}
func (NoDebugger) Information ¶
func (d NoDebugger) Information(rec Record, cluster Cluster) Record
type NoiseAnonymizer ¶
type NoiseAnonymizer struct {
// contains filtered or unexported fields
}
func NewNoiseAnonymizer ¶
func NewNoiseAnonymizer(mechanism string) NoiseAnonymizer
func (NoiseAnonymizer) Anonymize ¶
func (a NoiseAnonymizer) Anonymize(rec Record, clus Cluster, qi, s []string) Record
Anonymize returns the record anonymized with the method laplaceNoise or gaussianNoise the record takes as value the original value added to a Laplacian or Gaussian noise the anonymized value stays within the bounds of the cluster.
type RecordSink ¶
type RecordSource ¶
type Reidentification ¶ added in v0.4.0
type Reidentification struct {
// contains filtered or unexported fields
}
func NewReidentification ¶ added in v0.4.0
func NewReidentification(args []string) Reidentification
func (Reidentification) Anonymize ¶ added in v0.4.0
func (r Reidentification) Anonymize(rec Record, clus Cluster, qi, s []string) Record
Anonymize on object Reidentification re-identifies the original data using the anonymized data.
func (Reidentification) ComputeSimilarity ¶ added in v0.4.0
func (r Reidentification) ComputeSimilarity(rec Record, clus Cluster, qi []string, s []string) map[float64]interface{}
ComputeSimilarity computes the similarity score between the record rec and the anonymized cluster data.
func (Reidentification) ComputeStatistics ¶ added in v0.4.0
func (r Reidentification) ComputeStatistics(data []map[string]interface{}, clus Cluster, s []string)
ComputeStatistics computes the mean and standart deviation for cluster clus.
func (Reidentification) InitReidentification ¶ added in v0.4.0
func (r Reidentification) InitReidentification(clus Cluster, qi []string, s []string)
InitReidentification initialize the re-identification object.
func (Reidentification) Statistics ¶ added in v0.4.0
func (r Reidentification) Statistics(idCluster string, q string) (mean float64, std float64)
Statistics returns the statistics of the q attribute of the cluster with path idCluster.
type SequenceDebugger ¶
type SequenceDebugger struct {
// contains filtered or unexported fields
}
func NewSequenceDebugger ¶
func NewSequenceDebugger(key string) SequenceDebugger
func (SequenceDebugger) Information ¶
func (d SequenceDebugger) Information(rec Record, cluster Cluster) Record
Information returns an InfosRecord which is a record with the identifier of the cluster in which the record rec is located.
type SwapAnonymizer ¶ added in v0.3.0
type SwapAnonymizer struct {
// contains filtered or unexported fields
}
func NewSwapAnonymizer ¶ added in v0.3.0
func NewSwapAnonymizer() SwapAnonymizer
func (SwapAnonymizer) Anonymize ¶ added in v0.3.0
func (a SwapAnonymizer) Anonymize(rec Record, clus Cluster, qi, s []string) Record
func (SwapAnonymizer) Swap ¶ added in v0.3.0
func (a SwapAnonymizer) Swap(clus Cluster, qi []string)