Package cc.mallet.types

Examples of cc.mallet.types.LabelVector


    for (int i=0; i < scores.length; i++) {
      int index = labelAlphabet.lookupIndex(String.valueOf(i), true);
      allScores[index] = scores[i];
    }
    return new LabelVector(labelAlphabet, allScores);
  }
View Full Code Here


        int numClasses = getLabelAlphabet().size();
        double[] scores = new double[numClasses];
        getClassificationScores (instance, scores);
        // Create and return a Classification object
        return new Classification (instance, this,
                new LabelVector (getLabelAlphabet(),
                        scores));
    }
View Full Code Here

 
  @Override
  public Classification classify(Instance instance) {
    double[] scores = new double[numLabels];
    getClassificationScores(instance,scores);
    return new Classification (instance, this, new LabelVector (getLabelAlphabet(), scores));
  }
View Full Code Here

      sum += m_weights[ci][numFeats];
        }
        MatrixOps.timesEquals(scores, 1.0 / sum);

        // Create and return a Classification object
        return new Classification (instance, this, new LabelVector (getLabelAlphabet(), scores));
    }
View Full Code Here

      System.out.print (labeling.labelAtLocation(i).toString()+"="+labeling.valueAtLocation(i)+" ");
    System.out.println ("]");*/   
    pw.print(classifier.getClass().getName());
    pw.print(" ");
    pw.print(instance.getSource() + " ");
    LabelVector lv = labeling.toLabelVector();
    lv.printByRank(pw);
    pw.println ();
  }
View Full Code Here

      }
    if (outputAlphabet != null) {
      labelings = new LabelVector[latticeLength];
      for (int ip = latticeLength-2; ip >= 0; ip--) {
        assert (Math.abs(1.0-MatrixOps.sum (outputCounts[ip])) < 0.000001);;
        labelings[ip] = new LabelVector (outputAlphabet, outputCounts[ip]);
      }
    }
   
    if (logger.isLoggable (Level.FINE)) {
      logger.fine("Lattice:");
View Full Code Here

      }
    if (outputAlphabet != null) {
      labelings = new LabelVector[latticeLength];
      for (int ip = latticeLength-2; ip >= 0; ip--) {
        assert (Math.abs(1.0-MatrixOps.sum (outputCounts[ip])) < 0.000001);;
        labelings[ip] = new LabelVector (outputAlphabet, outputCounts[ip]);
      }
    }

  }
View Full Code Here

      }
    if (outputAlphabet != null) {
      labelings = new LabelVector[latticeLength];
      for (int ip = latticeLength-2; ip >= 0; ip--) {
        assert (Math.abs(1.0-MatrixOps.sum (outputCounts[ip])) < 0.000001);;
        labelings[ip] = new LabelVector (outputAlphabet, outputCounts[ip]);
      }
    }
  }
View Full Code Here

        int prevLabelIndex = 0;          // This will put extra error instances in this cluster
        for (int j = 0; j < trueOutput.size(); j++) {
          Label label = (Label) ((LabelSequence)trueOutput).getLabelAtPosition(j);
          assert (label != null);
          //System.out.println ("Instance="+i+" position="+j+" fv="+lattice.getLabelingAtPosition(j).toString(true));
          LabelVector latticeLabeling = lattice.getLabelingAtPosition(j);
          double trueLabelProb = latticeLabeling.value(label.getIndex());
          int labelIndex = latticeLabeling.getBestIndex();
          //System.out.println ("position="+j+" trueLabelProb="+trueLabelProb);
          if (trueLabelProb < trueLabelProbThreshold) {
            logger.info ("Adding error: instance="+i+" position="+j+" prtrue="+trueLabelProb+
                (label == latticeLabeling.getBestLabel() ? "  " : " *")+
                " truelabel="+label+
                " predlabel="+latticeLabeling.getBestLabel()+
                " fv="+((FeatureVector)input.get(j)).toString(true));
            errorInstances.add (input.get(j), label, null, null);
            errorLabelVectors.add (latticeLabeling);
            clusteredErrorInstances[prevLabelIndex][labelIndex].add (input.get(j), label, null, null);
            clusteredErrorLabelVectors[prevLabelIndex][labelIndex].add (latticeLabeling);
View Full Code Here

      }
    if (outputAlphabet != null) {
      labelings = new LabelVector[latticeLength];
      for (int ip = latticeLength-2; ip >= 0; ip--) {
        assert (Math.abs(1.0-MatrixOps.sum (outputCounts[ip])) < 0.000001);;
        labelings[ip] = new LabelVector (outputAlphabet, outputCounts[ip]);
      }
    }
   
    if (logger.isLoggable (Level.FINE)) {
      logger.fine("Lattice:");
View Full Code Here

TOP

Related Classes of cc.mallet.types.LabelVector

Copyright © 2018 www.massapicom. 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.