Package types

Examples of types.SparseVector.numEntries()


    double correctUpdate = Math.exp(-alpha);
    for (int instInd = 0; instInd < trainingData.size(); instInd++) {
      ClassificationInstance inst = trainingData.get(instInd);
      for (int y = 0; y < yAlphabet.size(); y++) {
        SparseVector fv = fxy.apply(inst.x, y);
        for (int i = 0; i < fv.numEntries(); i++) {
          if (fv.getIndexAt(i) == bestFeature) {
            if (y == inst.y)
              w[instInd] *= correctUpdate;
            else
              w[instInd] *= wrongUpdate;
View Full Code Here


      ClassificationInstance inst = trainingData.get(instInd);
      total += w[instInd];
      for (int y = 0; y < yAlphabet.size(); y++) {
        SparseVector fv = fxy.apply(inst.x, y);
        if (y == inst.y) {
          for (int i = 0; i < fv.numEntries(); i++) {
            correct[fv.getIndexAt(i)] += w[instInd];
          }
        } else {
          for (int i = 0; i < fv.numEntries(); i++) {
            wrongs[fv.getIndexAt(i)] += w[instInd];
View Full Code Here

        if (y == inst.y) {
          for (int i = 0; i < fv.numEntries(); i++) {
            correct[fv.getIndexAt(i)] += w[instInd];
          }
        } else {
          for (int i = 0; i < fv.numEntries(); i++) {
            wrongs[fv.getIndexAt(i)] += w[instInd];
          }
        }
      }
    }
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.