当前位置: 首页>>代码示例>>Java>>正文


Java DataDefinition类代码示例

本文整理汇总了Java中org.deidentifier.arx.DataDefinition的典型用法代码示例。如果您正苦于以下问题:Java DataDefinition类的具体用法?Java DataDefinition怎么用?Java DataDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataDefinition类属于org.deidentifier.arx包,在下文中一共展示了DataDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toArray

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
/**
 * Returns an array representation of the dataset. Extracts all attributes that are defined
 * as quasi-identifiers in the given definition 
 * 
 * @param handle
 * @param definition
 * @return
 */
public String[][] toArray(DataHandle handle, DataDefinition definition) {
    
    List<Integer> indices = new ArrayList<Integer>();
    for (String attribute : definition.getQuasiIdentifyingAttributes()) {
        indices.add(handle.getColumnIndexOf(attribute));
    }
    
    List<String[]> list = new ArrayList<String[]>();
    Iterator<String[]> iter = handle.iterator();
    iter.next(); // Skip header
    for (;iter.hasNext();) {
        String[] input = iter.next();
        String[] output = new String[indices.size()];
        int i = 0;
        for (int index : indices) {
            output[i++] = input[index];
        }
        list.add(output);
    }
    return list.toArray(new String[list.size()][]);
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:30,代码来源:DataConverter.java

示例2: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    super.initializeInternal(manager, definition, input, hierarchies, config);

    minHeight = 0;
    maxHeight = 0;
    Set<String> genQis = definition.getQuasiIdentifiersWithGeneralization();
    for (String genQi : genQis) {
        minHeight += definition.getMinimumGeneralization(genQi);
        maxHeight += definition.getMaximumGeneralization(genQi);
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:MetricHeight.java

示例3: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    
    // Prepare super
    super.initializeInternal(manager, definition, input, hierarchies, config);

    // Compute cardinalities
    RowSet subset = super.getSubset(config);
    
    // Cardinalities
    this.cardinalities = new Cardinalities(input, subset, hierarchies);
    
    // Distinct values
    this.values = new int[hierarchies.length][][];
    for (int i=0; i<values.length; i++) {
        values[i] = new int[hierarchies[i].getHeight()][];
        for (int j=0; j<values[i].length; j++){
            values[i][j] = hierarchies[i].getDistinctValues(j);
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:26,代码来源:MetricMDNMLossPrecomputed.java

示例4: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition,
                                  final Data input,
                                  final GeneralizationHierarchy[] hierarchies,
                                  final ARXConfiguration config) {

    super.initializeInternal(manager, definition, input, hierarchies, config);

    // Compute domain shares
    this.shares =  manager.getDomainShares();
    this.config = config.getCostBenefitConfiguration();
    this.modelRisk = new RiskModelCostBenefit(this.config);
    this.maximalPayout = new QualityMetadata<Double>(MAXIMAL_PAYOUT, super.getNumRecords(config, input) * this.config.getPublisherBenefit());
            
    // Calculate MaxIL
    this.maxIL = MetricSDNMEntropyBasedInformationLoss.getMaximalEntropyBasedInformationLoss(this.shares, super.getMicroaggregationDomainSizes());
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:19,代码来源:MetricSDNMPublisherPayout.java

示例5: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    
    super.initializeInternal(manager, definition, input, hierarchies, config);

    this.upper = super.getUpperBounds();
    
    // Compute a reasonable min & max
    double[] min = new double[hierarchies.length];
    Arrays.fill(min, 0d);
    
    double[] max = new double[hierarchies.length];
    Arrays.fill(max, 1d);
    
    super.setMax(max);
    super.setMin(min);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:22,代码来源:MetricMDNUNMNormalizedEntropyPrecomputed.java

示例6: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition,
                                  final Data input,
                                  final GeneralizationHierarchy[] hierarchies,
                                  final ARXConfiguration config) {

    // Prepare weights
    super.initializeInternal(manager, definition, input, hierarchies, config);

    // Compute domain shares
    this.shares =  manager.getDomainShares();

    // Calculate MaxIL
    this.maxIL = getMaximalEntropyBasedInformationLoss(this.shares, super.getMicroaggregationDomainSizes());
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:MetricSDNMEntropyBasedInformationLoss.java

示例7: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] ahierarchies, 
                                  final ARXConfiguration config) {
    
    this.precomputed = true;
    double rows = input.getDataLength();
    for (GeneralizationHierarchy hierarchy : ahierarchies) {
        double share = (double)hierarchy.getDistinctValues()[0] / rows;
        if (share > threshold) {
            this.precomputed = false;
            break;
        }
    }
    
    if (precomputed) {
        precomputedMetric.initializeInternal(manager, definition, input, ahierarchies, config);
    } else {
        defaultMetric.initializeInternal(manager, definition, input, ahierarchies, config);
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:24,代码来源:AbstractMetricMultiDimensionalPotentiallyPrecomputed.java

示例8: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    
    // Prepare weights
    super.initializeInternal(manager, definition, input, hierarchies, config);

    // Determine total number of tuples
    this.tuples = (double)super.getNumRecords(config, input);
    
    // Save domain shares
    this.shares = manager.getDomainShares();
    
    // Min and max
    double[] min = new double[getDimensions()];
    Arrays.fill(min, 0d);
    double[] max = new double[getDimensions()];
    Arrays.fill(max, 1d);
    super.setMin(min);
    super.setMax(max);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:MetricMDNMLoss.java

示例9: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    super.initializeInternal(manager, definition, input, hierarchies, config);
    
    // Min and max
    double[] min = new double[hierarchies.length];
    double[] max = new double[min.length];

    for (int i=0; i<hierarchies.length; i++){
        String attribute = hierarchies[i].getName();
        min[i] = definition.getMinimumGeneralization(attribute);
        max[i] = definition.getMaximumGeneralization(attribute);
    }
    
    setMin(min);
    setMax(max);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:22,代码来源:MetricMDHeight.java

示例10: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    
    this.tuples = (double) getNumRecords(config, input);

    // Handle microaggregation
    this.microaggregationFunctions = manager.getMicroaggregationFunctions();
    this.microaggregationStartIndex = manager.getMicroaggregationStartIndex();
    this.microaggregationDomainSizes = manager.getMicroaggregationDomainSizes();
    if (!config.isUtilityBasedMicroaggregation() || !isAbleToHandleMicroaggregation()) {
        this.microaggregationFunctions = new DistributionAggregateFunction[0];
        this.microaggregationDomainSizes = new int[0];
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:19,代码来源:AbstractMetricSingleDimensional.java

示例11: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    
    super.initializeInternal(manager, definition, input, hierarchies, config);

    // Prepare
    double gFactor = super.getGeneralizationFactor();
    double sFactor = super.getSuppressionFactor();
    
    // Compute a reasonable minimum & maximum
    double[] min = new double[hierarchies.length];
    Arrays.fill(min, 0d);
    
    double[] max = new double[hierarchies.length];
    for (int i=0; i<max.length; i++) {
        max[i] = (2d * input.getDataLength() * log2(input.getDataLength())) * Math.max(gFactor, sFactor);
    }
    
    super.setMax(max);
    super.setMin(min);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:26,代码来源:MetricMDNUNMEntropyPrecomputed.java

示例12: initializeInternal

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
@Override
protected void initializeInternal(final DataManager manager,
                                  final DataDefinition definition, 
                                  final Data input, 
                                  final GeneralizationHierarchy[] hierarchies, 
                                  final ARXConfiguration config) {
    super.initializeInternal(manager, definition, input, hierarchies, config);

    // Initialize maximum levels
    height = new int[hierarchies.length];
    for (int j = 0; j < height.length; j++) {
        height[j] = hierarchies[j].getArray()[0].length - 1;
    }
    
    int rowCount = super.getNumRecords(config, input);
    this.cells = (double)rowCount * (double)input.getHeader().length;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:18,代码来源:MetricNMPrecision.java

示例13: writeDefinition

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
/**
   * Writes the data definition to the file.
   *
   * @param config
   * @param prefix
   * @param zip
   * @throws IOException
   */
  private void writeDefinition(final ModelConfiguration config,
                               final String prefix,
                               final ZipOutputStream zip) throws IOException {
  	
  	// Obtain definition
  	DataDefinition definition = null;
  	if (config == model.getInputConfig()) definition = model.getInputDefinition();
  	else definition = model.getOutputDefinition();
  	
  	// Store
if (definition != null) {
	zip.putNextEntry(new ZipEntry(prefix + "definition.xml")); //$NON-NLS-1$
	final Writer w = new OutputStreamWriter(zip);
	w.write(toXML(config, config.getInput().getHandle(), definition));
	w.flush();
}
  }
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:26,代码来源:WorkerSave.java

示例14: WorkerCreateCertificate

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
/**
 * Creates a new instance.
 * 
 * @param file
 * @param syntax
 * @param input
 * @param definition
 * @param config
 * @param result
 * @param transformation
 * @param output
 */
public WorkerCreateCertificate(String path,
                               CSVSyntax syntax,
                               DataHandle input,
                               DataDefinition definition,
                               ARXConfiguration config,
                               ARXResult result,
                               ARXNode transformation,
                               DataHandle output,
                               Model model) {
    this.syntax = syntax;
    this.path = path;
    this.input = input;
    this.definition = definition;
    this.config = config;
    this.result = result;
    this.transformation = transformation;
    this.output = output;
    this.model = model;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:32,代码来源:WorkerCreateCertificate.java

示例15: getSolutionSpaceSize

import org.deidentifier.arx.DataDefinition; //导入依赖的package包/类
/**
 * Returns the size of the solution space
 * @return
 * @throws IOException 
 */
private static int getSolutionSpaceSize(BenchmarkDataset dataset) throws IOException {
    int size = 1;
    DataDefinition definition = BenchmarkSetup.getData(dataset).getDefinition();
    for (String qi : definition.getQuasiIdentifiersWithGeneralization()) {
        size *= definition.getHierarchy(qi)[0].length;
    }
    return size;
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:14,代码来源:BenchmarkAnalysis6.java


注:本文中的org.deidentifier.arx.DataDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。