當前位置: 首頁>>代碼示例>>Java>>正文


Java StatUtils.max方法代碼示例

本文整理匯總了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();
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:23,代碼來源:HiddenMarkovModel.java

示例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];
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:17,代碼來源:RFEstimatorRS2.java

示例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();       
}
 
開發者ID:hecoding,項目名稱:Pac-Man,代碼行數:23,代碼來源:MultiObjectiveMemeticAlgorithm.java

示例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;
}
 
開發者ID:nuxeo,項目名稱:gatling-report,代碼行數:19,代碼來源:RequestStat.java

示例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];
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:16,代碼來源:RFEstimatorML.java

示例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;
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:40,代碼來源:RFEstimatorRS2.java

示例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;
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:43,代碼來源:Segregation.java

示例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);
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:48,代碼來源:HiddenMarkovModelBWT.java

示例9: agg

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
@Override
public double agg(double[] data) {
    return StatUtils.max(data) - StatUtils.min(data);
}
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:5,代碼來源:AggregateFunctions.java

示例10: agg

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
@Override
public double agg(double[] data) {
    return StatUtils.max(data) + 1000;
}
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:5,代碼來源:ViewGroupTest.java

示例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);
}
 
開發者ID:rwth-acis,項目名稱:REST-OCD-Services,代碼行數:8,代碼來源:Evaluation.java


注:本文中的org.apache.commons.math3.stat.StatUtils.max方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。