@Override public void constructWithPayload(Stream<Tuple<DoubleVector, VALUE>> pairs) { pairs.forEach((v) -> add(v.getFirst(), v.getSecond())); }
@Override public CostGradientTuple call() throws Exception { return evaluateBatch(parameters, featureOutcome.getFirst(), featureOutcome.getSecond()); } }
/** * Constructs the similarity aggregation by seed tokens to expand and a given * bipartite graph. The bipartite graph is represented as a three tuple, which * consists of the vertices (called (candidate-) terms or entities) on the * first item, the context vertices on the second item and the edges between * those is a NxM matrix, where n is the entity tokens count and m is the * number of the context vertices. Alpha is the constant weighting factor used * throughout the paper (usually 0.5). The distance measurer to be used must * be also defined. */ public IterativeSimilarityAggregation(String[] seedTokens, Tuple<String[], DoubleMatrix> bipartiteGraph, double alpha, DistanceMeasurer distance) { this.seedTokens = seedTokens; this.termNodes = bipartiteGraph.getFirst(); // make sure we transpose to have a better distance lookup this.weightMatrix = bipartiteGraph.getSecond().transpose(); this.alpha = alpha; this.similarityMeasurer = new SimilarityMeasurer(distance); init(); }
.getFirst().getDimension()); observe(first.getFirst(), first.getSecond(), numDistinctClasses, tokenPerClass, numDocumentsPerClass); int numDocumentsSeen = 1; while ((first = Iterables.consumeNext(featureIterator, outcomeIterator)) != null) { observe(first.getFirst(), first.getSecond(), numDistinctClasses, tokenPerClass, numDocumentsPerClass); numDocumentsSeen++;
node.children[cIndex] = build(filtered.getFirst(), filtered.getSecond(), newPossibleFeatures, level + 1); cIndex++; bestSplit.getNumericalSplitValue(), false); if (filterNumeric.getFirst().isEmpty() || filterNumericHigher.getFirst().isEmpty()) { newPossibleFeatures.remove(bestSplitIndex); } else { AbstractTreeNode lower = build(filterNumeric.getFirst(), filterNumeric.getSecond(), new TIntHashSet(newPossibleFeatures), level + 1); AbstractTreeNode higher = build(filterNumericHigher.getFirst(), filterNumericHigher.getSecond(), new TIntHashSet(newPossibleFeatures), level + 1);