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


Java StatUtils.min方法代碼示例

本文整理匯總了Java中org.apache.commons.math3.stat.StatUtils.min方法的典型用法代碼示例。如果您正苦於以下問題:Java StatUtils.min方法的具體用法?Java StatUtils.min怎麽用?Java StatUtils.min使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.math3.stat.StatUtils的用法示例。


在下文中一共展示了StatUtils.min方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: print

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
private void print(double[][] ds) {
	// TODO Auto-generated method stub
	//AnsiConsole.systemInstall();
	
	for(int i=0; i<ds.length; i++) {
		double m = StatUtils.min(ds[i]);
		for(int j=0; j<ds[i].length; j++) { 
			if(ds[i][j]==m) { 
				//System.out.print(ansi().fg(RED).
				//		a(formatter.format(ds[i][j])+"\t").reset());
				System.out.print(formatter.format(ds[i][j])+"\t");
				System.out.flush();
			} else {
				System.out.print(formatter.format(ds[i][j])+"\t");
				System.out.flush();
			}
		}
		System.out.println();
		System.out.flush();
	}
	System.out.println();
	System.out.flush();
	//AnsiConsole.systemUninstall();
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:25,代碼來源:RFEstimatorML.java

示例2: min

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
private double[] min(double[][] ds) {
	// TODO Auto-generated method stub
	double tot=Double.POSITIVE_INFINITY, 
			rf=Double.POSITIVE_INFINITY;
	double f;
	int r = -1;
	int n = ds.length;
	for(int i=0; i<n; i++) 
		if( (f=StatUtils.min(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,代碼來源:RFEstimatorML.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: calculateOverallAnnotationSufficiencyForAttributeSet

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
public double calculateOverallAnnotationSufficiencyForAttributeSet(Set<OWLClass> atts) throws UnknownOWLClassException {
	SummaryStatistics stats = computeAttributeSetSimilarityStats(atts);
	if ((this.getSummaryStatistics() == null) || Double.isNaN(this.getSummaryStatistics().mean.getMean())) {
		LOG.info("Stats have not been computed yet - doing this now");
		this.computeSystemStats();
	}
	// score = mean(atts)/mean(overall) + max(atts)/max(overall) + sum(atts)/mean(sum(overall))
	double overall_score = 0.0;
	Double mean_score = stats.getMean();
	Double max_score = stats.getMax();
	Double sum_score = stats.getSum();
	if (!(mean_score.isNaN() || max_score.isNaN() || sum_score.isNaN())) {
		mean_score = StatUtils.min(new double[]{(mean_score / this.overallSummaryStatsPerIndividual.mean.getMean()),1.0});
		max_score = StatUtils.min(new double[]{(max_score / this.overallSummaryStatsPerIndividual.max.getMax()),1.0});
		sum_score = StatUtils.min(new double[]{(sum_score / this.overallSummaryStatsPerIndividual.sum.getMean()),1.0});
		overall_score = (mean_score + max_score + sum_score) / 3;		
	}
	LOG.info("Overall mean: "+mean_score + " max: "+max_score + " sum:"+sum_score + " combined:"+overall_score);
	return overall_score;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:21,代碼來源:AbstractOwlSim.java

示例6: verifyINodesPartial

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
protected int verifyINodesPartial(final List<INode> inodes, final String[]
    names, final int[] parentIds, final int[] inodeIds) throws IOException {
  int index = (int)StatUtils.min(new double[]{inodes.size(), inodeIds
      .length, parentIds.length, names.length});
  for (int i = 0; i < index; i++) {
    INode inode = inodes.get(i);
    boolean noChangeInInodes =
        inode != null && inode.getLocalName().equals(names[i]) &&
            inode.getParentId() == parentIds[i] &&
            inode.getId() == inodeIds[i];
    if (!noChangeInInodes) {
      index = i;
      break;
    }
  }
  return index;
}
 
開發者ID:hopshadoop,項目名稱:hops,代碼行數:18,代碼來源:INodeLock.java

示例7: distance

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
public double distance(TwoPointSegment tps) {
    if(this.intersect(tps)) return 0;
    double[] allD = new double[4];
    allD[0] = this.distance(tps.p1);
    allD[1] = this.distance(tps.p2);
    allD[2] = tps.distance(this.p1);
    allD[3] = tps.distance(this.p2);
    return StatUtils.min(allD);
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:10,代碼來源:GenomeAssemblyTiling.java

示例8: pdistance

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
public double pdistance(BlastRecord record) {
	// TODO Auto-generated method stub
	// perpendicular distance
	if(this.intersect(record)) return 0;
	double[] allD = new double[4];
	allD[0] = this.distance(new double[]{record.sstart, record.qstart});
	allD[1] = this.distance(new double[]{record.send, record.qend});
	allD[2] = record.distance(new double[]{this.sstart, this.qstart});
	allD[3] = record.distance(new double[]{this.send, this.qend});
	return StatUtils.min(allD);
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:12,代碼來源:BlastRecord.java

示例9: calculateSubgraphAnnotationSufficiencyForAttributeSet

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
public double calculateSubgraphAnnotationSufficiencyForAttributeSet(Set<OWLClass> atts, OWLClass c) throws UnknownOWLClassException {
	SummaryStatistics stats = computeAttributeSetSimilarityStatsForSubgraph(atts,c);
	//TODO: compute statsPerIndividual for this subgraph
	if ((this.overallSummaryStatsPerIndividual == null ) || (Double.isNaN(this.overallSummaryStatsPerIndividual.max.getMean()))) {
		LOG.info("Stats have not been computed yet - doing this now");
		this.computeSystemStats();
	}

	if (!(this.subgraphSummaryStatsPerIndividual.containsKey(c))) {
		//only do this once for the whole system, per class requested
		this.computeSystemStatsForSubgraph(c);
	}
	// score = mean(atts)/mean(overall) + max(atts)/max(overall) + sum(atts)/mean(sum(overall))
	//TODO: need to normalize this based on the whole corpus
	double score = 0.0;
	Double mean_score = stats.getMean();
	Double max_score = stats.getMax();
	Double sum_score = stats.getSum();

	if (!(mean_score.isNaN() || max_score.isNaN() || sum_score.isNaN())) {
		mean_score = StatUtils.min(new double[]{(mean_score / this.subgraphSummaryStatsPerIndividual.get(c).mean.getMean()),1.0});
		max_score = StatUtils.min(new double[]{(max_score / this.subgraphSummaryStatsPerIndividual.get(c).max.getMax()),1.0});
		sum_score = StatUtils.min(new double[]{(sum_score / this.subgraphSummaryStatsPerIndividual.get(c).sum.getMean()),1.0});
		score = (mean_score + max_score + sum_score) / 3;		
	}
	LOG.info(getShortId(c)+" n: "+stats.getN()+" mean: "+mean_score + " max: "+max_score + " sum:"+sum_score + " combined:"+score);
	return score;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:29,代碼來源:AbstractOwlSim.java

示例10: min

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
static float min(List<? extends Number> values) {
    double[] dValues = values.stream().mapToDouble(v -> v.floatValue()).toArray();
    return (float) StatUtils.min(dValues);
}
 
開發者ID:capergroup,項目名稱:bayou,代碼行數:5,代碼來源:Metric.java

示例11: run

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
@Override
public void run() {
	// TODO Auto-generated method stub
	try {
		MyPhasedDataCollection[] dc_i = dc[this.i];
		MyPhasedDataCollection[] dc_j = dc[this.j];
		String contig=null, contig2=null;
		int ii = 0;
		while(ii<dc_i.length && contig==null) {
			contig = dc_i[ii]==null ? null : 
				dc_i[ii].markers[0].replaceAll("_[0-9]{1,}$", "");
			ii++;
		}
		int jj = 0;
		while(jj<dc_j.length && contig2==null) {
			contig2 = dc_j[jj]==null ? null : 
				dc_j[jj].markers[0].replaceAll("_[0-9]{1,}$", "");
			jj++;
		}
		if(contig==null || contig2==null) return;
		if(!scaff_only.isEmpty() && 
				!scaff_only.contains(contig) && 
				!scaff_only.contains(contig2)) return;
	
		int m = dc_i.length, n = dc_j.length;
		double[][] rf_all = new double[m*n][4];
		for(int k=0; k<rf_all.length; k++)
			Arrays.fill(rf_all[k], -1);
	
		for(int k=0; k<m; k++) 
			for(int s=0; s<n; s++) 
				if(dc_i[k]!=null && dc_j[s]!=null)
					rf_all[k*m+s] = calcRFs(k, s);
	
		rf_all = Algebra.transpose(rf_all);
		StringBuilder os = new StringBuilder();
		os.append("#");
		os.append(this.i);
		os.append(" ");
		os.append(this.j);
		os.append("\n");
		for(int k=0; k<rf_all.length; k++) {
			os.append(formatter.format(rf_all[k][0]));
			for(int u=1; u<rf_all[k].length; u++) {
				os.append(" ");
				os.append(formatter.format(rf_all[k][u]));
			}
			os.append("\n");
		}
		double[] rf; 
		String w;
	
		rf = new double[4];
		for(int k=0; k<4; k++) {
			double[] rf_tmp = removeNEG(rf_all[k]);
			if(rf_tmp==null)
				rf[k] = -1;
			else
				rf[k] = StatUtils.min(rf_tmp);
		}
		w = StatUtils.min(rf)+"\t";
		for(int k=0; k<rf.length; k++) w += rf[k]+"\t";
		w += contig+"\t"+contig2+"\n";
		rfMinimumWriter.write(w);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		Thread t = Thread.currentThread();
		t.getUncaughtExceptionHandler().uncaughtException(t, e);
		e.printStackTrace();
		executor.shutdown();
		System.exit(1);
	}
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:74,代碼來源:RFEstimatorRS2.java

示例12: run

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
@Override
public void run() {
	// TODO Auto-generated method stub
	rs_N = rs_n*nF1*Constants._ploidy_H;
	try {
		MyPhasedDataCollection[] dc_i = dc[this.i];
		MyPhasedDataCollection[] dc_j = dc[this.j];
		String contig=null, contig2=null;
		int ii = 0;
		while(ii<dc_i.length && contig==null) {
			contig = dc_i[ii]==null ? null : 
				dc_i[ii].markers[0].replaceAll("_[0-9]{1,}$", "");
			ii++;
		}
		int jj = 0;
		while(jj<dc_j.length && contig2==null) {
			contig2 = dc_j[jj]==null ? null : 
				dc_j[jj].markers[0].replaceAll("_[0-9]{1,}$", "");
			jj++;
		}
		if(contig==null || contig2==null) return;
		if(!scaff_only.isEmpty() && 
				!scaff_only.contains(contig) && 
				!scaff_only.contains(contig2)) return;
	
		int m = dc_i.length, n = dc_j.length;
		double[][] rf_all = new double[m*n][4];
		for(int k=0; k<rf_all.length; k++)
			Arrays.fill(rf_all[k], -1);
	
		for(int k=0; k<m; k++) 
			for(int s=0; s<n; s++) 
				if(dc_i[k]!=null && dc_j[s]!=null)
					rf_all[k*m+s] = calcRFs(k, s);
	
		rf_all = Algebra.transpose(rf_all);
		StringBuilder os = new StringBuilder();
		os.append("#");
		os.append(this.i);
		os.append(" ");
		os.append(this.j);
		os.append("\n");
		for(int k=0; k<rf_all.length; k++) {
			os.append(formatter.format(rf_all[k][0]));
			for(int u=1; u<rf_all[k].length; u++) {
				os.append(" ");
				os.append(formatter.format(rf_all[k][u]));
			}
			os.append("\n");
		}
		double[] rf; 
		String w;
	
		rf = new double[4];
		for(int k=0; k<4; k++) {
			double[] rf_tmp = removeNEG(rf_all[k]);
			if(rf_tmp==null)
				rf[k] = -1;
			else
				rf[k] = StatUtils.min(rf_tmp);
		}
		w = StatUtils.min(rf)+"\t";
		for(int k=0; k<rf.length; k++) w += rf[k]+"\t";
		w += contig+"\t"+contig2+"\n";
		rfMinimumWriter.write(w);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		Thread t = Thread.currentThread();
		t.getUncaughtExceptionHandler().uncaughtException(t, e);
		e.printStackTrace();
		executor.shutdown();
		System.exit(1);
	}
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:75,代碼來源:RFEstimatorRS.java

示例13: 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

示例14: baf

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
/**
private void baf() {
	// TODO Auto-generated method stub
	//if(this.pl.get(0).get(0).length>3)
	//	throw new RuntimeException("need to change for polyploidy!!!");
	int cp = this.pl.get(0).get(0).length;
	this.baf = new double[this.allele.size()][2];
	for(int i=0; i<this.baf.length; i++) {
		double f0 = 0.0, f1 = 0.0;
		int n = 0;
		for(int j=0; j<this.pl.get(i).size(); j++) {
			double[] ll = this.pl.get(i).get(j);
			if(ll[0]==-1) 
				for(int k=0; k<ll.length; k++)
					f0 += 1.0/cp*k;
			else {
				for(int k=1; k<ll.length; k++) {
					f0 += ll[k]*k;
					f1 += ll[k]*k;
				}
				n++;
			}
		}
		this.baf[i][0] = f0/this.pl.get(i).size()
				/(cp-1);
		this.baf[i][1] = f1/n/(cp-1);
	}
}
**/

private void filter() {
	// TODO Auto-generated method stub
	List<Integer> rl = new ArrayList<Integer>();
	int h = Constants._ploidy_H;
	double thresh = 1.0/h/4;
	for(int i=0; i<this.allele.size(); i++) {
		if(this.allele.get(i).length != 2) {
			rl.add(i);
			continue;
		}
		double[] ds = new double[2];
		for(int j=0; j<this.gl.get(i).size(); j++) {
			double[] d = this.gl.get(i).get(j);
			for(int k=0; k<d.length; k++) 
				if(d[k]>0) {
					ds[0] += (h-k)*d[k];
					ds[1] += k*d[k];
				}
		}
		if(StatUtils.min(ds)/StatUtils.sum(ds)<thresh) 
			rl.add(i);
	}
	this.remove(ArrayUtils.toPrimitive(
			rl.toArray(new Integer[rl.size()])));
	return;
}
 
開發者ID:c-zhou,項目名稱:polyGembler,代碼行數:57,代碼來源:DataEntry.java

示例15: calculateMin

import org.apache.commons.math3.stat.StatUtils; //導入方法依賴的package包/類
private double calculateMin(double[] values) {
	
	if (values == null || values.length == 0)
		return 0.0;
	
	return StatUtils.min(values);
}
 
開發者ID:rwth-acis,項目名稱:REST-OCD-Services,代碼行數:8,代碼來源:Evaluation.java


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