@Test public void test95PercentileNan3() throws Exception { DataProcessor dp = getDp3(new Variable.PERCENTILENAN(95)); // rrdtools says 9.574000000000000e+03 Assert.assertEquals( "Wrong percentile", 9.574000000000000e+03, dp.getVariable("value").value, 1e-6); }
// A range that includes NaN private DataProcessor getDp3(Variable v) throws IOException { DataProcessor dp = new DataProcessor(startTime - 10 * step, endTime + 2 * step); dp.addDatasource("baz", fileName, "bar", ConsolFun.AVERAGE, backend); dp.addDatasource("value", "baz", v); dp.processData(); return dp; }
@Test public void testStdDev2() throws Exception { DataProcessor dp = getDp2(new Variable.STDDEV()); // rrdtools says 1.040348817767271e+03, but it might be wrong Assert.assertEquals( "Wrong standard deviation", 1048.0838597160848, dp.getVariable("value").value, 1e-6); }
public static void loadPathways(boolean fullLoad) { if (processor_ == null) { System.out.println("null"); processor_ = new DataProcessor(project_); } if (Project.dataChanged) { System.out.println("Data changed"); if (DataProcessor.newBaseData) { System.out.println("newBaseData"); if (processor_ == null) { processor_ = new DataProcessor(project_); } else { processor_.prepData(); } } if (!fullLoad) { return; } processor_.reduce = Project.randMode_; if (!Project.imported) { project_.refreshProj(); } processor_.processProject(); dataChanged = false; Project.dataChanged = false; } else { return; } }
@Test public void testMax3() throws Exception { DataProcessor dp = getDp3(new Variable.MAX()); // rrdtools says 1.600000000000000e+07 Assert.assertEquals( "Wrong maximum", 1.600000000000000e+07, dp.getVariable("value").value, 1e-6); }
@Test public void testMax2() throws Exception { DataProcessor dp = getDp2(new Variable.MAX()); // rrdtools says 7.009000000000000e+03 Assert.assertEquals( "Wrong maximum", 7.009000000000000e+03, dp.getVariable("value").value, 1e-6); }
/* * (non-Javadoc) * * @see * edu.cmu.sphinx.frontend.DataProcessor#initialize(edu.cmu.sphinx.frontend * .CommonConfig) */ @Override public void initialize() { super.initialize(); for (DataProcessor dataProcessor : selectedDataProcessors) { dataProcessor.initialize(); } }
@Test public void testMin3() throws Exception { DataProcessor dp = getDp3(new Variable.MIN()); // rrdtools says 0.000000000000000e+00 Assert.assertEquals( "Wrong minimum", 0.000000000000000e+00, dp.getVariable("value").value, 1e-6); }
@Test public void testAverage3() throws Exception { DataProcessor dp = getDp3(new Variable.AVERAGE()); // rrdtools says 3.295591240875912e+03 Assert.assertEquals( "Wrong average", 1.633122227722772e+05, dp.getVariable("value").value, 1e-6); }
@Test public void testLslInt2() throws Exception { DataProcessor dp = getDp2(new Variable.LSLINT()); // rrdtools says 3.322001278772379e+03 Assert.assertEquals( "Wrong LSL y-intercept", 3.322001278772379e+03, dp.getVariable("value").value, 1e-6); }
@Test public void testLslSlope() throws Exception { DataProcessor dp = getDp(new Variable.LSLSLOPE()); // rrdtools says 4.823830423328765e+03 Assert.assertEquals( "Wrong LSL slope", 4.823830423328765e+03, dp.getVariable("value").value, 1e-6); }
@Test public void testLslSlope3() throws Exception { DataProcessor dp = getDp3(new Variable.LSLSLOPE()); // rrdtools says 4.684118512689442e+03 Assert.assertEquals( "Wrong LSL slope", 4.684118512689442e+03, dp.getVariable("value").value, 1e-6); }
@Test public void testLslInt() throws Exception { DataProcessor dp = getDp(new Variable.LSLINT()); // rrdtools says -3.117851918090452e+05 Assert.assertEquals( "Wrong LSL y-intercept", -3.117851918090452e+05, dp.getVariable("value").value, 1e-6); }
@Test public void testlslCorrel() throws Exception { DataProcessor dp = getDp(new Variable.LSLCORREL()); // rrdtools says 2.132982e-01 Assert.assertEquals( "Wrong LSL Correlation Coefficient", 2.132982e-01, dp.getVariable("value").value, 1e-6); }
@Test public void testLslSlope2() throws Exception { DataProcessor dp = getDp2(new Variable.LSLSLOPE()); // rrdtools says 5.289899606825209e+01 Assert.assertEquals( "Wrong LSL slope", 5.289899606825209e+01, dp.getVariable("value").value, 1e-6); }
@Test public void testStdDev() throws Exception { DataProcessor dp = getDp(new Variable.STDDEV()); // rrdtools says 1.299157546152125e+06, but it might be wrong Assert.assertEquals( "Wrong standard deviation", 1302434.1151546114, dp.getVariable("value").value, 1e-6); }
@Test public void testStdDev3() throws Exception { DataProcessor dp = getDp3(new Variable.STDDEV()); // rrdtools says 1.289630121109904e+06, but it might be wrong Assert.assertEquals( "Wrong standard deviation", 1292834.1760384508, dp.getVariable("value").value, 1e-6); }
@Test public void testLslInt3() throws Exception { DataProcessor dp = getDp3(new Variable.LSLINT()); // rrdtools says -3.121258062657012e+05 Assert.assertEquals( "Wrong LSL y-intercept", -3.402305173418378e+05, dp.getVariable("value").value, 1e-6); }
@Test public void testAverage2() throws Exception { DataProcessor dp = getDp2(new Variable.AVERAGE()); // rrdtools says 5.094117647058823e+03 Assert.assertEquals( "Wrong average", 5.094117647058823e+03, dp.getVariable("value").value, 1e-6); }
// A range that does not fit steps private DataProcessor getDp2(Variable v) throws IOException { long interval = (endTime - startTime) / 3; DataProcessor dp = new DataProcessor(startTime + interval, endTime - interval); dp.addDatasource("baz", fileName, "bar", ConsolFun.AVERAGE, backend); dp.addDatasource("value", "baz", v); dp.processData(); return dp; }
/** * Data process. * * @param positive the positive * @param negative the negative * @return the vector signature[][] * @throws ClassifierException the classifier exception */ protected DefaultVectorSignature[][] dataProcess( DefaultVectorSignature[] positive, DefaultVectorSignature[] negative) throws ClassifierException { log("Launching DataProcessor for learn data"); DefaultVectorSignature[][] data = new DefaultVectorSignature[2][]; try { dataProcessor.estimateParameters(positive, negative); data[0] = dataProcessor.apply(positive); data[1] = dataProcessor.apply(negative); learnDataProcessed = true; } catch (SignatureException e) { throw new ClassifierException(e); } return data; }
/** * Score. * * @param sig the sig * @return the double * @throws ClassifierException the classifier exception */ public double score(DefaultVectorSignature sig) throws ClassifierException { if (hasDataProcessor()) { try { return scoreImpl(dataProcessor.apply(sig)); } catch (SignatureException e) { throw new ClassifierException(e); } } else { return scoreImpl(sig); } }
RpnCalculator(String rpnExpression, String sourceName, DataProcessor dataProcessor) throws RrdException { this.rpnExpression = rpnExpression; this.sourceName = sourceName; this.dataProcessor = dataProcessor; this.timestamps = dataProcessor.getTimestamps(); this.timeStep = this.timestamps[1] - this.timestamps[0]; this.calculatedValues = new double[this.timestamps.length]; StringTokenizer st = new StringTokenizer(rpnExpression, ", "); tokens = new Token[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { tokens[i] = createToken(st.nextToken()); } }
public BufferedImage showPathwayMap(Sample sample, PathwayWithEc path) { return processor_.alterPathway(sample, path); }
@Test public void testFirst3() throws Exception { DataProcessor dp = getDp3(new Variable.FIRST()); // rrdtools says 0.000000000000000e+00 Assert.assertEquals("Wrong first", 0.000000000000000e+00, dp.getVariable("value").value, 1e-6); }
public void writeScore(Sample sample, String saveAs, int mode) { processor_.setWorkPath(Project.workpath_); processor_.writeScore(sample, saveAs, mode); }
@Test public void testTotal2() throws Exception { DataProcessor dp = getDp2(new Variable.TOTAL()); // rrdtools says 1.039200000000000e+08 Assert.assertEquals("Wrong total", 1.039200000000000e+08, dp.getVariable("value").value, 1e-6); }
@Test public void testTotal3() throws Exception { DataProcessor dp = getDp3(new Variable.TOTAL()); // rrdtools says 9.896720700000000e+09 Assert.assertEquals("Wrong total", 9.896720700000000e+09, dp.getVariable("value").value, 1e-6); }
@Test public void testAverage() throws Exception { DataProcessor dp = getDp(new Variable.AVERAGE()); // rrdtools says 1.657740201e+05 Assert.assertEquals("Wrong average", 1.657740201e+05, dp.getVariable("value").value, 1e-6); }
@Test public void testLast() throws Exception { DataProcessor dp = getDp(new Variable.LAST()); // rrdtools says 1.600000e+07 Assert.assertEquals("Wrong last", 1.600000e+07, dp.getVariable("value").value, 1e-6); }