Java Code Examples for it.unimi.dsi.fastutil.doubles.DoubleList#getDouble()
The following examples show how to use
it.unimi.dsi.fastutil.doubles.DoubleList#getDouble() .
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: MetricUtilities.java From samantha with MIT License | 5 votes |
static public MetricResult getTopNResults(String metricName, List<Integer> N, Double threshold, double minValue, DoubleList metrics, int cnt) { List<ObjectNode> results = new ArrayList<>(N.size()); boolean pass = true; for (int i=0; i<N.size(); i++) { ObjectNode result = Json.newObject(); result.put(ConfigKey.EVALUATOR_METRIC_NAME.get(), metricName); ObjectNode metricPara = Json.newObject(); if (threshold != null) { metricPara.put("threshold", threshold); } metricPara.put("minValue", minValue); metricPara.put("N", N.get(i)); result.set(ConfigKey.EVALUATOR_METRIC_PARA.get(), metricPara); double value = 0.0; if (cnt > 0) { value = metrics.getDouble(i) / cnt; } result.put(ConfigKey.EVALUATOR_METRIC_VALUE.get(), value); result.put(ConfigKey.EVALUATOR_METRIC_SUPPORT.get(), cnt); results.add(result); if (value < minValue) { pass = false; } } return new MetricResult(results, pass); }
Example 2
Source File: GradientBoostingMachine.java From samantha with MIT License | 5 votes |
public double evaluate(DoubleList preds, PredictiveModel boostModel, LearningData validData, IntList subset) { double objVal = 0.0; int idx = 0; validData.startNewIteration(); List<LearningInstance> instances; while ((instances = validData.getLearningInstance()).size() > 0) { List<StochasticOracle> oracles = new ArrayList<>(instances.size()); for (LearningInstance ins : instances) { double modelOutput = 0.0; if (preds != null) { int subidx = idx; if (subset != null) { subidx = subset.getInt(idx); } modelOutput += (preds.getDouble(subidx)); idx++; } modelOutput += boostModel.predict(ins)[0]; oracles.add(new StochasticOracle(modelOutput, ins.getLabel(), ins.getWeight())); } oracles = objectiveFunction.wrapOracle(oracles); for (StochasticOracle oracle : oracles) { objVal += oracle.getObjectiveValue(); } } return objVal; }
Example 3
Source File: KdbHistoricalDao.java From FX-AlgorithmTrading with MIT License | 5 votes |
/** * クエリの結果を MarketDataList に変換します * ※Symbolが1つの場合のみ * * @param table * @return */ private MarketDataList convertToMarketDataList(QTable table) { int size = table.getRowsCount(); Object[] data = table.getData(); // col0: QDateTime QDateTime[] qDateTimes = (QDateTime[]) data[0]; List<LocalDateTime> dateTimeList = new ArrayList<>(size); for (QDateTime qDateTime : qDateTimes) { dateTimeList.add(KdbUtility.convertToLocalDateTime(qDateTime)); } // col1: sym String ccypair = ((String[]) data[1])[0]; Symbol symbol = Symbol.valueOf(ccypair); // col2: bid DoubleList bidList = new DoubleArrayList((double[]) data[2]); // col3: ask DoubleList askList = new DoubleArrayList((double[]) data[3]); // mid double[] midArray = new double[size]; for (int i = 0; i < size; i++) { midArray[i] = (bidList.getDouble(i) + askList.getDouble(i)) / 2; } DoubleList midList = new DoubleArrayList(midArray); // create MarketDataList MarketDataList marketDataList = new MarketDataList(symbol, dateTimeList, bidList, askList, midList); return marketDataList; }
Example 4
Source File: PercentileTDigestQueriesTest.java From incubator-pinot with Apache License 2.0 | 5 votes |
private void assertTDigest(TDigest tDigest, DoubleList doubleList) { for (int percentile = 0; percentile <= 100; percentile++) { double expected; if (percentile == 100) { expected = doubleList.getDouble(doubleList.size() - 1); } else { expected = doubleList.getDouble(doubleList.size() * percentile / 100); } Assert.assertEquals(tDigest.quantile(percentile / 100.0), expected, DELTA, ERROR_MESSAGE); } }
Example 5
Source File: PLMMAlgorithm.java From AILibs with GNU Affero General Public License v3.0 | 4 votes |
private double getSkillOfRankedObject(final ShortList ranking, final int indexOfObjectInRanking, final DoubleList skillVector) { return skillVector.getDouble(ranking.getShort(indexOfObjectInRanking)); }
Example 6
Source File: SynchronizedVariableSpace.java From samantha with MIT License | 4 votes |
private void setDoubleList(double[] newVar, DoubleList var) { int size = var.size(); for (int i=0; i<size; i++) { newVar[i] = var.getDouble(i); } }