/** * Replace the values in the list starting at <tt>offset</tt> with * the contents of the <tt>values</tt> array. * * @param offset the first offset to replace * @param values the source of the new values */ public void set(int offset, double[] values) { set(offset, values, 0, values.length); }
public ClassificationResult classify(IIndex testIndex, int docID) { ClassificationResult res = new ClassificationResult(); res.documentID = docID; TreeSet<SingleClassificationResult> leafResults = new TreeSet<TreeRecommenderClassifier.SingleClassificationResult>(); hierarchicallyClassification(Short.MIN_VALUE, testIndex, docID, 1, leafResults); int filled = 0; int numAutomaticallyAssigned = 0; SingleClassificationResult crBest = leafResults.last(); while (filled < atLeastResults && leafResults.size() > 0) { SingleClassificationResult cr = leafResults.last(); leafResults.remove(leafResults.last()); res.categoryID.add(cr.catID); res.score.add(cr.score); if (cr.score >= cr.range.border) { numAutomaticallyAssigned++; } filled++; } if (atLeastOne && numAutomaticallyAssigned == 0) { // Force at least one category. res.score.set(0, crBest.range.border + 0.1); } return res; }
protected final boolean setYForIdx(final int _idx, final double _y) { if ((getY(_idx) != _y) && (isValuesValid(getX(_idx), _y))) { val_.set(_idx, _y); return true; } return false; }
public void computeDistances(IWeighting3D dists, ISimilarityFunction func) { for (int i = 0; i < documents.size(); i++) { int docID = documents.get(i); double d = func.computeSimilarity(features, dists, docID); distances.set(i, d); } }
public ClassificationResult computeScore(KnnCommitteeClassifier cl, Vector<ClassificationResult> results, IIndex testIndex, int docID) { if (results.size() != _matrixes.size()) throw new RuntimeException("The number of matrixes and classifiers must be the same"); ClassificationResult cr = new ClassificationResult(); cr.documentID = docID; for (int i = 0; i < results.get(0).categoryID.size(); i++) { cr.categoryID.add(results.get(0).categoryID.get(i)); cr.score.add(0); } for (int i = 0; i < results.size(); i++) { ClassificationResult res = results.get(i); for (int j = 0; j < res.score.size(); j++) { double val = cr.score.get(j) + (res.score.get(j) * _matrixes.get(i).getWeight(res.categoryID.get(j), docID, 0)); res.score.set(j, val); } } return cr; }
val = 1; double score = cr.score.get(j) + (cust.getEfficacy(catID) * val / mapNomalization.get(catID)); cr.score.set(j, score);
cr.score.set(j, cr.score.get(j) + val);
cr.score.set(j, score);
/** * Le x est ajoute et l'ordre des x est conserve. * * @param _x le x ajouter * @param _y le y correspondant */ void put(final double _x, final double _y) { if (t_.size() == 0) { t_.add(_x); val_.add(_y); } else { int k = t_.binarySearch(_x); if (k < 0) { k = -k; if (k > t_.size()) { t_.add(_x); val_.add(_y); } else { t_.insert(k - 1, _x); val_.insert(k - 1, _y); } } else { val_.set(k, _y); } } }