use of cern.colt.list.DoubleArrayList in project tdq-studio-se by Talend.
the class QuantileBin1D method splitApproximately.
/**
*Divides (rebins) a copy of the receiver at the given <i>interval boundaries</i> into bins and returns these bins, such that each bin <i>approximately</i> reflects the data elements of its range.
*
*For each interval boundary of the axis (including -infinity and +infinity), computes the percentage (quantile inverse) of elements less than the boundary.
*Then lets {@link #splitApproximately(DoubleArrayList,int)} do the real work.
*
*@param axis an axis defining interval boundaries.
*@param resolution a measure of accuracy; the desired number of subintervals per interval.
*/
public synchronized MightyStaticBin1D[] splitApproximately(hep.aida.IAxis axis, int k) {
DoubleArrayList percentages = new DoubleArrayList(new hep.aida.ref.Converter().edges(axis));
percentages.beforeInsert(0, Double.NEGATIVE_INFINITY);
percentages.add(Double.POSITIVE_INFINITY);
for (int i = percentages.size(); --i >= 0; ) {
percentages.set(i, quantileInverse(percentages.get(i)));
}
return splitApproximately(percentages, k);
}
use of cern.colt.list.DoubleArrayList in project tetrad by cmu-phil.
the class StatUtils method expScore.
public static double expScore(double[] _f) {
// _f = DataUtils.standardizeData(_f);
DoubleArrayList f = new DoubleArrayList(_f);
for (int k = 0; k < _f.length; k++) {
f.set(k, Math.exp(f.get(k)));
}
double expected = Descriptive.mean(f);
return Math.log(expected);
// double diff = logExpected - 0.5;
// return Math.abs(diff);
}
use of cern.colt.list.DoubleArrayList in project tetrad by cmu-phil.
the class StatUtils method logCoshScore.
public static double logCoshScore(double[] _f) {
_f = standardizeData(_f);
DoubleArrayList f = new DoubleArrayList(_f);
for (int k = 0; k < _f.length; k++) {
double v = Math.log(Math.cosh((f.get(k))));
f.set(k, v);
}
double expected = Descriptive.mean(f);
double diff = expected - logCoshExp;
return diff * diff;
}
use of cern.colt.list.DoubleArrayList in project tetrad by cmu-phil.
the class TestMeasurementSimulator method testChipToChipError.
/**
* Turn on chip to chip error, turn off all other sources of error, simulate
* 1 dish of data with 1000 samples per dish and look to see whether in the
* aggregated data the standard deviations for Gene2:t1, Gene3:t1, and
* Gene1:t2 are 0.3.
*/
public void testChipToChipError() {
setDefaultParameters();
// The following parameters are set to non-default values for
// this test.
this.simulator.setDishDishVariability(0.0001);
this.simulator.setNumSamplesPerDish(1000);
this.simulator.setSampleSampleVariability(0.0001);
this.simulator.setChipChipVariability(0.3);
this.simulator.setPixelDigitalization(0.0001);
this.simulator.setStepsGenerated(2);
this.simulator.setNumCellsPerDish(100);
// Simulate the data.
this.simulator.simulate(this.history);
double[][][] measuredData = this.simulator.getMeasuredData();
// Do the test.
DoubleArrayList doubleArrayList = new DoubleArrayList(measuredData[1][0]);
double sum = Descriptive.sum(doubleArrayList);
double sumOfSquares = Descriptive.sumOfSquares(doubleArrayList);
double gene2time1sd = Descriptive.standardDeviation(Descriptive.variance(measuredData[1][0].length, sum, sumOfSquares));
DoubleArrayList doubleArrayList1 = new DoubleArrayList(measuredData[2][0]);
double sum1 = Descriptive.sum(doubleArrayList1);
double sumOfSquares1 = Descriptive.sumOfSquares(doubleArrayList1);
double gene3time1sd = Descriptive.standardDeviation(Descriptive.variance(measuredData[2][0].length, sum1, sumOfSquares1));
DoubleArrayList doubleArrayList2 = new DoubleArrayList(measuredData[1][1]);
double sum2 = Descriptive.sum(doubleArrayList2);
double sumOfSquares2 = Descriptive.sumOfSquares(doubleArrayList2);
double gene1time2sd = Descriptive.standardDeviation(Descriptive.variance(measuredData[1][1].length, sum2, sumOfSquares2));
assertEquals(0.3, gene2time1sd, 0.02);
assertEquals(0.3, gene3time1sd, 0.02);
assertEquals(0.3, gene1time2sd, 0.02);
}
use of cern.colt.list.DoubleArrayList in project tetrad by cmu-phil.
the class TestMeasurementSimulator method testTranscriptionError.
/**
* Save out the raw data using default parameters and make sure that
* Gene1:t2 has the specified standard deviation. Should be 0.05. (Gene1 has
* only itself as parent.)
*/
public void testTranscriptionError() {
// Raw data is saved for this simulation.
setDefaultParameters();
this.simulator.setRawDataSaved(true);
this.simulator.setMeasuredDataSaved(false);
// Simulate the data.
this.simulator.simulate(this.history);
double[][][] rawData = this.simulator.getRawData();
// (Test the dimensions.)
// # variables.
assertEquals(3, rawData.length);
// # time steps.
assertEquals(4, rawData[0].length);
// # cells / dish
assertEquals(10000, rawData[0][0].length);
// The test is to see whether Gene 1 at time step 2 has a
// standard deviation of 0.05. Of course the gene and time
// step numbers need to be 0-indexed.
DoubleArrayList doubleArrayList = new DoubleArrayList(rawData[0][1]);
double sum = Descriptive.sum(doubleArrayList);
double sumOfSquares = Descriptive.sumOfSquares(doubleArrayList);
double stdev = Descriptive.standardDeviation(Descriptive.variance(rawData[0][1].length, sum, sumOfSquares));
assertEquals(0.05, stdev, 0.01);
}
Aggregations