當前位置: 首頁>>代碼示例>>Java>>正文


Java SampleUniqueness類代碼示例

本文整理匯總了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$
       }
}
 
開發者ID:arx-deidentifier,項目名稱:arx,代碼行數:20,代碼來源:ModelRiskBasedCriterion.java

示例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) }
    });
}
 
開發者ID:arx-deidentifier,項目名稱:arx,代碼行數:17,代碼來源:TestAnonymizationRiskBased.java

示例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;
}
 
開發者ID:arx-deidentifier,項目名稱:risk-benchmark,代碼行數:64,代碼來源:BenchmarkSetup.java


注:本文中的org.deidentifier.arx.criteria.SampleUniqueness類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。