本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例7: PointBiserial
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public PointBiserial(DistanceMeasure dm) {
this.dm = dm;
}
示例8: Gamma
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public Gamma(DistanceMeasure dm) {
this.dm = dm;
}
示例9: WB
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public WB(DistanceMeasure dm) {
this.dm = dm;
}
示例10: GPlus
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public GPlus(DistanceMeasure dm) {
this.dm = dm;
}
示例11: Tau
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public Tau(DistanceMeasure dm) {
this.dm = dm;
}
示例12: CIndex
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public CIndex(DistanceMeasure dm) {
this.dm = dm;
}
示例13: MinMaxCut
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public MinMaxCut(DistanceMeasure dm) {
this.dm = dm;
}
示例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");
}
示例15: DMKMedoids
import net.sf.javaml.distance.DistanceMeasure; //导入依赖的package包/类
public DMKMedoids(int numberOfClusters, int maxIterations, DistanceMeasure dm) {
super(numberOfClusters, maxIterations, dm);
}