本文整理汇总了Java中org.deidentifier.arx.criteria.KAnonymity类的典型用法代码示例。如果您正苦于以下问题:Java KAnonymity类的具体用法?Java KAnonymity怎么用?Java KAnonymity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KAnonymity类属于org.deidentifier.arx.criteria包,在下文中一共展示了KAnonymity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Entry point.
*
* @param args the arguments
* @throws ParseException
* @throws IOException
* @throws NoSuchAlgorithmException
*/
public static void main(String[] args) throws ParseException, IOException, NoSuchAlgorithmException {
Data data = createData("adult");
ARXAnonymizer anonymizer = new ARXAnonymizer();
ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(5));
config.setMaxOutliers(1d);
config.setQualityModel(Metric.createLossMetric());
ARXResult result = anonymizer.anonymize(data, config);
// Create certificate
ARXCertificate certificate = ARXCertificate.create(data.getHandle(), data.getDefinition(),
config, result, result.getGlobalOptimum(),
result.getOutput(),
new CSVSyntax());
File file = File.createTempFile("arx", ".pdf");
certificate.save(file);
// Open
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(file);
}
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:34,代码来源:Example53.java
示例2: getAnonymizedData
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* 2-Anonymizes the given data. No suppression allowed.
*
* @param data the data
* @return the anonymized data
*/
private DataHandle getAnonymizedData(Data data) {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
config.setQualityModel(Metric.createLossMetric(AggregateFunction.RANK));
ARXResult result = null;
try {
result = anonymizer.anonymize(data, config);
} catch (IOException e) {
e.printStackTrace();
}
final DataHandle outHandle = result.getOutput(false);
return outHandle;
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:23,代码来源:TestRiskMetrics.java
示例3: cases
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的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, true)).addPrivacyModel(new KAnonymity(5)), "./data/adult.csv", 255559.85455731067, new int[] { 1, 0, 1, 1, 3, 2, 2, 0, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new KAnonymity(100)), "./data/adult.csv", 379417.3460570988, new int[] { 1, 1, 1, 1, 3, 2, 2, 1, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new KAnonymity(5)), "./data/adult.csv", 407289.5388925293, new int[] { 1, 2, 1, 1, 3, 2, 2, 1, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new KAnonymity(100)), "./data/adult.csv", 453196.8932458743, new int[] { 0, 4, 1, 1, 3, 2, 2, 1, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new KAnonymity(5)), "./data/adult.csv", 255559.85455731067, new int[] { 1, 0, 1, 1, 3, 2, 2, 0, 1 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new KAnonymity(100)), "./data/adult.csv", 379417.3460570988, new int[] { 1, 1, 1, 1, 3, 2, 2, 1, 1 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, false)).addPrivacyModel(new KAnonymity(5)), "./data/cup.csv", 1764006.4033760305, new int[] { 2, 4, 0, 1, 0, 4, 4, 4 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, false)).addPrivacyModel(new KAnonymity(100)), "./data/cup.csv", 1994002.8308631124, new int[] { 3, 4, 1, 1, 0, 4, 4, 4 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createPrecomputedEntropyMetric(0.1d, false)).addPrivacyModel(new KAnonymity(5)), "./data/cup.csv", 2445878.424834677, new int[] { 4, 4, 1, 1, 1, 4, 4, 4 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createPrecomputedEntropyMetric(0.1d, false)).addPrivacyModel(new KAnonymity(100)), "./data/cup.csv", 2517471.5816586106, new int[] { 5, 4, 1, 0, 1, 4, 4, 4 }, false) },
/* 10 */{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, false)).addPrivacyModel(new KAnonymity(5)), "./data/cup.csv", 1764006.4033760305, new int[] { 2, 4, 0, 1, 0, 4, 4, 4 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, false)).addPrivacyModel(new KAnonymity(100)), "./data/cup.csv", 2001343.4737485605, new int[] { 3, 4, 1, 1, 0, 1, 2, 1 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new KAnonymity(5)), "./data/fars.csv", 4469271.0, new int[] { 0, 2, 2, 2, 1, 2, 1, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new KAnonymity(100)), "./data/fars.csv", 5.6052481E7, new int[] { 0, 2, 3, 3, 1, 2, 2, 2 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new KAnonymity(5)), "./data/fars.csv", 1.42377891E8, new int[] { 1, 2, 3, 3, 1, 2, 1, 2 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new KAnonymity(100)), "./data/fars.csv", 4.36925397E8, new int[] { 5, 2, 3, 3, 1, 2, 0, 2 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new KAnonymity(5)), "./data/fars.csv", 4469271.0, new int[] { 0, 2, 2, 2, 1, 2, 1, 0 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new KAnonymity(100)), "./data/fars.csv", 5.6052481E7, new int[] { 0, 2, 3, 3, 1, 2, 2, 2 }, true) },
});
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:29,代码来源:TestAnonymizationKAnonymity.java
示例4: cases
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Collection
* @return
*/
@Parameters(name = "{index}:[{0}]")
public static Collection<Object[]> cases() {
return Arrays.asList(new Object[][] {
/* 0 */ { new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new OrderedDistanceTCloseness("occupation", 0.2d)).addPrivacyModel(new KAnonymity(5)), "occupation", "./data/adult.csv", "2712340.0", new int[] { 0, 0, 1, 1, 2, 2, 2, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new OrderedDistanceTCloseness("occupation", 0.2d)).addPrivacyModel(new KAnonymity(100)), "occupation", "./data/adult.csv", "1.9937246E7", new int[] { 1, 0, 1, 2, 3, 2, 2, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new OrderedDistanceTCloseness("occupation", 0.1d)).addPrivacyModel(new KAnonymity(5)), "occupation", "./data/adult.csv", "9.786802E7", new int[] { 1, 1, 1, 2, 3, 2, 2, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new OrderedDistanceTCloseness("occupation", 0.2d)).addPrivacyModel(new KAnonymity(100)), "occupation", "./data/adult.csv", "1.6231213E8", new int[] { 1, 4, 1, 1, 1, 2, 2, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new OrderedDistanceTCloseness("occupation", 0.05d)).addPrivacyModel(new KAnonymity(5)), "occupation", "./data/adult.csv", "2.01413138E8", new int[] { 1, 4, 1, 0, 3, 2, 2, 0 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createDiscernabilityMetric(true)).addPrivacyModel(new OrderedDistanceTCloseness("occupation", 0.2d)).addPrivacyModel(new KAnonymity(100)), "occupation", "./data/adult.csv", "1.9937246E7", new int[] { 1, 0, 1, 2, 3, 2, 2, 1 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new OrderedDistanceTCloseness("Highest level of school completed", 0.25d)).addPrivacyModel(new KAnonymity(5)), "Highest level of school completed", "./data/atus.csv", "1999729.3356444335", new int[] { 0, 0, 0, 2, 1, 2, 2, 1 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new OrderedDistanceTCloseness("Highest level of school completed", 0.2d)).addPrivacyModel(new KAnonymity(100)), "Highest level of school completed", "./data/atus.csv", "3663507.668427732", new int[] { 0, 3, 0, 1, 2, 2, 2, 0 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new OrderedDistanceTCloseness("Highest level of school completed", 0.2d)).addPrivacyModel(new KAnonymity(5)), "Highest level of school completed", "./data/atus.csv", "4657839.672179246", new int[] { 0, 3, 0, 2, 2, 2, 2, 2 }, false) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.0d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new OrderedDistanceTCloseness("Highest level of school completed", 0.01d)).addPrivacyModel(new KAnonymity(100)), "Highest level of school completed", "./data/atus.csv", "7104624.912719078", new int[] { 1, 5, 1, 2, 2, 2, 2, 2 },false) },
/* 10 */ { new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new OrderedDistanceTCloseness("Highest level of school completed", 0.2d)).addPrivacyModel(new KAnonymity(5)), "Highest level of school completed", "./data/atus.csv", "3303937.388063534", new int[] { 0, 4, 0, 0, 2, 0, 2, 0 }, true) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(0.04d, Metric.createPrecomputedEntropyMetric(0.1d, true)).addPrivacyModel(new OrderedDistanceTCloseness("Highest level of school completed", 0.3d)).addPrivacyModel(new KAnonymity(100)), "Highest level of school completed", "./data/atus.csv", "2659996.2572910236", new int[] { 0, 4, 0, 1, 1, 1, 2, 1 }, true) },
});
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:22,代码来源:TestAnonymizationOrderedDistanceTCloseness.java
示例5: getResult
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs anonymization and returns result.
*
* @return
* @throws IOException
*/
private ARXResult getResult() throws IOException {
if (result == null) {
// Data
Data data = getData("adult");
data.getDefinition().setAttributeType("marital-status", AttributeType.INSENSITIVE_ATTRIBUTE);
data.getDefinition().setDataType("age", DataType.INTEGER);
// Config
ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(5));
config.setMaxOutliers(1d);
ARXAnonymizer anonymizer = new ARXAnonymizer();
result = anonymizer.anonymize(data, config);
}
return result;
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:TestClassification.java
示例6: testSorting
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Test case
*
* @throws IllegalArgumentException
* @throws IOException
*/
@Test
public void testSorting() throws IllegalArgumentException, IOException {
provider.createDataDefinition();
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
final ARXResult result = anonymizer.anonymize(provider.getData(), config);
final DataHandle outHandle = result.getOutput(false);
final DataHandle inHandle = provider.getData().getHandle();
inHandle.sort(true, 0);
final String[][] inArray = iteratorToArray(inHandle.iterator());
final String[][] resultArray = iteratorToArray(outHandle.iterator());
final String[][] expected = { { "age", "gender", "zipcode" }, { "<50", "*", "816**" }, { "<50", "*", "819**" }, { "<50", "*", "816**" }, { "<50", "*", "819**" }, { ">=50", "*", "819**" }, { ">=50", "*", "819**" }, { ">=50", "*", "819**" } };
final String[][] expectedIn = { { "age", "gender", "zipcode" }, { "34", "male", "81667" }, { "34", "female", "81931" }, { "45", "female", "81675" }, { "45", "male", "81931" }, { "66", "male", "81925" }, { "70", "female", "81931" }, { "70", "male", "81931" } };
assertTrue(Arrays.deepEquals(inArray, expectedIn));
assertTrue(Arrays.deepEquals(resultArray, expected));
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:32,代码来源:TestDataHandle.java
示例7: testAllAttributesIdentifying
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test
*
* @throws IOException
*/
@Test
public void testAllAttributesIdentifying() throws IOException {
try {
provider.createDataDefinition();
final Data data = provider.getData();
data.getDefinition().setAttributeType("age", AttributeType.IDENTIFYING_ATTRIBUTE);
data.getDefinition().setAttributeType("gender", AttributeType.IDENTIFYING_ATTRIBUTE);
data.getDefinition().setAttributeType("zipcode", AttributeType.IDENTIFYING_ATTRIBUTE);
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:TestAnonymization.java
示例8: testAllAttributesInsensitive
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test
*
* @throws IOException
*/
@Test
public void testAllAttributesInsensitive() throws IOException {
try {
provider.createDataDefinition();
final Data data = provider.getData();
data.getDefinition().setAttributeType("age", AttributeType.INSENSITIVE_ATTRIBUTE);
data.getDefinition().setAttributeType("gender", AttributeType.INSENSITIVE_ATTRIBUTE);
data.getDefinition().setAttributeType("zipcode", AttributeType.INSENSITIVE_ATTRIBUTE);
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:TestAnonymization.java
示例9: testAllAttributesSensitive
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test
*
* @throws IOException
*/
@Test
public void testAllAttributesSensitive() throws IOException {
try {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
provider.createDataDefinition();
final Data data = provider.getData();
data.getDefinition().setAttributeType("age", AttributeType.SENSITIVE_ATTRIBUTE);
data.getDefinition().setAttributeType("gender", AttributeType.SENSITIVE_ATTRIBUTE);
data.getDefinition().setAttributeType("zipcode", AttributeType.SENSITIVE_ATTRIBUTE);
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(-0.2d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:26,代码来源:TestAnonymization.java
示例10: testKAnonymizationWithoutOutliers
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test
*
* @throws IOException
*/
@Test
public void testKAnonymizationWithoutOutliers() throws IOException {
provider.createDataDefinition();
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
final String[][] result = resultToArray(anonymizer.anonymize(provider.getData(), config));
final String[][] expected = {
{ "age", "gender", "zipcode" },
{ "<50", "*", "816**" },
{ "<50", "*", "816**" },
{ ">=50", "*", "819**" },
{ ">=50", "*", "819**" },
{ "<50", "*", "819**" },
{ ">=50", "*", "819**" },
{ "<50", "*", "819**" } };
assertTrue(Arrays.deepEquals(result, expected));
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:29,代码来源:TestAnonymization.java
示例11: testMoreThanOneAttributeSensitive
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test
*
* @throws IOException
*/
@Test
public void testMoreThanOneAttributeSensitive() throws IOException {
try {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
provider.createDataDefinition();
final Data data = provider.getData();
data.getDefinition().setAttributeType("gender", AttributeType.SENSITIVE_ATTRIBUTE);
data.getDefinition().setAttributeType("zipcode", AttributeType.SENSITIVE_ATTRIBUTE);
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
anonymizer.anonymize(data, config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:TestAnonymization.java
示例12: cases
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Returns the test cases.
*
* @return
* @throws IOException
*/
@Parameters(name = "{index}:[{0}]")
public static Collection<Object[]> cases() throws IOException {
return Arrays.asList(new Object[][] {
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new EntropyLDiversity("occupation", 5)), "./data/adult.csv", "occupation", -998962150) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new DistinctLDiversity("Highest level of school completed", 5)), "./data/atus.csv", "Highest level of school completed", 1662433089) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new RecursiveCLDiversity("Highest level of school completed", 4d, 3)), "./data/atus.csv", "Highest level of school completed", 1141779920) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new EqualDistanceTCloseness("occupation", 0.2d)).addPrivacyModel(new KAnonymity(5)), "./data/adult.csv", "occupation", 464405537) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new EqualDistanceTCloseness("occupation", 0.2d)).addPrivacyModel(new KAnonymity(100)), "./data/adult.csv", "occupation", -1306447515) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new KAnonymity(100)), "./data/adult.csv", "occupation", 484469846) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new KAnonymity(5)), "./data/adult.csv", "occupation", -1231665634) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new KMap(3, 0.01d, ARXPopulationModel.create(Region.USA), CellSizeEstimator.ZERO_TRUNCATED_POISSON)), "./data/adult.csv", "occupation", -715168499) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new KMap(1000, 0.01d, ARXPopulationModel.create(Region.USA), CellSizeEstimator.ZERO_TRUNCATED_POISSON)), "./data/adult.csv", "occupation", 2130163653) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new EDDifferentialPrivacy(1.0d, 1E-6d, DataGeneralizationScheme.create(GeneralizationDegree.MEDIUM_HIGH), true)), "./data/fars.csv", "", 482534106) },
{ new ARXAnonymizationTestCase(ARXConfiguration.create(1d, Metric.createLossMetric(0.05d)).addPrivacyModel(new DPresence(0.0, 0.2, DataSubset.create(Data.create("./data/fars.csv", StandardCharsets.UTF_8, ';'), Data.create("./data/fars_subset.csv", StandardCharsets.UTF_8, ';')))), "./data/fars.csv", "istatenum", 505248650) },
});
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:24,代码来源:TestAnonymizationLocalRecoding.java
示例13: testEmptyDatasetWithAttributeDefinition
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testEmptyDatasetWithAttributeDefinition() throws IOException {
try {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final Data data = Data.create();
data.getDefinition()
.setAttributeType("age", AttributeType.IDENTIFYING_ATTRIBUTE);
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(1.2d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:TestIllegalArguments.java
示例14: testEmptyDatasetWithoutAttributeDefinition
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testEmptyDatasetWithoutAttributeDefinition() throws IOException {
try {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final Data data = Data.create();
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(1.2d);
anonymizer.anonymize(data, config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:23,代码来源:TestIllegalArguments.java
示例15: testEmptyDefinition
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testEmptyDefinition() throws IOException {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
try {
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(1.2d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:21,代码来源:TestIllegalArguments.java
示例16: testEmptyHierarchy
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testEmptyHierarchy() throws IOException {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
final Data data = provider.getData();
data.getDefinition().setAttributeType("age", Hierarchy.create());
try {
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(1.2d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:23,代码来源:TestIllegalArguments.java
示例17: testInvalidHierarchies
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testInvalidHierarchies() throws IOException {
provider.createWrongDataDefinition();
final ARXAnonymizer anonymizer = new ARXAnonymizer();
try {
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(2));
config.setMaxOutliers(0d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:23,代码来源:TestIllegalArguments.java
示例18: testKRangeNegative
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testKRangeNegative() throws IOException {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
try {
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(-1));
config.setMaxOutliers(0d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:22,代码来源:TestIllegalArguments.java
示例19: testKRangeTooLarge
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testKRangeTooLarge() throws IOException {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
try {
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(8));
config.setMaxOutliers(0d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:21,代码来源:TestIllegalArguments.java
示例20: testKRangeZero
import org.deidentifier.arx.criteria.KAnonymity; //导入依赖的package包/类
/**
* Performs a test.
*
* @throws IOException
*/
@Test
public void testKRangeZero() throws IOException {
final ARXAnonymizer anonymizer = new ARXAnonymizer();
try {
final ARXConfiguration config = ARXConfiguration.create();
config.addPrivacyModel(new KAnonymity(0));
config.setMaxOutliers(0d);
anonymizer.anonymize(provider.getData(), config);
} catch (final IllegalArgumentException e) {
return;
}
Assert.fail();
}
开发者ID:arx-deidentifier,项目名称:arx,代码行数:21,代码来源:TestIllegalArguments.java
注:本文中的org.deidentifier.arx.criteria.KAnonymity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论