Пример #1
0
  // covtype.altered response column has this distribution:
  //      -1  20510
  //       1 211840
  //       2 283301
  //       3  35754
  //       4   2747
  //       6  17367
  //   10000   9493
  @Test
  public void testSplitCats() {
    Frame cov = parse_test_file(Key.make("cov"), "smalldata/covtype/covtype.altered.gz");
    System.out.println(cov.toString(0, 10));

    Val v_ddply = Exec.exec("(ddply cov [54] nrow)");
    System.out.println(v_ddply.toString());
    ((ValFrame) v_ddply)._fr.delete();

    Val v_groupby = Exec.exec("(GB cov [54] nrow 54 \"all\")");
    System.out.println(v_groupby.toString());
    ((ValFrame) v_groupby)._fr.delete();

    cov.delete();
  }
Пример #2
0
  // ==========================================================================
  /*@Test*/ public void testBasicCRUD() {
    // Parse a file with many broken enum/string columns
    Key k = Key.make("zip.hex");
    try {
      Frame fr = TestUtil.parseFrame(k, "smalldata/zip_code/zip_code_database.csv.gz");
      System.out.println(fr);

      StringBuilder sb = new StringBuilder();
      String[] fs = fr.toStringHdr(sb);
      int lim = Math.min(40, (int) fr.numRows());
      for (int i = 0; i < lim; i++) fr.toString(sb, fs, i);
      System.out.println(sb.toString());
    } finally {
      UKV.remove(k);
    }
  }
Пример #3
0
  @Test
  public void testGroupbyTableSpeed() {
    Frame ids = parse_test_file(Key.make("cov"), "smalldata/junit/id_cols.csv");
    ids.replace(0, ids.anyVec().toCategoricalVec()).remove();
    System.out.println(ids.toString(0, 10));

    long start = System.currentTimeMillis();
    Val v_gb = Exec.exec("(GB cov [0] nrow 0 \"all\")");
    System.out.println("GB Time= " + (System.currentTimeMillis() - start) + "msec");
    System.out.println(v_gb.toString());
    ((ValFrame) v_gb)._fr.delete();

    long start2 = System.currentTimeMillis();
    Val v_tb = Exec.exec("(table cov FALSE)");
    System.out.println("Table Time= " + (System.currentTimeMillis() - start2) + "msec");
    System.out.println(v_tb.toString());
    ((ValFrame) v_tb)._fr.delete();

    ids.delete();
  }
Пример #4
0
  @Test
  public void testCovtype() {
    Frame frame = parse_test_file("smalldata/covtype/covtype.20k.data");

    AggregatorModel.AggregatorParameters parms = new AggregatorModel.AggregatorParameters();
    parms._train = frame._key;
    parms._radius_scale = 5.0;
    long start = System.currentTimeMillis();
    AggregatorModel agg = new Aggregator(parms).trainModel().get(); // 0.179
    System.out.println(
        "AggregatorModel finished in: "
            + (System.currentTimeMillis() - start) / 1000.
            + " seconds");
    agg.checkConsistency();
    frame.delete();
    Frame output = agg._output._output_frame.get();
    Log.info("Exemplars: " + output.toString());
    output.remove();
    Log.info("Number of exemplars: " + agg._exemplars.length);
    //    Assert.assertTrue(agg._exemplars.length==615);
    agg.remove();
  }
Пример #5
0
 @Override
 public String toString() {
   return _fr.toString();
 }
Пример #6
0
 public String toStringAll() {
   StringBuilder sb = new StringBuilder();
   String[] fs = toStringHdr(sb);
   for (int i = 0; i < numRows(); i++) toString(sb, fs, i);
   return sb.toString();
 }