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


Java DataHandle类代码示例

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


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

示例1: toArray

import org.deidentifier.arx.DataHandle; //导入依赖的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: determineDataType

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Prints a list of matching data types
 * @param handle
 * @param column
 */
private static void determineDataType(DataHandle handle, int column) {
    System.out.println(" - Potential data types for attribute: "+handle.getAttributeName(column));
    List<Pair<DataType<?>, Double>> types = handle.getMatchingDataTypes(column);

    // Print entries sorted by match percentage
    for (Pair<DataType<?>, Double> entry : types) {
        System.out.print("   * ");
        System.out.print(entry.getKey().getDescription().getLabel());
        if (entry.getKey().getDescription().hasFormat()) {
            System.out.print("[");
            System.out.print(((DataTypeWithFormat) entry.getKey()).getFormat());
            System.out.print("]");
        }
        System.out.print(": ");
        System.out.println(entry.getValue());
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:23,代码来源:Example27.java

示例3: analyzeData

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Perform risk analysis
 * @param handle
 */
private static void analyzeData(DataHandle handle) {
    
    double THRESHOLD = 0.5d;
    
    ARXPopulationModel populationmodel = ARXPopulationModel.create(Region.USA);
    RiskEstimateBuilder builder = handle.getRiskEstimator(populationmodel);
    RiskModelSampleSummary risks = builder.getSampleBasedRiskSummary(THRESHOLD);
    
    System.out.println(" * Baseline risk threshold: " + getPrecent(THRESHOLD));
    System.out.println(" * Prosecutor attacker model");
    System.out.println("   - Records at risk: " + getPrecent(risks.getProsecutorRisk().getRecordsAtRisk()));
    System.out.println("   - Highest risk: " + getPrecent(risks.getProsecutorRisk().getHighestRisk()));
    System.out.println("   - Success rate: " + getPrecent(risks.getProsecutorRisk().getSuccessRate()));
    System.out.println(" * Journalist attacker model");
    System.out.println("   - Records at risk: " + getPrecent(risks.getJournalistRisk().getRecordsAtRisk()));
    System.out.println("   - Highest risk: " + getPrecent(risks.getJournalistRisk().getHighestRisk()));
    System.out.println("   - Success rate: " + getPrecent(risks.getJournalistRisk().getSuccessRate()));
    System.out.println(" * Marketer attacker model");
    System.out.println("   - Success rate: " + getPrecent(risks.getMarketerRisk().getSuccessRate()));
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:Example43.java

示例4: QualityModelColumnOrientedMSE

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelColumnOrientedMSE(WrappedBoolean interrupt,
                                     WrappedInteger progress,
                                     int totalWorkload,
                                     DataHandle input,
                                     DataHandle output,
                                     Groupify<TupleWrapper> groupedInput,
                                     Groupify<TupleWrapper> groupedOutput,
                                     String[][][] hierarchies,
                                     QualityDomainShare[] shares,
                                     int[] indices,
                                     QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelColumnOrientedMSE.java

示例5: QualityModelRowOrientedSSE

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelRowOrientedSSE(WrappedBoolean interrupt,
                                  WrappedInteger progress,
                                  int totalWorkload,
                                  DataHandle input,
                                  DataHandle output,
                                  Groupify<TupleWrapper> groupedInput,
                                  Groupify<TupleWrapper> groupedOutput,
                                  String[][][] hierarchies,
                                  QualityDomainShare[] shares,
                                  int[] indices,
                                  QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelRowOrientedSSE.java

示例6: QualityModelRowOrientedDiscernibility

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelRowOrientedDiscernibility(WrappedBoolean interrupt,
                                             WrappedInteger progress,
                                             int totalWorkload,
                                             DataHandle input,
                                             DataHandle output,
                                             Groupify<TupleWrapper> groupedInput,
                                             Groupify<TupleWrapper> groupedOutput,
                                             String[][][] hierarchies,
                                             QualityDomainShare[] shares,
                                             int[] indices,
                                             QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelRowOrientedDiscernibility.java

示例7: QualityModelRowOrientedAmbiguity

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelRowOrientedAmbiguity(WrappedBoolean interrupt,
                                        WrappedInteger progress,
                                        int totalWorkload,
                                        DataHandle input,
                                        DataHandle output,
                                        Groupify<TupleWrapper> groupedInput,
                                        Groupify<TupleWrapper> groupedOutput,
                                        String[][][] hierarchies,
                                        QualityDomainShare[] shares,
                                        int[] indices,
                                        QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelRowOrientedAmbiguity.java

示例8: QualityModelColumnOrientedPrecision

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelColumnOrientedPrecision(WrappedBoolean interrupt,
                                           WrappedInteger progress,
                                           int totalWorkload,
                                           DataHandle input,
                                           DataHandle output,
                                           Groupify<TupleWrapper> groupedInput,
                                           Groupify<TupleWrapper> groupedOutput,
                                           String[][][] hierarchies,
                                           QualityDomainShare[] shares,
                                           int[] indices,
                                           QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelColumnOrientedPrecision.java

示例9: QualityModelColumnOrientedNonUniformEntropy

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelColumnOrientedNonUniformEntropy(WrappedBoolean interrupt,
                                                   WrappedInteger progress,
                                                   int totalWorkload,
                                                   DataHandle input,
                                                   DataHandle output,
                                                   Groupify<TupleWrapper> groupedInput,
                                                   Groupify<TupleWrapper> groupedOutput,
                                                   String[][][] hierarchies,
                                                   QualityDomainShare[] shares,
                                                   int[] indices,
                                                   QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelColumnOrientedNonUniformEntropy.java

示例10: getInputFrequencies

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Returns the frequencies of values in input data for all rows with transformation level >= level
 * @param transformations
 * @param column
 * @param level
 * @return
 */
private Map<String, Double> getInputFrequencies( int[] transformations, int column, int level) {
    DataHandle input = getInput();
    Map<String, Double> result = new HashMap<String, Double>();
    for (int row = 0; row < input.getNumRows(); row++) {
        if (transformations[row] >= level) {
            String value = input.getValue(row, column);
            Double count = result.get(value);
            result.put(value, count != null ? count + 1d : 1d);
        }

        // Check
        checkInterrupt();
    }
    return result;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:23,代码来源:QualityModelColumnOrientedNonUniformEntropy.java

示例11: getOutputFrequencies

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Returns the frequencies of values in input data on the target level in output for all rows with transformation level >= level
 * @param transformations
 * @param generalizationFunctions
 * @param column
 * @param level
 * @param target
 * @return
 */
private Map<String, Double> getOutputFrequencies(int[] transformations,
                                                 Map<String, String>[] generalizationFunctions,
                                                 int column, 
                                                 int level, 
                                                 int target) {
    Map<String, Double> result = new HashMap<String, Double>();
    DataHandle input = getInput();
    for (int row = 0; row < input.getNumRows(); row++) {
        if (transformations[row] >= level) {
            String value = generalizationFunctions[target].get(input.getValue(row, column));
            Double count = result.get(value);
            result.put(value, count != null ? count + 1d : 1d);
        }

        // Check
        checkInterrupt();
    }
    return result;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:29,代码来源:QualityModelColumnOrientedNonUniformEntropy.java

示例12: QualityModelRowOrientedAECS

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelRowOrientedAECS(WrappedBoolean interrupt,
                                   WrappedInteger progress,
                                   int totalWorkload,
                                   DataHandle input,
                                   DataHandle output,
                                   Groupify<TupleWrapper> groupedInput,
                                   Groupify<TupleWrapper> groupedOutput,
                                   String[][][] hierarchies,
                                   QualityDomainShare[] shares,
                                   int[] indices,
                                   QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelRowOrientedAECS.java

示例13: QualityMeasureColumnOriented

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * @param handle
 * @param indices
 * @param minimum
 * @param result
 * @param maximum
 */
public QualityMeasureColumnOriented(DataHandle handle,
                                    int[] indices,
                                    double[] minimum,
                                    double[] result,
                                    double[] maximum) {
    
    // Prepare
    this.result = new HashMap<>();
    this.minimum = new HashMap<>();
    this.maximum = new HashMap<>();
    
    // Convert
    for (int i = 0; i < indices.length; i++) {
        int column = indices[i];
        if (!Double.isNaN(result[i])) {
            String attribute = handle.getAttributeName(column);
            this.minimum.put(attribute, minimum[i]);
            this.result.put(attribute, result[i]);
            this.maximum.put(attribute, maximum[i]);
        }
    }
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:31,代码来源:QualityMeasureColumnOriented.java

示例14: QualityModelRowOrientedKLDivergence

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Creates a new instance
 * 
 * @param interrupt
 * @param progress
 * @param totalWorkload
 * @param input
 * @param output
 * @param groupedInput
 * @param groupedOutput
 * @param hierarchies
 * @param shares
 * @param indices
 * @param config
 */
public QualityModelRowOrientedKLDivergence(WrappedBoolean interrupt,
                                           WrappedInteger progress,
                                           int totalWorkload,
                                           DataHandle input,
                                           DataHandle output,
                                           Groupify<TupleWrapper> groupedInput,
                                           Groupify<TupleWrapper> groupedOutput,
                                           String[][][] hierarchies,
                                           QualityDomainShare[] shares,
                                           int[] indices,
                                           QualityConfiguration config) {
    super(interrupt,
          progress,
          totalWorkload,
          input,
          output,
          groupedInput,
          groupedOutput,
          hierarchies,
          shares,
          indices,
          config);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:39,代码来源:QualityModelRowOrientedKLDivergence.java

示例15: getArea

import org.deidentifier.arx.DataHandle; //导入依赖的package包/类
/**
 * Returns the area
 * @param handle
 * @param row
 * @param indices
 * @param shares
 * @return
 */
private double getArea(DataHandle handle, 
                       int row,
                       int[] indices,
                       QualityDomainShare[] shares) {
    double area = 1d;
    for (int i = 0; i < indices.length; i++) {
        int column = indices[i];
        double loss = 1d;
        if (!isSuppressed(handle, row, column)) {
            loss = shares[i].getShare(handle.getValue(row, column), 0);
        }
        area *= loss * shares[i].getDomainSize();
    }
    return area;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:24,代码来源:QualityModelRowOrientedKLDivergence.java


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