com.carrotsearch.hppc.IntFloatHashMap Java Examples
The following examples show how to use
com.carrotsearch.hppc.IntFloatHashMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlfrescoReRankQParserPlugin.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
public BoostedComp(IntIntHashMap boostedDocs, ScoreDoc[] scoreDocs, float maxScore) { this.boostedMap = new IntFloatHashMap(boostedDocs.size()*2); for(int i=0; i<scoreDocs.length; i++) { if(boostedDocs.containsKey(scoreDocs[i].doc)) { boostedMap.put(scoreDocs[i].doc, maxScore+boostedDocs.get(scoreDocs[i].doc)); } else { break; } } }
Example #2
Source File: ReRankCollector.java From lucene-solr with Apache License 2.0 | 5 votes |
public BoostedComp(IntIntHashMap boostedDocs, ScoreDoc[] scoreDocs, float maxScore) { this.boostedMap = new IntFloatHashMap(boostedDocs.size()*2); for(int i=0; i<scoreDocs.length; i++) { final int idx; if((idx = boostedDocs.indexOf(scoreDocs[i].doc)) >= 0) { boostedMap.put(scoreDocs[i].doc, maxScore+boostedDocs.indexGet(idx)); } else { break; } } }
Example #3
Source File: IntFloatDynamicMap.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Create map with expected max value of key. * Although the map will automatically do resizing to be able to hold key {@code >= expectedKeyMax}. * But putting key much larger than {@code expectedKeyMax} is discourage since it can leads to use LOT OF memory. */ public IntFloatDynamicMap(int expectedKeyMax, float emptyValue) { this.threshold = threshold(expectedKeyMax); this.maxSize = expectedKeyMax; this.emptyValue = emptyValue; if (useArrayBased(expectedKeyMax)) { upgradeToArray(); } else { this.hashMap = new IntFloatHashMap(mapExpectedElements(expectedKeyMax)); } }
Example #4
Source File: BOSSVSClassifier.java From SFA with GNU General Public License v3.0 | 5 votes |
@Override public Score fit(final TimeSeries[] trainSamples) { // generate test train/split for cross-validation generateIndices(trainSamples); Score bestScore = null; int bestCorrectTraining = 0; int minWindowLength = 10; int maxWindowLength = getMax(trainSamples, MAX_WINDOW_LENGTH); // equi-distance sampling of windows ArrayList<Integer> windows = new ArrayList<>(); double count = Math.sqrt(maxWindowLength); double distance = ((maxWindowLength - minWindowLength) / count); for (int c = minWindowLength; c <= maxWindowLength; c += distance) { windows.add(c); } for (boolean normMean : NORMALIZATION) { // train the shotgun models for different window lengths Ensemble<BossVSModel<IntFloatHashMap>> model = fitEnsemble( windows.toArray(new Integer[]{}), normMean, trainSamples); Double[] labels = predict(model, trainSamples); Predictions pred = evalLabels(trainSamples, labels); if (bestCorrectTraining <= pred.correct.get()) { bestCorrectTraining = pred.correct.get(); bestScore = model.getHighestScoringModel().score; bestScore.training = pred.correct.get(); this.model = model; } } // return score return bestScore; }
Example #5
Source File: BOSSVS.java From SFA with GNU General Public License v3.0 | 5 votes |
protected void initMatrix( final ObjectObjectHashMap<Double, IntFloatHashMap> matrix, final Set<Double> uniqueLabels, final BagOfPattern[] bag) { for (Double label : uniqueLabels) { IntFloatHashMap stat = matrix.get(label); if (stat == null) { matrix.put(label, new IntFloatHashMap(bag[0].bag.size() * bag.length)); } else { stat.clear(); } } }
Example #6
Source File: BOSSVS.java From SFA with GNU General Public License v3.0 | 4 votes |
public ObjectObjectHashMap<Double, IntFloatHashMap> createTfIdf( final BagOfPattern[] bagOfPatterns, final Set<Double> uniqueLabels) { int[] sampleIndices = createIndices(bagOfPatterns.length); return createTfIdf(bagOfPatterns, sampleIndices, uniqueLabels); }