本文整理汇总了Java中org.deidentifier.arx.criteria.SampleUniqueness类的典型用法代码示例。如果您正苦于以下问题:Java SampleUniqueness类的具体用法?Java SampleUniqueness怎么用?Java SampleUniqueness使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SampleUniqueness类属于org.deidentifier.arx.criteria包,在下文中一共展示了SampleUniqueness类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCriterion
import org.deidentifier.arx.criteria.SampleUniqueness; //导入依赖的package包/类
@Override
public PrivacyCriterion getCriterion(Model model) {
switch (variant) {
case VARIANT_AVERAGE_RISK:
return new AverageReidentificationRisk(threshold);
case VARIANT_POPULATION_UNIQUES_DANKAR:
return getPopulationBasedCriterion(PopulationUniquenessModel.DANKAR, model);
case VARIANT_POPULATION_UNIQUES_PITMAN:
return getPopulationBasedCriterion(PopulationUniquenessModel.PITMAN, model);
case VARIANT_POPULATION_UNIQUES_SNB:
return getPopulationBasedCriterion(PopulationUniquenessModel.SNB, model);
case VARIANT_POPULATION_UNIQUES_ZAYATZ:
return getPopulationBasedCriterion(PopulationUniquenessModel.ZAYATZ, model);
case VARIANT_SAMPLE_UNIQUES:
return new SampleUniqueness(threshold);
default:
throw new RuntimeException(Resources.getMessage("Model.0b")); //$NON-NLS-1$
}
}
示例2: cases
import org.deidentifier.arx.criteria.SampleUniqueness; //导入依赖的package包/类
/**
* Returns the test cases.
*
* @return
*/
@Parameters(name = "{index}:[{0}]")
public static Collection<Object[]> cases() {
return Arrays.asList(new Object[][] {
/* 0 */{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d)).addPrivacyModel(new AverageReidentificationRisk(0.01d)), "./data/adult.csv", 314637.8461904862, new int[] { 1, 0, 1, 1, 3, 2, 2, 1, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedLossMetric(0.1d)).addPrivacyModel(new SampleUniqueness(0.01d)), "./data/adult.csv", 0.1606952725863784, new int[] { 0, 3, 0, 0, 1, 1, 1, 1, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d)).addPrivacyModel(getPopulationUniqueness(0.0001d, PopulationUniquenessModel.DANKAR)), "./data/adult.csv", 144298.1603344462, new int[] { 0, 0, 1, 1, 1, 2, 1, 0, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedLossMetric(0.1d)).addPrivacyModel(getPopulationUniqueness(0.0001d, PopulationUniquenessModel.ZAYATZ)), "./data/adult.csv", 0.16078200456326086, new int[] { 0, 3, 0, 0, 1, 1, 1, 1, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d)).addPrivacyModel(getPopulationUniqueness(0.0001d, PopulationUniquenessModel.PITMAN)), "./data/adult.csv", 144298.1603344462, new int[] { 0, 0, 1, 1, 1, 2, 1, 0, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedLossMetric(0.1d)).addPrivacyModel(getPopulationUniqueness(0.0001d, PopulationUniquenessModel.SNB)), "./data/adult.csv", 0.17599055898432758, new int[] { 0, 3, 0, 0, 2, 1, 1, 1, 0 }, false) }
});
}
示例3: getConfiguration
import org.deidentifier.arx.criteria.SampleUniqueness; //导入依赖的package包/类
/**
* Returns a configuration for the ARX framework
* @param dataset
* @param criteria
* @param uniqueness
* @return
* @throws IOException
*/
public static ARXConfiguration getConfiguration(BenchmarkDataset dataset,
BenchmarkUtilityMeasure utility,
BenchmarkPrivacyModel criterion,
double uniqueness) throws IOException {
ARXConfiguration config = ARXConfiguration.create();
switch (utility) {
case ENTROPY:
config.setMetric(Metric.createPrecomputedNormalizedEntropyMetric(1.0d, AggregateFunction.SUM));
break;
case LOSS:
config.setMetric(Metric.createPrecomputedLossMetric(1.0d, AggregateFunction.GEOMETRIC_MEAN));
break;
default:
throw new IllegalArgumentException("");
}
config.setMaxOutliers(1.0d);
switch (criterion) {
case UNIQUENESS_DANKAR:
config.addCriterion(new PopulationUniqueness(uniqueness,
PopulationUniquenessModel.DANKAR,
ARXPopulationModel.create(Region.USA),
ARXSolverConfiguration.create().preparedStartValues(SOLVER_START_VALUES).iterationsPerTry(15)));
break;
case UNIQUENESS_SNB:
config.addCriterion(new PopulationUniqueness(uniqueness,
PopulationUniquenessModel.SNB,
ARXPopulationModel.create(Region.USA),
ARXSolverConfiguration.create().preparedStartValues(SOLVER_START_VALUES).iterationsPerTry(15)));
break;
case UNIQUENESS_PITMAN:
config.addCriterion(new PopulationUniqueness(uniqueness,
PopulationUniquenessModel.PITMAN,
ARXPopulationModel.create(Region.USA),
ARXSolverConfiguration.create().preparedStartValues(SOLVER_START_VALUES).iterationsPerTry(15)));
break;
case UNIQUENESS_ZAYATZ:
config.addCriterion(new PopulationUniqueness(uniqueness,
PopulationUniquenessModel.ZAYATZ,
ARXPopulationModel.create(Region.USA),
ARXSolverConfiguration.create().preparedStartValues(SOLVER_START_VALUES).iterationsPerTry(15)));
break;
case UNIQUENESS_SAMPLE:
config.addCriterion(new SampleUniqueness(uniqueness));
break;
case K_ANONYMITY:
config.addCriterion(new KAnonymity(getK(uniqueness)));
break;
default:
throw new RuntimeException("Invalid criterion");
}
return config;
}