Package gnu.trove.list.array

Examples of gnu.trove.list.array.TDoubleArrayList


  }
 
  private static void UpdateBestConfig(String algo, TObjectDoubleHashMap algo2BestScore,
                                       HashMap<String,Hashtable> algo2BestConfig, Hashtable config,
                                       ArrayList perIterMultiScores) {
    TDoubleArrayList perIterScores = new TDoubleArrayList();
    for (int i = 1; i < perIterMultiScores.size(); ++i) {
      TObjectDoubleHashMap r = (TObjectDoubleHashMap) perIterMultiScores.get(i);
      perIterScores.add(r.get(Constants.GetMRRString()));
    }

    if (perIterScores.size() > 0) {
      //      System.out.println("SIZE: " + perIterScores.size());
      int mi = 0;
      for (int i = 1; i < perIterScores.size(); ++i) {
        if (perIterScores.get(i) > perIterScores.get(mi)) {
          mi = i;
        }
      }
      //      System.out.println("max_idx: " + mi + " " + perIterScores.toString());
      double maxScore = perIterScores.get(mi); // perIterScores.max();
      if (algo2BestScore.size() == 0 || algo2BestScore.get(algo) < maxScore) {
        //        System.out.println("new best score: " + maxScore);
        // best iteration
        int bestIter = perIterScores.indexOf(maxScore) + 1;

        algo2BestScore.put(algo, maxScore);
        algo2BestConfig.put(algo, (Hashtable) config.clone());
        algo2BestConfig.get(algo).put("iters", bestIter);
      }
View Full Code Here


                  if ("table".equalsIgnoreCase(cd.getNodeName()))
                  {
                    attrs = cd.getAttributes();
                    String tableName = attrs.getNamedItem("name").getNodeValue();
                    StringTokenizer data = new StringTokenizer(cd.getFirstChild().getNodeValue());
                    TDoubleArrayList array = new TDoubleArrayList();
                    while (data.hasMoreTokens())
                    {
                      array.add(Double.parseDouble(data.nextToken()));
                    }
                    if (tableName.equalsIgnoreCase("#soloValues"))
                    {
                      soloValues = new double[array.size()];
                      int x = 0;
                      for (double value : array.toArray())
                      {
                        soloValues[x++] = value;
                      }
                    }
                    else
                    {
                      combinedValues = new double[array.size()];
                      int x = 0;
                      for (double value : array.toArray())
                      {
                        combinedValues[x++] = value;
                      }
                    }
                  }
                }
                ((List<augmentationStat>) _augStats[i - 1]).add(new augmentationStat(Stats.valueOfXml(statName), soloValues, combinedValues));
              }
            }
          }
        }
      }
      catch (Exception e)
      {
        _log.error("Error parsing augmentation_stats" + i + ".xml.", e);
        return;
      }
      try
      {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        factory.setIgnoringComments(true);
        File file = new File(Config.DATAPACK_ROOT, "data/xml/stats/augmentation/augmentation_jewel_stats" + i + ".xml");
        Document doc = factory.newDocumentBuilder().parse(file);
        for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
        {
          if ("list".equalsIgnoreCase(n.getNodeName()))
          {
            for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
            {
              if ("stat".equalsIgnoreCase(d.getNodeName()))
              {
                NamedNodeMap attrs = d.getAttributes();
                String statName = attrs.getNamedItem("name").getNodeValue();
                double soloValues[] = null, combinedValues[] = null;
                for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
                {
                  if ("table".equalsIgnoreCase(cd.getNodeName()))
                  {
                    attrs = cd.getAttributes();
                    String tableName = attrs.getNamedItem("name").getNodeValue();
                    StringTokenizer data = new StringTokenizer(cd.getFirstChild().getNodeValue());
                    TDoubleArrayList array = new TDoubleArrayList();
                    while (data.hasMoreTokens())
                    {
                      array.add(Double.parseDouble(data.nextToken()));
                    }
                    if (tableName.equalsIgnoreCase("#soloValues"))
                    {
                      soloValues = new double[array.size()];
                      int x = 0;
                      for (double value : array.toArray())
                      {
                        soloValues[x++] = value;
                      }
                    }
                    else
                    {
                      combinedValues = new double[array.size()];
                      int x = 0;
                      for (double value : array.toArray())
                      {
                        combinedValues[x++] = value;
                      }
                    }
                  }
View Full Code Here

TOP

Related Classes of gnu.trove.list.array.TDoubleArrayList

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.