Documentation ¶
Index ¶
- func Anonymize(source RecordSource, factory GeneralizerFactory, k int, l int, dim int, ...) error
- func BoxMuller() (float64, float64)
- func Contains(slice []string, str string) bool
- func Exist(filename string) bool
- func ExpNumber(mean float64) float64
- func GaussianNumber(loc float64, scale float64) float64
- func IQR(values []float64) float64
- func LaplaceNumber() float64
- func Max(listValues []float64) float64
- func Mean(listValues []float64) (m float64)
- func Median(listValues []float64) (m float64)
- func Min(listValues []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 Scaling(value float64, listValues []float64, method string) float64
- func Shuffle(s []float64) []float64
- func Std(listValues []float64) (s float64)
- func Sum(listValues []float64) (sum float64)
- 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 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 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 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 Std ¶
Std returns the standard deviation of listValues. (https://fr.wikipedia.org/wiki/%C3%89cart_type).
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
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 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)