本文整理汇总了Java中org.deidentifier.arx.DataHandle.isOutlier方法的典型用法代码示例。如果您正苦于以下问题:Java DataHandle.isOutlier方法的具体用法?Java DataHandle.isOutlier怎么用?Java DataHandle.isOutlier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.deidentifier.arx.DataHandle
的用法示例。
在下文中一共展示了DataHandle.isOutlier方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSuppressed
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Returns the number of suppressed tuples
*
* @param output
* @return
*/
private static int getSuppressed(DataHandle output) {
int count = 0;
for (int i = 0; i < output.getNumRows(); i++) {
if (output.isOutlier(i)) {
count++;
}
}
return count;
}
示例2: getNumbersFromNumericColumn
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Parses numbers from a numeric column
* @param handle
* @param column
* @return
*/
private double[] getNumbersFromNumericColumn(DataHandle handle, int column) {
try {
// Prepare
String attribute = handle.getAttributeName(column);
double[] result = new double[handle.getNumRows()];
// Parse numbers
if (handle.getDataType(attribute) instanceof DataTypeWithRatioScale) {
QualityConfigurationValueParser<?> parser = QualityConfigurationValueParser.create(handle.getDataType(attribute));
for (int row = 0; row < handle.getNumRows(); row++) {
String value = handle.getValue(row, column);
if (handle.isOutlier(row) || super.isSuppressed(column, value)) {
result[row] = Double.NaN;
} else {
result[row] = parser.getDouble(value);
}
// Check
checkInterrupt();
}
// Return
return result;
} else {
// Return
return null;
}
} catch (Exception e) {
// Fail silently
return null;
}
}
示例3: isSuppressed
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Returns whether a value is suppressed
*
* @param handle
* @param row
* @param column
* @return
*/
boolean isSuppressed(DataHandle handle, int row, int column) {
// Check flag
if (handle.isOutlier(row)) {
return true;
} else {
return isSuppressed(column, handle.getValue(row, column));
}
}
示例4: TupleWrapper
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Constructor
*
* @param handle
* @param row
*/
public TupleWrapper(DataHandle handle, int[] indices, int row) {
this.values = new String[indices.length];
int hashcode = 1;
int idx = 0;
for (int index : indices) {
String value = handle.getValue(row, index);
hashcode = 31 * hashcode + value.hashCode();
values[idx++] = value;
}
this.hashcode = hashcode;
this.suppressed = handle.isOutlier(row);
}
示例5: getNumbersFromNumericColumn
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Parses numbers from a numeric output column
* @param inputAsNumbers
* @param output
* @param column
* @return
*/
private double[] getNumbersFromNumericColumn(double[] inputAsNumbers, DataHandle output, int column) {
try {
// Prepare
String attribute = output.getAttributeName(column);
double[] result = new double[output.getNumRows() * 2];
double[] minmax = getMinMax(inputAsNumbers);
double minimum = minmax[0];
double maximum = minmax[1];
// Parse numbers
if (output.getDataType(attribute) instanceof DataTypeWithRatioScale) {
QualityConfigurationValueParser<?> parser = QualityConfigurationValueParser.create(output.getDataType(attribute));
for (int row = 0; row < output.getNumRows(); row++) {
if (output.isOutlier(row)) {
result[row * 2] = minimum;
result[row * 2 + 1] = maximum;
} else {
double number = parser.getDouble(output.getValue(row, column));
result[row * 2] = number;
result[row * 2 + 1] = number;
}
// Check
checkInterrupt();
}
// Return
return result;
} else {
// Return
return null;
}
} catch (Exception e) {
// Fail silently
return null;
}
}
示例6: getRangeFromNumericColumn
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Tries to parse numbers from output when there is a numeric input column
* @param inputNumbers
* @param output
* @param column
* @return
*/
private double[] getRangeFromNumericColumn(double[] inputNumbers,
DataHandle output,
int column) {
try {
// Prepare
String attribute = output.getAttributeName(column);
double[] result = new double[output.getNumRows() * 2];
double[] minmax = getMinMax(inputNumbers);
double minimum = minmax[0];
double maximum = minmax[1];
// Create a sample of the data
List<String> sample = new ArrayList<>();
for (int row = 0; row < output.getNumRows() && sample.size() < 50; row++) {
if (!output.isOutlier(row)) {
sample.add(output.getValue(row, column));
}
}
// Create parsers
QualityConfigurationValueParser<?> valueParser = QualityConfigurationValueParser.create(output.getDataType(attribute));
QualityConfigurationRangeParser rangeParser = QualityConfigurationRangeParser.getParser(valueParser, sample);
// Parse
for (int row = 0; row < output.getNumRows(); row++) {
// Parse
double[] range;
if (output.isOutlier(row)) {
range = new double[]{minimum, maximum};
} else {
String value = output.getValue(row, column);
if (isSuppressed(column, value)) {
range = new double[]{minimum, maximum};
} else {
range = rangeParser.getRange(valueParser, value, minimum, maximum);
}
}
result[row * 2] = range[0];
result[row * 2 + 1] = range[1];
// Check
checkInterrupt();
}
// Return
return result;
} catch (Exception e) {
// Fail silently
return null;
}
}
示例7: getMissings
import org.deidentifier.arx.DataHandle; //导入方法依赖的package包/类
/**
* Returns the fraction of missing values
* @param output
* @param indices
* @return
*/
private QualityMeasureColumnOriented getMissings(DataHandle output, int[] indices) {
// Prepare
double[] minimum = new double[indices.length];
double[] result = new double[indices.length];
double[] maximum = new double[indices.length];
Arrays.fill(minimum, 0d);
Arrays.fill(maximum, 1d);
// Calculate
for (int i = 0; i < indices.length; i++) {
// Extract special label for missings from hierarchy
int column = indices[i];
String attribute = output.getAttributeName(column);
String[][] hierarchy = output.getDefinition().getHierarchy(attribute);
Set<String> roots = new HashSet<>();
for (String[] row : hierarchy) {
roots.add(row[row.length - 1]);
}
String ROOT_VALUE = (roots.size() == 1) ? roots.iterator().next() : null;
// Search for missings
double missings = 0d;
for (int row = 0; row < output.getNumRows(); row++) {
// Suppressed record
if (output.isOutlier(row)) {
missings += 1d;
} else {
// Suppressed value
String value = output.getValue(row, column);
if (value.equals(DataType.ANY_VALUE) ||
value.equals(DataType.NULL_VALUE) ||
value.equals(ROOT_VALUE)) {
missings += 1d;
}
}
// Check
checkInterrupt();
}
missings /= (double)output.getNumRows();
result[i] = 1d - missings;
}
// Return
return new QualityMeasureColumnOriented(output, indices, minimum, result, maximum);
}