Package org.apache.commons.math.stat.descriptive

Examples of org.apache.commons.math.stat.descriptive.UnivariateStatistic


    //System.out.println(ut.getColumnDimension() + "\t" + ut.getRowDimension());
    //System.out.println(vt.getColumnDimension() + "\t" + vt.getRowDimension());
    //System.out.println(wordNo);
    //System.out.println(featureList.size());
   
    UnivariateStatistic mean = new Mean();
    UnivariateStatistic stdev = new StandardDeviation();
    List<Double> cmeans = new ArrayList<Double>();
    List<Double> cstdevs = new ArrayList<Double>();
    List<Double> ncmeans = new ArrayList<Double>();
    List<Double> ncstdevs = new ArrayList<Double>();
    int ccount = 0;
    int nccount = 0;
    for(int i=0;i<values;i++) {
      Map<String,Double> results = new HashMap<String,Double>();
      for(int j=0;j<wordNo;j++) {
        results.put(terms.get(j), ut.get(i,j));
      }
      List<String> resultsList = StringTools.getSortedList(results);
      for(String s : resultsList.subList(0, 20)) {
        System.out.println(s + "\t" + results.get(s));
      }
      System.out.println("...");
      for(String s : resultsList.subList(resultsList.size()-20, resultsList.size())) {
        System.out.println(s + "\t" + results.get(s));
      }
      List<Double> chemScores = new ArrayList<Double>();
      List<Double> nonChemScores = new ArrayList<Double>();
      List<Double> allScores = new ArrayList<Double>();
      for(int j=500;j<1000;j++) {
        boolean isChem = chemSet.contains(terms.get(j));
        //System.out.println(isChem);
        List<Double> list = isChem ? chemScores : nonChemScores;
        list.add(ut.get(i,j));
        allScores.add(ut.get(i,j));
      }
      System.out.println(chemScores.size() + "\t" + nonChemScores.size());
      double [] cs = new double[chemScores.size()];
      for(int j=0;j<chemScores.size();j++) cs[j] = chemScores.get(j);
      double [] ncs = new double[nonChemScores.size()];
      for(int j=0;j<nonChemScores.size();j++) ncs[j] = nonChemScores.get(j);
      double [] as = new double[allScores.size()];
      for(int j=0;j<allScores.size();j++) as[j] = allScores.get(j);
      System.out.println(mean.evaluate(cs) + "\t" + stdev.evaluate(cs));
      System.out.println(mean.evaluate(ncs) + "\t" + stdev.evaluate(ncs));
      cmeans.add(mean.evaluate(cs));
      cstdevs.add(stdev.evaluate(cs));
      ncmeans.add(mean.evaluate(ncs));
      ncstdevs.add(stdev.evaluate(ncs));
      System.out.println();
      ccount = cs.length;
      nccount = ncs.length;
    }
    double cp = ccount / (0.0 + ccount + nccount);
View Full Code Here

TOP

Related Classes of org.apache.commons.math.stat.descriptive.UnivariateStatistic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.