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


Java MetricsUtils类代码示例

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


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

示例1: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature vd) {
    // Check if instance of the right class ...
    if (!(vd instanceof SimpleColorHistogram))
        throw new UnsupportedOperationException("Wrong descriptor.");

    // casting ...
    SimpleColorHistogram ch = (SimpleColorHistogram) vd;

    // check if parameters are fitting ...
    if ((ch.histogram.length != histogram.length) || (ch.histogramType != histogramType))
        throw new UnsupportedOperationException("Histogram lengths or color spaces do not match");

    // do the comparison ...
    double sum = 0;
    if (distFunc == DistanceFunction.JSD)
        return (float) MetricsUtils.jsd(histogram, ch.histogram);
    else if (distFunc == DistanceFunction.TANIMOTO)
        return (float) MetricsUtils.tanimoto(histogram, ch.histogram);
    else if (distFunc == DistanceFunction.L1)
        return (float) MetricsUtils.distL1(histogram, ch.histogram);
    else
        return (float) MetricsUtils.distL2(histogram, ch.histogram);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:24,代码来源:SimpleColorHistogram.java

示例2: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
@Override
    public float getDistance(LireFeature feature) {
        double k1 = 1.2, b = 0.75;
        double[] hist1 = new double[hist.length], hist2 = new double[hist.length];
        System.arraycopy(hist, 0, hist1, 0, hist.length);
        System.arraycopy(((SimpleFeature) feature).hist, 0, hist2, 0, hist.length);
        // weighting ...
//        double d1=0d, d2=0d;
//        for (int i = 0; i < hist1.length; i++)
//            d1 += hist1[i];
//        for (int i = 0; i < hist2.length; i++)
//            d2 += hist2[i];
        for (int i = 0; i < hist1.length; i++) {
//            hist1[i] = (hist1[i]*(k1+1.0))/(hist1[i] + k1*(1-b+b*d1/TestNister.avgDocLength)) * Math.log((10200-TestNister.df[i]+0.5)/(TestNister.df[i]+0.5));
//            hist2[i] = (hist2[i]*(k1+1.0))/(hist2[i] + k1*(1-b+b*d1/TestNister.avgDocLength)) * Math.log((10200-TestNister.df[i]+0.5)/(TestNister.df[i]+0.5));
            if (hist1[i] > 0) hist1[i] = 1 + Math.log(hist1[i]);
            if (hist2[i] > 0) hist2[i] = 1 + Math.log(hist2[i]);
        }
//        double dist = (1f - MetricsUtils.cosineCoefficient(hist1, hist2));
//        if (dist<0) {
//            System.out.println(dist);
//            dist = 0;
//        }
        return (float) MetricsUtils.distL2(hist1, hist2);
    }
 
开发者ID:fish2000,项目名称:lire,代码行数:26,代码来源:SimpleFeature.java

示例3: calculateStress

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public double calculateStress(List<double[]> features) {
    double result = 0d;
    for (Iterator<Integer> iterator = members.iterator(); iterator.hasNext(); ) {
        int member = iterator.next();
        double[] feature = features.get(member);
        result += MetricsUtils.distL2(center, feature);
    }
    return result;
}
 
开发者ID:fish2000,项目名称:lire,代码行数:10,代码来源:KMeans.java

示例4: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
        // chi^2 distance ... as mentioned in the paper.
//        double distance = 0;
//        double lower;
//        for (int i = 0; i < histogram.length; i++) {
//            lower = histogram[i] + ((BinaryPatternsPyramid) feature).histogram[i];
//            if (lower > 0)
//                distance += (histogram[i] - ((BinaryPatternsPyramid) feature).histogram[i]) * (histogram[i] - ((BinaryPatternsPyramid) feature).histogram[i]) / lower;
//        }
//        return (float) distance;
        return (float) MetricsUtils.distL1(histogram, ((BinaryPatternsPyramid) feature).histogram);
    }
 
开发者ID:fish2000,项目名称:lire,代码行数:13,代码来源:BinaryPatternsPyramid.java

示例5: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
        // chi^2 distance ... as mentioned in the paper.
//        double distance = 0;
//        double lower;
//        for (int i = 0; i < histogram.length; i++) {
//            lower = histogram[i] + ((PHOG) feature).histogram[i];
//            if (lower > 0)
//                distance += (histogram[i] - ((PHOG) feature).histogram[i]) * (histogram[i] - ((PHOG) feature).histogram[i]) / lower;
//        }
//        return (float) distance;
        return (float) MetricsUtils.distL1(histogram, ((PHOG) feature).histogram);
    }
 
开发者ID:fish2000,项目名称:lire,代码行数:13,代码来源:PHOG.java

示例6: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public double getDistance(double[] feature) {
    return MetricsUtils.distL2(center, feature);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:4,代码来源:KMeans.java

示例7: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
    if (!(feature instanceof RankAndOpponent))
        throw new UnsupportedOperationException("Wrong descriptor.");
    return MetricsUtils.jsd(((RankAndOpponent) feature).descriptor, descriptor);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:6,代码来源:RankAndOpponent.java

示例8: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
@Override
public float getDistance(LireFeature feature) {
    return (float) MetricsUtils.tanimoto(histogram, feature.getDoubleHistogram());
}
 
开发者ID:fish2000,项目名称:lire,代码行数:5,代码来源:LocalBinaryPatternsAndOpponent.java

示例9: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
    if (!(feature instanceof JointHistogram))
        throw new UnsupportedOperationException("Wrong descriptor.");
    return MetricsUtils.jsd(((JointHistogram) feature).descriptor, descriptor);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:6,代码来源:JointHistogram.java

示例10: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
    if (!(feature instanceof MSERFeature)) return -1;
    return (float) MetricsUtils.distL2(descriptor, ((MSERFeature) feature).descriptor);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:5,代码来源:MSERFeature.java

示例11: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
@Override
public float getDistance(LireFeature feature) {
    // it is assumed that the histograms are of equal length.
    assert(feature.getDoubleHistogram().length == data.length);
    return (float) MetricsUtils.distL1(feature.getDoubleHistogram(), data);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:7,代码来源:GenericDoubleLireFeature.java

示例12: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
    if (!(feature instanceof SurfFeature)) return -1;
    return (float) MetricsUtils.distL2(descriptor, ((SurfFeature) feature).descriptor);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:5,代码来源:SurfFeature.java

示例13: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
    if (!(feature instanceof OpponentHistogram))
        throw new UnsupportedOperationException("Wrong descriptor.");
    return (float) MetricsUtils.jsd(((OpponentHistogram) feature).histogram, histogram);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:6,代码来源:OpponentHistogram.java

示例14: getDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float getDistance(LireFeature feature) {
    if (!(feature instanceof FuzzyOpponentHistogram))
        throw new UnsupportedOperationException("Wrong descriptor.");
    return (float) MetricsUtils.jsd(((FuzzyOpponentHistogram) feature).descriptor, descriptor);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:6,代码来源:FuzzyOpponentHistogram.java

示例15: descriptorDistance

import net.semanticmetadata.lire.utils.MetricsUtils; //导入依赖的package包/类
public float descriptorDistance(Feature f) {
    if (!(f instanceof Feature)) return -1;
    return (float) MetricsUtils.distL2(descriptor, ((Feature) f).descriptor);
}
 
开发者ID:fish2000,项目名称:lire,代码行数:5,代码来源:Feature.java


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