本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.moment.StandardDeviation.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Java StandardDeviation.evaluate方法的具体用法?Java StandardDeviation.evaluate怎么用?Java StandardDeviation.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.stat.descriptive.moment.StandardDeviation
的用法示例。
在下文中一共展示了StandardDeviation.evaluate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computePopulationStandardDeviationOfBigDecimals
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public static BigDecimal computePopulationStandardDeviationOfBigDecimals(List<BigDecimal> numbers) {
if ((numbers == null) || numbers.isEmpty()) {
return null;
}
try {
double[] doublesArray = new double[numbers.size()];
for (int i = 0; i < doublesArray.length; i++) {
doublesArray[i] = numbers.get(i).doubleValue();
}
StandardDeviation standardDeviation = new StandardDeviation();
standardDeviation.setBiasCorrected(false);
BigDecimal standardDeviationResult = new BigDecimal(standardDeviation.evaluate(doublesArray));
return standardDeviationResult;
}
catch (Exception e) {
logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
return null;
}
}
示例2: computeStat
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public void computeStat(double duration, int maxUsers) {
double[] times = getDurationAsArray();
min = (long) StatUtils.min(times);
max = (long) StatUtils.max(times);
double sum = 0;
for (double d : times) sum += d;
avg = sum / times.length;
p50 = (long) StatUtils.percentile(times, 50.0);
p95 = (long) StatUtils.percentile(times, 95.0);
p99 = (long) StatUtils.percentile(times, 99.0);
StandardDeviation stdDev = new StandardDeviation();
stddev = (long) stdDev.evaluate(times, avg);
this.duration = duration;
this.maxUsers = maxUsers;
rps = (count - errorCount) / duration;
startDate = getDateFromInstant(start);
successCount = count - errorCount;
}
示例3: get_cv
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public Map<String, Double> get_cv(String[] group_var, String[] uniq_group){
Map<String, Double> group_to_cv_map = new TreeMap<String, Double>();
Map<String, ArrayList<Double> > grouped_y = new TreeMap<String, ArrayList<Double>>();
for (String aUniq_group : uniq_group){
grouped_y.put(aUniq_group, new ArrayList<Double>());
for (int i = 0; i < group_var.length; i++) {
if (group_var[i].equals(aUniq_group)){
grouped_y.get(aUniq_group).add(this.y_list.get(i));
}
}
}
StandardDeviation std_stat = new StandardDeviation(true);
Mean mean_stat = new Mean();
for(Iterator<Map.Entry<String, ArrayList<Double>>> it = grouped_y.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, ArrayList<Double>> entry = it.next();
double[] cur_y_arr = ArrayUtils.toPrimitive(entry.getValue().toArray(new Double[entry.getValue().size()]));
double std = std_stat.evaluate(cur_y_arr);
double mean = mean_stat.evaluate(cur_y_arr);
group_to_cv_map.put(entry.getKey(), std/mean);
}
this.cv = group_to_cv_map;
return group_to_cv_map;
}
示例4: evaluate
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
@Override
/**
* @return [0] Mean distance [1] SD distance
*/
public double[] evaluate() {
splinefit = new TrajectorySplineFit(t,nSegments);
splinefit.calculateSpline();
if(!splinefit.wasSuccessfull()){
return new double[] {Double.NaN,Double.NaN};
}
double[] data = new double[t.size()];
for(int i = 0; i < t.size(); i++){
Point2D.Double help = new Point2D.Double(splinefit.getRotatedTrajectory().get(i).x, splinefit.getRotatedTrajectory().get(i).y);
data[i] = help.distance(splinefit.minDistancePointSpline(new Point2D.Double(splinefit.getRotatedTrajectory().get(i).x, splinefit.getRotatedTrajectory().get(i).y), 50));
}
Mean m = new Mean();
StandardDeviation sd = new StandardDeviation();
result = new double[] {m.evaluate(data),sd.evaluate(data)};
return result;
}
示例5: getExpectedValue
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
@Override
public Number getExpectedValue(int start, int length)
{
if (length == 0) {
return null;
}
double[] values = new double[length];
for (int i = 0; i < length; i++) {
values[i] = start + i;
}
StandardDeviation stdDev = new StandardDeviation(false);
return stdDev.evaluate(values);
}
示例6: getExpectedValue
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
@Override
public Number getExpectedValue(int start, int length)
{
if (length < 2) {
return null;
}
double[] values = new double[length];
for (int i = 0; i < length; i++) {
values[i] = start + i;
}
StandardDeviation stdDev = new StandardDeviation();
return stdDev.evaluate(values);
}
示例7: calculateNthMoment
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public double calculateNthMoment(int n){
Array2DRowRealMatrix gyr = RadiusGyrationTensor2D.getRadiusOfGyrationTensor(t);
EigenDecomposition eigdec = new EigenDecomposition(gyr);
Vector2d eigv = new Vector2d(eigdec.getEigenvector(0).getEntry(0),eigdec.getEigenvector(0).getEntry(1));
double[] projected = new double[t.size()];
for(int i = 0; i < t.size(); i++){
Vector2d pos = new Vector2d(t.get(i).x,t.get(i).y);
double v = eigv.dot(pos);
projected[i] = v;
}
Mean m = new Mean();
StandardDeviation s = new StandardDeviation();
double mean = m.evaluate(projected);
double sd = s.evaluate(projected);
double sumPowN=0;
for(int i = 0; i < projected.length; i++){
sumPowN += Math.pow( (projected[i]-mean)/sd, n);
}
double nThMoment = sumPowN/projected.length;
return nThMoment;
}
示例8: evaluate
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
@Override
public double[] evaluate() {
StandardDeviation sd = new StandardDeviation();
double[] values = new double[t.size()-timelag-1];
double subx = 0;
double suby = 0;
double subz = 0;
for(int i = timelag+1; i < t.size(); i++){
subx = t.get(i-timelag-1).x;
suby = t.get(i-timelag-1).y;
subz = t.get(i-timelag-1).z;
Vector3d v1 = new Vector3d(t.get(i-timelag).x-subx,t.get(i-timelag).y-suby,t.get(i-timelag).z-subz);
subx = t.get(i-1).x;
suby = t.get(i-1).y;
subz = t.get(i-1).z;
Vector3d v2 = new Vector3d(t.get(i).x-subx,t.get(i).y-suby,t.get(i).z-subz);
double v = v1.angle(v2);
boolean v1IsZero = TrajectoryUtil.isZero(v1.x) && TrajectoryUtil.isZero(v1.y) && TrajectoryUtil.isZero(v1.z);
boolean v2IsZero = TrajectoryUtil.isZero(v2.x) && TrajectoryUtil.isZero(v2.y) && TrajectoryUtil.isZero(v2.z);
if(v1IsZero || v2IsZero){
v = 0;
}
values[i-timelag-1] = v;
//System.out.println("da " + v1.angle(v2));
}
sd.setData(values);
result = new double[]{sd.evaluate()};
return result;
}
示例9: generateActiveData
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public static void generateActiveData() {
CentralRandomNumberGenerator.getInstance().setSeed(10);
int tracklength = 500;
double dt = 1.0 / 30;
double r = 1;
double[] SNRs = { 1, 2, 5 };
double angleVelocity = Math.PI / 4;
int N = 50;
int w = 30;
AbstractClassifier rrf = new RRFClassifierRenjin(modelpath, dt);
rrf.start();
WeightedWindowedClassificationProcess wcp = new WeightedWindowedClassificationProcess();
double[] par = new double[15];
double[] cor = new double[15];
double[] sdcor = new double[15];
double[] semcor = new double[15];
int j = 0;
Mean m = new Mean();
StandardDeviation sd = new StandardDeviation();
for (double SNR : SNRs) {
r = 1;
j = 0;
while (r <= 15) {
double[] val = new double[N];
for (int i = 0; i < N; i++) {
double drift = Math.sqrt(r * 4 * diffusioncoefficient
/ ((w * 2) * dt));
double sigmaPosNoise = Math.sqrt(diffusioncoefficient * dt
+ drift * drift * dt * dt)
/ SNR;
AbstractSimulator sim1 = new ActiveTransportSimulator(
drift, angleVelocity, dt, 2, tracklength);
AbstractSimulator sim2 = new FreeDiffusionSimulator(
diffusioncoefficient, dt, 2, tracklength);
AbstractSimulator sim = new CombinedSimulator(sim1, sim2);
Trajectory t = sim.generateTrajectory();
t = SimulationUtil.addPositionNoise(t, sigmaPosNoise);
String[] res = wcp.windowedClassification(t, rrf, w,1);
val[i] = getCorrectNess(res, "DIRECTED/ACTIVE");
}
double meancorrectness = m.evaluate(val);
double corrsd = sd.evaluate(val);
par[j] = r;
cor[j] = meancorrectness;
sdcor[j] = corrsd;
semcor[j] = corrsd / Math.sqrt(N);
j++;
r += 1;
}
exportCSV("/home/thorsten/perform_active_SNR_" + SNR + "_N_" + N
+ ".csv", "r", par, cor, sdcor, semcor);
}
rrf.stop();
}
示例10: generateSubdiffusionData
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public static void generateSubdiffusionData() {
CentralRandomNumberGenerator.getInstance().setSeed(10);
int tracklength = 500;
double dt = 1.0 / 30;
double[] alphas = { 0.3, 0.5, 0.7};
double SNR = 5;
int N = 80;
AbstractClassifier rrf = new RRFClassifierRenjin(modelpath, dt);
rrf.start();
WeightedWindowedClassificationProcess wcp = new WeightedWindowedClassificationProcess();
double[] par = new double[17];
double[] cor = new double[17];
double[] sdcor = new double[17];
double[] semcor = new double[17];
int j = 0;
Mean m = new Mean();
StandardDeviation sd = new StandardDeviation();
for (double alpha : alphas) {
j = 0;
AbstractSimulator sim1 = new AnomalousDiffusionWMSimulation(
diffusioncoefficient, dt, 2, 2000, alpha);
for (int w = 15; w < 100; w += 5) {
double[] val = new double[N];
double sigmaPosNoise = Math.sqrt(diffusioncoefficient * dt)
/ SNR;
for (int i = 0; i < N; i++) {
Trajectory t = sim1.generateTrajectory();
t = t.subList(0, tracklength);
t = SimulationUtil.addPositionNoise(t, sigmaPosNoise);
String[] res = wcp.windowedClassification(t, rrf, w,1);
val[i] = getCorrectNess(res, "SUBDIFFUSION");
}
double meancorrectness = m.evaluate(val);
double corrsd = sd.evaluate(val);
par[j] = 2 * w;
cor[j] = meancorrectness;
sdcor[j] = corrsd;
semcor[j] = corrsd / Math.sqrt(N);
j++;
}
exportCSV("/home/thorsten/perform_subdiffusion_SNR_" + SNR + "_N_"
+ N + "_alpha_" + alpha + "_.csv", "r", par, cor, sdcor,
semcor);
}
rrf.stop();
}
示例11: generateConfinedData
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public static void generateConfinedData() {
CentralRandomNumberGenerator.getInstance().setSeed(10);
int tracklength = 500;
double dt = 1.0 / 30;
double B = 0.5;
double[] SNRs = {1, 2, 5 };
int N = 200;
int w = 30;
AbstractClassifier rrf = new RRFClassifierRenjin(modelpath, dt);
rrf.start();
WeightedWindowedClassificationProcess wcp = new WeightedWindowedClassificationProcess();
double[] par = new double[30];
double[] cor = new double[30];
double[] sdcor = new double[30];
double[] semcor = new double[30];
int j = 0;
Mean m = new Mean();
StandardDeviation sd = new StandardDeviation();
for (double SNR : SNRs) {
B = 0.5;
j = 0;
while (B <= 4) {
double[] val = new double[N];
double sigmaPosNoise = Math.sqrt(diffusioncoefficient * dt)
/ SNR;
double radius = Math.sqrt(BoundednessFeature.a(2 * w)
* diffusioncoefficient * dt / (4 * B));
AbstractSimulator sim1 = new ConfinedDiffusionSimulator(
diffusioncoefficient, dt, radius, 2, tracklength);
for (int i = 0; i < N; i++) {
Trajectory t = sim1.generateTrajectory();
t = SimulationUtil.addPositionNoise(t, sigmaPosNoise);
String[] res = wcp.windowedClassification(t, rrf, w,1);
val[i] = getCorrectNess(res, "CONFINED");
}
double meancorrectness = m.evaluate(val);
double corrsd = sd.evaluate(val);
par[j] = B;
cor[j] = meancorrectness;
sdcor[j] = corrsd;
semcor[j] = corrsd / Math.sqrt(N);
j++;
B += 0.2;
}
exportCSV("/home/thorsten/perform_confined_SNR_" + SNR + "_N_" + N
+ "_B_" + B + "_.csv", "r", par, cor, sdcor, semcor);
}
rrf.stop();
}
示例12: generateNormalDiffData
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public static void generateNormalDiffData() {
CentralRandomNumberGenerator.getInstance().setSeed(10);
int tracklength = 500;
double dt = 1.0 / 30;
double[] SNRs = { 1, 2, 5 };
int N = 200;
AbstractClassifier rrf = new RRFClassifierRenjin(modelpath, dt);
rrf.start();
WeightedWindowedClassificationProcess wcp = new WeightedWindowedClassificationProcess();
double[] par = new double[16];
double[] cor = new double[16];
double[] sdcor = new double[16];
double[] semcor = new double[16];
Mean m = new Mean();
StandardDeviation sd = new StandardDeviation();
for (double SNR : SNRs) {
int w = 15;
int j = 0;
while (w <= 90) {
double[] val = new double[N];
for (int i = 0; i < N; i++) {
double sigmaPosNoise = Math.sqrt(diffusioncoefficient * dt)
/ SNR;
AbstractSimulator sim = new FreeDiffusionSimulator(
diffusioncoefficient, dt, 2, tracklength);
Trajectory t = sim.generateTrajectory();
t = SimulationUtil.addPositionNoise(t, sigmaPosNoise);
String[] res = wcp.windowedClassification(t, rrf, w,1);
val[i] = getCorrectNess(res, "NORM. DIFFUSION");
}
double meancorrectness = m.evaluate(val);
double corrsd = sd.evaluate(val);
par[j] = 2 * w;
cor[j] = meancorrectness;
sdcor[j] = corrsd;
semcor[j] = corrsd / Math.sqrt(N);
j++;
w += 5;
}
exportCSV("/home/thorsten/perform_normal_SNR_" + SNR + "_N_" + N
+ ".csv", "w", par, cor, sdcor, semcor);
}
rrf.stop();
}
示例13: getSDNN
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public HRVParameter getSDNN() {
StandardDeviation d = new StandardDeviation();
return new HRVParameter(HRVParameterEnum.SDNN, d.evaluate(data.getValueAxis()), "non");
}
示例14: getSampleStandardDeviation
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
@Override
public double getSampleStandardDeviation() {
updateBuffer();
StandardDeviation sd = new StandardDeviation();
return sd.evaluate(buffer, 0, getSamplesCollected());
}
示例15: getStandardDeviation
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; //导入方法依赖的package包/类
public double getStandardDeviation(double [] featArray)
{
StandardDeviation sd = new StandardDeviation();
double stdev = sd.evaluate(featArray);
return stdev;
}