本文整理汇总了Java中org.apache.commons.math3.stat.StatUtils.max方法的典型用法代码示例。如果您正苦于以下问题:Java StatUtils.max方法的具体用法?Java StatUtils.max怎么用?Java StatUtils.max使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.stat.StatUtils
的用法示例。
在下文中一共展示了StatUtils.max方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DP
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
public DP(double[] likelihood,
int es,
int esg,
boolean isparent,
boolean logspace) {
// TODO Auto-generated constructor stub
this.isparent = isparent;
this.allowtrans = !isparent;
this.emiss = new double[es];
//this.emissG = new double[es][esg];
this.hweDist1 = new double[likelihood.length];
Arrays.fill(hweDist1, 1.0/likelihood.length);
if(logspace) likelihood = normalspace(likelihood);
if(StatUtils.max(likelihood)<=0.0)
Arrays.fill(likelihood, 1.0);
likelihood = Algebra.normalize(likelihood);
for(int i=0; i<likelihood.length; i++)
likelihood[i] = hweDist1[i]*Constants._soften_ +
likelihood[i]*(1-Constants._soften_);
this.likelihood = likelihood;
if(logspace) this.setNormalspace();
}
示例2: max
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
private double[] max(double[][] ds) {
// TODO Auto-generated method stub
double tot=Double.NEGATIVE_INFINITY,
rf=Double.NEGATIVE_INFINITY;
double f;
int r = -1;
int n = ds.length;
for(int i=0; i<n; i++)
if( (f=StatUtils.max(ds[i]))>rf ||
f==rf && StatUtils.sum(ds[i])>tot ) {
rf = f;
tot = StatUtils.sum(ds[i]);
r = i;
}
return ds[r];
}
示例3: execute
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
@Override
public Solutions<V> execute() {
int nextPercentageReport = 10;
while ((currentGeneration < maxGenerations) && !stop) {
step();
int percentage = Math.round((currentGeneration * 100) / maxGenerations);
if (percentage == nextPercentageReport) {
double[][] objs = new double[problem.getNumberOfObjectives()][population.size()];
String logStr = "";
for (int i=0; i<objs.length; i++) {
for (int j=0; j<objs[0].length; j++) {
objs[i][j] = population.get(j).getObjective(i);
}
logStr += " - Obj. "+i+": Max. "+StatUtils.max(objs[i])+"; Avg. "+StatUtils.mean(objs[i])+"; Min. "+StatUtils.min(objs[i]);
}
logger.info(percentage + "% performed ... "+logStr);
nextPercentageReport += 10;
}
}
return this.getCurrentSolution();
}
示例4: computeStat
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的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;
}
示例5: max
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
private double[] max(double[][] ds) {
// TODO Auto-generated method stub
double tot=Double.NEGATIVE_INFINITY,
rf=Double.NEGATIVE_INFINITY;
double f;
int r = -1;
for(int i=0; i<ds.length; i++)
if( (f=StatUtils.max(ds[i]))>rf ||
f==rf && StatUtils.sum(ds[i])>tot ) {
rf = f;
tot = StatUtils.sum(ds[i]);
r = i;
}
return ds[r];
}
示例6: calcRFs
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
private double[] calcRFs(boolean[][][] data,
boolean[][][] iden,
Map<Integer, Integer> swap_index,
boolean[][][] data2,
boolean[][][] iden2,
Map<Integer, Integer> swap_index2) {
// TODO Auto-generated method stub
double[] rf = new double[4];
for(int m=0; m<2; m++) {
boolean[][] data_m = Algebra.transpose(data[m]);
for(int k=0; k<2; k++) {
boolean[][] data_k = Algebra.transpose(data2[k]);
double z = 0;
for(int w=0; w<nF1; w++) {
boolean[] data_m_w = data_m[w];
boolean[] data_k_w = data_k[w];
int key_m = intKeyFromBoolArray(data_m_w);
int key_k = intKeyFromBoolArray(data_k_w);
boolean[][] iden_m = iden[swap_index.get(key_m)];
boolean[][] iden_k = iden2[swap_index2.get(key_k)];
int x = iden_m[0].length, y = iden_k[0].length;
double[] fs = new double[x*y];
int q = 0;
for(int u=0; u<x; u++) {
for(int v=0; v<y; v++) {
int c = 0;
for(int a=0; a<Constants._ploidy_H; a++)
if(iden_m[a][u]&&iden_k[a][v])
c++;
fs[q++] = c;
}
}
z += StatUtils.max(fs);
}
rf[m*2+k] = z;
}
}
return rf;
}
示例7: calcSegs
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
public double[] calcSegs(DataEntry data, int[] founder_hap) {
// TODO Auto-generated method stub
int no = data.modelLength();
double[] segs = new double[no];
List<String[]> alleles = data.getAllele();
if(data.getGenotype()!=null) {
List<List<String[]>> genotypes = data.getGenotype();
for(int i=0; i!=no; i++) {
long[] observation = new long[this.ploidy+1];
List<String[]> genotype = genotypes.get(i);
String a = alleles.get(i)[1];
int j = -1;
for(String[] geno : genotype) {
j++;
if(j==founder_hap[0]||j==founder_hap[1])
continue;
int iz = baCount(geno, a);
if(iz!=-1) observation[iz]++;
}
double[] chisq_p = new double[geno_freq_conf.length];
for(int z=0; z!=geno_freq_conf.length; z++)
chisq_p[z] = TestUtils.chiSquareTest(geno_freq_conf[z], observation);
/***
int iz = Algebra.maxIndex(chisq_p);
if(chisq_p[iz]==0) throw new RuntimeException("!!!");
int[] dosa = this.parental_allele_dosage[iz];
segs[i] = Math.abs(ploidy/2-dosa[0])+Math.abs(ploidy/2-dosa[1]);
**/
segs[i] = 1-StatUtils.max(chisq_p);
}
} else if(data.getGenotypeLikelihood()!=null) {
throw new RuntimeException("Not implemented yet!!!");
} else if(data.getAlleleDepth()!=null) {
throw new RuntimeException("Not implemented yet!!!");
} else {
throw new RuntimeException("Truncated data entry!!!");
}
return segs;
}
示例8: makeWeightingCoeff
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
private void makeWeightingCoeff() {
// TODO Auto-generated method stub
this.weights = new double[M][N];
FullSiblings fullSib = new FullSiblings();
double[][] pvals = fullSib.calcDosaConfig(this.de, this.parent_i);
for(int i=0; i<M; i++) {
if(StatUtils.max(pvals[i])==0) {
Arrays.fill(weights[i], 1.0);
continue;
}
final int p_i = Algebra.maxIndex(pvals[i]);
double[] weights_i = weights[i];
// parental samples
if(!miss[i][this.parent_i[0]] && !miss[i][this.parent_i[1]]) {
int[] parentalDosa = fullSib.getParentalDosaByIndex(p_i);
double[] ll0 = this.dp[i][this.parent_i[0]].likelihood,
ll1 = this.dp[i][this.parent_i[1]].likelihood;
if( ll0[parentalDosa[0]]+ll1[parentalDosa[1]] <
ll0[parentalDosa[1]]+ll1[parentalDosa[0]]) {
int tmp_i = parentalDosa[0];
parentalDosa[0] = parentalDosa[1];
parentalDosa[1] = tmp_i;
}
weights_i[parent_i[0]] = 1.0+founder_hap_coeff*ll0[parentalDosa[0]]*(N-2);
weights_i[parent_i[1]] = 1.0+founder_hap_coeff*ll1[parentalDosa[1]]*(N-2);
} else {
weights_i[parent_i[0]] = miss[i][this.parent_i[0]]?0.1:1.0;
weights_i[parent_i[1]] = miss[i][this.parent_i[1]]?0.1:1.0;
}
boolean[] f1Dosa = fullSib.getF1DosaByIndex(p_i);
// f1 samples
for(int j=0; j<N; j++) {
if(this.pedigree[j]!=-1) continue;
int dosa = this.getDosage(i, j);
if(miss[i][j]) weights_i[j] = 0.1;
weights_i[j] = f1Dosa[dosa] ? 1.0 : 0.01;
}
Algebra.normalize(weights_i);
Algebra.multiply(weights_i, N);
}
Utils.print(this.weights);
}
示例9: agg
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
@Override
public double agg(double[] data) {
return StatUtils.max(data) - StatUtils.min(data);
}
示例10: agg
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
@Override
public double agg(double[] data) {
return StatUtils.max(data) + 1000;
}
示例11: calculateMax
import org.apache.commons.math3.stat.StatUtils; //导入方法依赖的package包/类
private double calculateMax(double[] values) {
if (values == null || values.length == 0)
return 0.0;
return StatUtils.max(values);
}