Package org.fnlp.ml.types.sv

Examples of org.fnlp.ml.types.sv.HashSparseVector.plus()


    Iterator i = insts.iterator();

    while (i.hasNext()) {
      Instance d = (Instance) i.next();

      centroid.plus((HashSparseVector) d.getData());
    }
    centroid.scaleDivide(insts.size());

    return centroid;
  }
View Full Code Here


            return;
        for (int n : classNum) {
            int count = classCount.get(n);
            classCount.set(n, count+1);
            HashSparseVector vectorcenter = classCenter.get(n);
            vectorcenter.plus(vector);
        }
    }

    private void normalClassCenter() {
        for (int i = 0; i < classOri.size(); i++) {
View Full Code Here

            ArrayList<HashSparseVector> vectorlist = trainData.get(s);
            if (vectorlist == null)
                continue;
            divide += vectorlist.size();
            for (HashSparseVector vector : vectorlist)
                hsvector.plus(vector);
        }
        hsvector.scaleDivide((float) divide);
        classCenter.add(hsvector);
        classCount.add(1);
    }
View Full Code Here

    private void updateCenter(int classid, HashSparseVector vector) {
        int count = classCount.get(classid);
        classCount.set(classid, count+1);
        HashSparseVector vectorcenter = classCenter.get(classid);
        updateBaseDist(classid, vector);
        vectorcenter.plus(vector);
//        vectorcenter.scaleDivide((float)count / (float)(count+1));
    }

    private void updateBaseDist(int classid, HashSparseVector vector) {
        float base = baseDistList.get(classid);
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.