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


Java Transformation类代码示例

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


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

示例1: checkAndTag

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
 * Checks and tags the given transformation.
 *
 * @param transformation
 * @param configuration
 */
private void checkAndTag(Transformation transformation, FLASHPhaseConfiguration configuration) {

    // Check or evaluate
    if (configuration.getTriggerEvaluate().appliesTo(transformation)) {
        InformationLossWithBound<?> loss = checker.getMetric().getInformationLoss(transformation, (HashGroupify)null);
        transformation.setInformationLoss(loss.getInformationLoss());
        transformation.setLowerBound(loss.getLowerBound());
        if (loss.getLowerBound() == null) {
            transformation.setLowerBound(checker.getMetric().getLowerBound(transformation));
        }
    } else if (configuration.getTriggerCheck().appliesTo(transformation)) {
        transformation.setChecked(checker.check(transformation));
        progress((double)++checked / (double)solutionSpace.getSize());
    }

    // Store optimum
    trackOptimum(transformation);

    // Tag
    configuration.getTriggerTag().apply(transformation);

    // Potentially prune some parts of the search space
    prune(transformation);
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:31,代码来源:FLASHAlgorithmImpl.java

示例2: linearSearch

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
 * Implements a depth-first search with predictive tagging.
 *
 * @param start
 */
private void linearSearch(int start) {

    // Obtain node action
    DependentAction triggerSkip = config.getLinearPhaseConfiguration().getTriggerSkip();

    // Skip this node
    Transformation transformation = solutionSpace.getTransformation(start);
    if (!skip(triggerSkip, transformation)) {

        // Check and tag
        checkAndTag(transformation, config.getLinearPhaseConfiguration());

        // DFS
        for (final int child : getSortedSuccessors(start)) {
            if (!skip(triggerSkip, solutionSpace.getTransformation(child))) {
                linearSearch(child);
            }
        }
    }

    // Mark as successors pruned
    transformation.setProperty(solutionSpace.getPropertySuccessorsPruned());
}
 
开发者ID:arx-deidentifier,项目名称:risk-benchmark,代码行数:29,代码来源:FLASHAlgorithmImpl.java

示例3: expand

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
* Returns the successor with minimal information loss, if any, null otherwise.
* @param transformation
* @return
*/
private Transformation expand(Transformation transformation) {
    
    // Result
    Transformation result = null;

    // Find
    LongArrayList list = solutionSpace.getSuccessors(transformation.getIdentifier());
    for (int i=0; i<list.size(); i++) {
        long id = list.getQuick(i);
    
        Transformation successor = solutionSpace.getTransformation(id);
        if (!successor.hasProperty(propertyChecked)) {
            assureChecked(successor);
            if (result == null || successor.getInformationLoss().compareTo(result.getInformationLoss()) < 0) {
                result = successor;
            }
        }
        if (getGlobalOptimum() != null) {
            return result;
        }
    }
    return result;
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:29,代码来源:AlgorithmMinimal.java

示例4: checkAndTag

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
 * Checks and tags the given transformation.
 *
 * @param transformation
 * @param configuration
 */
private void checkAndTag(Transformation transformation, FLASHPhaseConfiguration configuration) {

    // Check or evaluate
    if (configuration.getTriggerEvaluate().appliesTo(transformation)) {
        InformationLossWithBound<?> loss = checker.getMetric().getInformationLoss(transformation, (HashGroupify)null);
        transformation.setInformationLoss(loss.getInformationLoss());
        transformation.setLowerBound(loss.getLowerBound());
        if (loss.getLowerBound() == null) {
            transformation.setLowerBound(checker.getMetric().getLowerBound(transformation));
        }
    } else if (configuration.getTriggerCheck().appliesTo(transformation)) {
        transformation.setChecked(checker.check(transformation));
        progress((double)++checked / (double)solutionSpace.getSize());
    }

    // Store optimum
    trackOptimum(transformation);

    // Tag
    configuration.getTriggerTag().apply(transformation);
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:28,代码来源:AlgorithmFlash.java

示例5: skip

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
 * Returns whether a node should be skipped.
 *
 * @param transformation
 * @param identifier
 * @return
 */
private boolean skip(DependentAction trigger, Transformation transformation) {

    // If the trigger applies, skip
    if (trigger.appliesTo(transformation)) {
        return true;
    }

    // Check, if we can prune based on a monotonic sub-metric
    if (!checker.getConfiguration().isPracticalMonotonicity() && (getGlobalOptimum() != null)) {

        // We skip, if we already know that this node has insufficient utility
        if (transformation.hasProperty(solutionSpace.getPropertyInsufficientUtility())) {
            return true;
        }
    }
    
    // We need to process this node
    return false;
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:27,代码来源:AlgorithmFlash.java

示例6: expand

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
* Returns the successor with minimal information loss, if any, null otherwise.
* @param queue
* @param transformation
* @return
*/
private Transformation expand(PriorityQueue<Long> queue, Transformation transformation) {
    Transformation result = null;
    
    LongArrayList list = solutionSpace.getSuccessors(transformation.getIdentifier());
    for (int i=0; i<list.size(); i++) {
        long id = list.getQuick(i);
        Transformation successor = solutionSpace.getTransformation(id);
        if (!successor.hasProperty(propertyExpanded)) {
            assureChecked(successor);
            queue.add(successor.getIdentifier());
            if (result == null || successor.getInformationLoss().compareTo(result.getInformationLoss()) < 0) {
                result = successor;
            }
        }
        if ((timeLimit != 0 && getTime() > timeLimit) || timeLimit == 0 && getGlobalOptimum() != null) {
            return null;
        }
    }
    transformation.setProperty(propertyExpanded);
    return result;
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:28,代码来源:AlgorithmLightning.java

示例7: getInformationLossInternal

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
@Override
protected InformationLossWithBound<IGreedyInformationLoss> getInformationLossInternal(Transformation node, HashGroupify g) {

    // Determine minimal equivalence class size (worst case per generalization)
    int greedy = Integer.MAX_VALUE;
    HashGroupifyEntry m = g.getFirstEquivalenceClass();
    while (m != null) {
        greedy = Math.min(greedy, m.count);
        m = m.nextOrdered;
    }
    // Greater sizes are better when comparing with other generalizations
    greedy = -greedy;

    // Determine maximal number of distinct values (DataFly strategy)
    int datafly = 0;
    int[] transformation = node.getGeneralization();
    for (int i = 0; i < transformation.length; i++) {
        datafly = Math.max(datafly, hierarchies[i].getDistinctValues(transformation[i]).length);
    }
    datafly = -datafly;

    double[] array = new double[] { greedy, datafly };
    return new InformationLossWithBound<IGreedyInformationLoss>(new IGreedyInformationLoss(array), new IGreedyInformationLoss(array));
}
 
开发者ID:arx-deidentifier,项目名称:highdimensional-benchmark,代码行数:25,代码来源:IGreedyMetric.java

示例8: expand

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
* Returns the successor with minimal information loss, if any, null otherwise.
* @param queue
* @param transformation
* @return
*/
private Transformation expand(PriorityQueue<Long> queue, Transformation transformation) {
    
    Transformation result = null;
    LongArrayList list = transformation.getSuccessors();
    for (int i = 0; i < list.size(); i++) {
        long id = list.getQuick(i);
        Transformation successor = solutionSpace.getTransformation(id);
        if (!successor.hasProperty(propertyExpanded) && !successor.hasProperty(propertyInsufficientUtility)) {
            assureChecked(successor);
            queue.add(successor.getIdentifier());
            if (result == null || successor.getInformationLoss().compareTo(result.getInformationLoss()) < 0) {
                result = successor;
            }
        }
        if (mustStop()) {
            return null;
        }
    }
    transformation.setProperty(propertyExpanded);
    return result;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:28,代码来源:LIGHTNINGAlgorithm.java

示例9: prune

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
* Returns whether we can prune this Transformation
* @param transformation
* @return
*/
private boolean prune(Transformation transformation) {
    
    // Already expanded
    if (transformation.hasProperty(propertyExpanded) ||
        transformation.hasProperty(propertyInsufficientUtility)){
        return true;
    }
    
    // If a current optimum has been discovered
    Transformation optimum = getGlobalOptimum();
    if (optimum != null) {
        
        // We can compare lower bounds on quality
        InformationLoss<?> bound = transformation.getLowerBound();
        if (bound.compareTo(optimum.getInformationLoss()) >= 0) {
            transformation.setProperty(propertyInsufficientUtility);
            return true;
        }
    }
    
    // We have to process this transformation
    return false;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:29,代码来源:LIGHTNINGAlgorithm.java

示例10: isPrivacyModelFulfilled

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
 * Checks whether the given entry is anonymous.
 * @param transformation
 * @param entry
 * @return
 * @returns -1, if all criteria are fulfilled, 0, if minimal group size is not fulfilled, (index+1) if criteria[index] is not fulfilled
 */
private int isPrivacyModelFulfilled(Transformation transformation, HashGroupifyEntry entry) {
    
    // Check minimal group size
    if (minimalClassSize != Integer.MAX_VALUE && entry.count < minimalClassSize) {
        return 0;
    }
    
    // Check other criteria
    // Note: The d-presence criterion must be checked first to ensure correct handling of d-presence with tuple suppression.
    // This is currently ensured by convention. See ARXConfiguration.getCriteriaAsArray();
    for (int i = 0; i < classBasedCriteria.length; i++) {
        if (!classBasedCriteria[i].isAnonymous(transformation, entry)) {
            return i + 1;
        }
    }
    return -1;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:HashGroupify.java

示例11: linearSearch

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
/**
 * Implements a depth-first search with predictive tagging.
 *
 * @param transformation
 */
private void linearSearch(Transformation transformation) {

    // Obtain node action
    DependentAction triggerSkip = config.getLinearPhaseConfiguration().getTriggerSkip();

    // Skip this node
    if (!skip(triggerSkip, transformation)) {

        // Check and tag
        checkAndTag(transformation, config.getLinearPhaseConfiguration());

        // DFS
        for (final int child : getSortedSuccessors(transformation)) {
            Transformation childTransformation = solutionSpace.getTransformation(child);
            if (!skip(triggerSkip, childTransformation)) {
                linearSearch(childTransformation);
            }
        }
    }

    // Mark as successors pruned
    transformation.setProperty(solutionSpace.getPropertySuccessorsPruned());
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:29,代码来源:FLASHAlgorithmImpl.java

示例12: getInformationLossInternal

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
@Override
protected InformationLossWithBound<InformationLossDefault> getInformationLossInternal(final Transformation node, final HashGroupify g) {

    double value = 0;
    double lowerBound = 0; // DM*
    HashGroupifyEntry m = g.getFirstEquivalenceClass();
    while (m != null) {
        if (m.count > 0) {
            if (m.isNotOutlier) {
                double current = ((double) m.count * (double) m.count);
                value += current;
                lowerBound += current;
            } else {
                value += ((double) rowCount * (double) m.count);
                lowerBound += ((double) m.count * (double) m.count);
            }
        }
        m = m.nextOrdered;
    }
    return new InformationLossDefaultWithBound(value, lowerBound);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:22,代码来源:MetricDM.java

示例13: getInformationLossInternal

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
@Override
protected InformationLossWithBound<InformationLossDefault> getInformationLossInternal(final Transformation node, final HashGroupify g) {

    if (node.getLowerBound() != null) {
        return new InformationLossWithBound<InformationLossDefault>((InformationLossDefault) node.getLowerBound(),
                                                                    (InformationLossDefault) node.getLowerBound());
    }

    double value = 0;
    HashGroupifyEntry m = g.getFirstEquivalenceClass();
    while (m != null) {
        if (m.count > 0) {
            value += (double) m.count * (double) m.count;
        }
        m = m.nextOrdered;
    }
    return new InformationLossDefaultWithBound(value, value);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:19,代码来源:MetricDMStar.java

示例14: getInformationLossInternal

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
@Override
protected ILMultiDimensionalWithBound getInformationLossInternal(final Transformation node, final HashGroupify g) {
    
    ILMultiDimensionalWithBound result = super.getInformationLossInternal(node, g);
    double[] loss = result.getInformationLoss() != null ? result.getInformationLoss().getValues() : null;
    double[] bound = result.getLowerBound() != null ?result.getLowerBound().getValues() : null;
    
    // Switch sign bit and round
    for (int column = 0; column < loss.length; column++) {
        if (loss != null) loss[column] /= upper[column];
        if (bound != null) bound[column] /= upper[column];
    }

    // Return
    return new ILMultiDimensionalWithBound(super.createInformationLoss(loss),
                                           super.createInformationLoss(bound));
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:18,代码来源:MetricMDNUNMNormalizedEntropyPrecomputed.java

示例15: getLowerBoundInternal

import org.deidentifier.arx.framework.lattice.Transformation; //导入依赖的package包/类
@Override
protected AbstractILMultiDimensional getLowerBoundInternal(Transformation node,
                                                           HashGroupify groupify) {
    
    AbstractILMultiDimensional result = super.getLowerBoundInternal(node, groupify);
    if (result == null) return null;
    double[] loss = result.getValues();
    
    // Switch sign bit and round
    for (int column = 0; column < loss.length; column++) {
        loss[column] /= upper[column];
    }

    // Return
    return super.createInformationLoss(loss);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:17,代码来源:MetricMDNUNMNormalizedEntropyPrecomputed.java


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