Esempio n. 1
0
 public void shrink() {
   if (!isCategorical) levelP = 10;
   levelA = (String[]) Utils.resizeArray(levelA, levelP);
   grpSize = (int[]) Utils.resizeArray(grpSize, levelP);
   if (!isCategorical) {
     levelP = 0;
     dimThres = 10;
   }
 }
Esempio n. 2
0
  public double Min() {
    if (!minSet)
      if (dataSet.isDB) {
        try {
          Statement stmt = dataSet.con.createStatement();
          String query = "select min(" + name + ") from " + dataSet.Table;
          ResultSet rs = stmt.executeQuery(query);

          if (rs.next()) this.min = Utils.atod(rs.getString(1));
          rs.close();
          stmt.close();
          System.out.println("query: " + query + " ---> " + this.min);
        } catch (Exception ex) {
          System.out.println("DB Exception: get min ... " + ex);
        }
      } else for (int i = 0; i < data.length; i++) this.min = Math.min(data[i], this.min);
    minSet = true;
    return this.min;
  }
Esempio n. 3
0
  public double Max() {
    if (!maxSet)
      if (dataSet.isDB) {
        try {
          Statement stmt = dataSet.con.createStatement();
          String query = "select max(" + name + ") from " + dataSet.Table;
          ResultSet rs = stmt.executeQuery(query);

          if (rs.next()) this.max = Utils.atod(rs.getString(1));
          rs.close();
          stmt.close();
          System.out.println("query: " + query + " ---> " + this.max);
        } catch (Exception ex) {
          System.out.println("DB Exception: get max ... " + ex);
        }
      } else if (!alpha)
        if (!isCategorical) this.max = data[sortI[data.length - numMiss - 1]];
        else if (numMiss == 0) this.max = Double.valueOf(levelA[permA[levelP - 1]]).doubleValue();
        else this.max = Double.valueOf(levelA[permA[levelP - 2]]).doubleValue();
      else for (int i = 0; i < dataSet.n - numMiss; i++) this.max = Math.max(data[i], this.max);
    maxSet = true;
    return this.max;
  }
Esempio n. 4
0
 void expand() {
   dimThres = (int) (1.5 * dimThres);
   System.out.println("-- Expand to: " + dimThres);
   levelA = (String[]) Utils.resizeArray(levelA, dimThres);
   grpSize = (int[]) Utils.resizeArray(grpSize, dimThres);
 }