Package cc.mallet.types

Examples of cc.mallet.types.LabelVector.numLocations()


   * @return An array containing a score for each of the elements of <code>neighbors</code>.
   */
  public double[] evaluate (Neighbor[] neighbors) {
    double[] scores = new double[neighbors.length];
    LabelVector ranks = classifier.classify(neighbors).getLabelVector();
    for (int i = 0; i < ranks.numLocations(); i++) {
      int idx = ((Integer)ranks.getLabelAtRank(i).getEntry()).intValue();
      scores[idx] = ranks.getValueAtRank(i);
    }
    return scores;
  }
View Full Code Here


  {
    Classification c = underlyingClassifier.classify (instance);
    Classification cpc = confidencePredictingClassifier.classify (c);
    LabelVector lv = c.getLabelVector();
    int bestIndex = lv.getBestIndex();
    double [] values = new double[lv.numLocations()];
    //// Put score of "correct" into score of the winning class...
    // xxx Can't set lv - it's immutable.
    //     Must create copy and new classification object
    // lv.set (bestIndex, cpc.getLabelVector().value("correct"));
    //for (int i = 0; i < lv.numLocations(); i++)
View Full Code Here

    //  if (i != bestIndex)
    //    lv.set (i, 0.0);

    // Put score of "correct" in winning class and
    // set rest to 0
    for (int i = 0; i < lv.numLocations(); i++) {
      if (i != bestIndex)
        values[i] = 0.0;
      else values[i] = cpc.getLabelVector().value("correct");
    }
    //return c;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.