Exemplo n.º 1
0
  public void createBucketWithRandomTS(String s, int EXP, int ANZ) throws IOException {

    DecimalFormat df = new DecimalFormat("0.000");

    System.out.println("--> create bucket : uncorrelated TS alpha=0.5");

    Configuration config = new Configuration();
    FileSystem fs = FileSystem.get(config);

    Path path = new Path(outputDir + "/" + s + "_alpha_0.5_.tsb.vec.seq");
    System.out.println("--> create bucket : " + path.toString());

    // write a SequenceFile form a Vector
    SequenceFile.Writer writer =
        new SequenceFile.Writer(fs, config, path, Text.class, VectorWritable.class);

    System.out.println(
        "--> process bucket : Uniform-Random-Generator ( z="
            + ANZ
            + ", l="
            + Math.pow(2, EXP)
            + ", TestA )");

    int SAMPLES = 0;
    for (int i = 0; i < ANZ; i++) {

      TSData data = new TSData();
      data.dataset = processTESTA(data.getRandomData((int) Math.pow(2, EXP)));
      Messreihe mr = data.getMessreihe();
      if (SAMPLES < TSPropertyTester.zSAMPLES) TSPropertyTester.addSample(mr);
      SAMPLES++;
      /** Here we lose the METADATA of each row!!! */
      System.out.print("  (" + i + ")");
      NamedVector nv = new NamedVector(new DenseVector(data.getData()), data.label);
      VectorWritable vec = new VectorWritable();
      vec.set(nv);

      writer.append(new Text(nv.getName()), vec);
    }

    writer.close();
    System.out.println("### DONE : " + path.toString());
  }
Exemplo n.º 2
0
  /**
   * Create LRC time series ...
   *
   * @param s
   * @param z
   * @param EXP
   * @param BETA
   * @throws IOException
   * @throws Exception
   */
  public void createBucketWithRandomTS(String s, int z, int EXP, double BETA)
      throws IOException, Exception {

    DecimalFormat df = new DecimalFormat("0.000");

    System.out.println("--> create bucket : LRC with beta=" + df.format(BETA));

    Configuration config = new Configuration();
    FileSystem fs = FileSystem.get(config);

    Path path = new Path(outputDir + "/" + s + "_LRC_beta_" + df.format(BETA) + ".tsb.vec.seq");
    System.out.println("--> create bucket : " + path.toString());

    // write a SequenceFile form a Vector
    SequenceFile.Writer writer =
        new SequenceFile.Writer(fs, config, path, Text.class, VectorWritable.class);

    System.out.println("--> process bucket : LRC-Generator (" + z + ")");

    int SAMPLES = 0;
    for (int i = 0; i < z; i++) {

      boolean showTESTS = false;

      Messreihe mr =
          LongTermCorrelationSeriesGenerator.getRandomRow(
              (int) Math.pow(2, EXP), BETA, showTESTS, false);
      if (SAMPLES < TSPropertyTester.zSAMPLES) TSPropertyTester.addSample(mr);
      SAMPLES++;

      TSData data = TSData.convertMessreihe(mr);

      System.out.println("(" + i + ")");
      NamedVector nv = new NamedVector(new DenseVector(data.getData()), data.label);
      VectorWritable vec = new VectorWritable();
      vec.set(nv);

      writer.append(new Text(nv.getName()), vec);
    }

    writer.close();
    System.out.println("### DONE : " + path.toString());
  }