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


Java DistanceMeasure类代码示例

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


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

示例1: kNearest

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
/**
 * Returns the k instances of the given data set that are the closest to the
 * instance that is given as a parameter.
 * 
 * @param dm
 *            the distance measure used to calculate the distance between
 *            instances
 * @param inst
 *            the instance for which we need to find the closest
 * @return the instances from the supplied data set that are closest to the
 *         supplied instance
 * 
 */
@Override
public Set<Instance> kNearest(int k, Instance inst, DistanceMeasure dm) {
    Map<Instance, Double> closest = new HashMap<Instance, Double>();
    double max = dm.getMaxValue();
    for (Instance tmp : this) {
        double d = dm.measure(inst, tmp);
        if (dm.compare(d, max) && !inst.equals(tmp)) {
            closest.put(tmp, d);
            if (closest.size() > k)
                max = removeFarthest(closest,dm);
        }

    }
    return closest.keySet();
}
 
开发者ID:eracle,项目名称:gap,代码行数:29,代码来源:DefaultDataset.java

示例2: removeFarthest

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
private double removeFarthest(Map<Instance, Double> vector,DistanceMeasure dm) {
    Instance tmp = null;// ; = vector.get(0);
    double max = dm.getMinValue();
    //System.out.println("minvalue:"+max);
    for (Instance inst : vector.keySet()) {
        double d = vector.get(inst);
        
        if (dm.compare(max,d)) {
            max = d;
            tmp = inst;
        }
       // System.out.println("d="+d+"\t"+max);
    }
    vector.remove(tmp);
    return max;

}
 
开发者ID:eracle,项目名称:gap,代码行数:18,代码来源:DefaultDataset.java

示例3: CustomIterativeKMeans

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public CustomIterativeKMeans(int kMin, int kMax, int iterations, DistanceMeasure dm, ClusterEvaluation ce) {
    this.kMin = kMin;
    this.kMax = kMax;
    this.iterations = iterations;
    this.dm = dm;
    this.ce = ce;
}
 
开发者ID:taochen,项目名称:ssascaling,代码行数:8,代码来源:CustomIterativeKMeans.java

示例4: MCL

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
/**
 * XXX doc
 * 
 * @param dm
 * @param maxResidual
 * @param gamma
 * @param loopGain
 * @param maxZero
 */
public MCL(DistanceMeasure dm, double maxResidual, double pGamma, double loopGain, double maxZero) {
    if (!(dm instanceof AbstractSimilarity))
        throw new RuntimeException("MCL requires the distance measure to be a Similarity measure");

    
    this.dm = dm;
    this.maxResidual = maxResidual;
    this.pGamma = pGamma;
    this.loopGain = loopGain;
    this.maxZero = maxZero;
}
 
开发者ID:eracle,项目名称:gap,代码行数:21,代码来源:MCL.java

示例5: MultiKMeans

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
/**
    * XXX add doc
    * 
    * @param clusters
    * @param iterations
    * @param repeats
    * @param DistanceMeasure dm
    * @param ClusterEvaluation ce
    */
public MultiKMeans(int clusters, int iterations, int repeats,
		DistanceMeasure dm, ClusterEvaluation ce) {
	this.clusters = clusters;
	this.iterations = iterations;
	this.repeats = repeats;
	this.dm = dm;
	this.ce = ce;

}
 
开发者ID:eracle,项目名称:gap,代码行数:19,代码来源:MultiKMeans.java

示例6: CustomKMean

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public CustomKMean(int clusters, int iterations, DistanceMeasure dm) {
    this.numberOfClusters = clusters;
    this.numberOfIterations = iterations;
    this.dm = dm;
    rg = new Random(System.currentTimeMillis());
}
 
开发者ID:taochen,项目名称:ssascaling,代码行数:7,代码来源:CustomKMean.java

示例7: PointBiserial

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public PointBiserial(DistanceMeasure dm) {
    this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:PointBiserial.java

示例8: Gamma

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public Gamma(DistanceMeasure dm) {
	this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:Gamma.java

示例9: WB

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public WB(DistanceMeasure dm) {
    this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:WB.java

示例10: GPlus

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public GPlus(DistanceMeasure dm) {
	this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:GPlus.java

示例11: Tau

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public Tau(DistanceMeasure dm) {
    this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:Tau.java

示例12: CIndex

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public CIndex(DistanceMeasure dm) {
    this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:CIndex.java

示例13: MinMaxCut

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public MinMaxCut(DistanceMeasure dm) {
    this.dm = dm;
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:MinMaxCut.java

示例14: kNearest

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
@Override
public Set<Instance> kNearest(int k, Instance inst,DistanceMeasure dm) {
    // TODO this method can be implemented on a fold.
    throw new UnsupportedOperationException("Method is not yet implemented");
}
 
开发者ID:eracle,项目名称:gap,代码行数:6,代码来源:Fold.java

示例15: DMKMedoids

import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public DMKMedoids(int numberOfClusters, int maxIterations, DistanceMeasure dm) {
    super(numberOfClusters, maxIterations, dm);
}
 
开发者ID:eracle,项目名称:gap,代码行数:4,代码来源:DMKMedoids.java


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