/**
   * sdf The test main
   *
   * @param args ignored
   */
  public static void main(String[] args) {
    //        Instance[] instances =  new Instance[100];
    //        for (int i = 0; i < instances.length; i++) {
    //            double[] data = new double[2];
    //            data[0] = Math.sin(i/2.0);
    //            data[1] = (Math.random() - .5)*2;
    //            instances[i] = new Instance(data);
    //        }
    DataSet set = new DataSet(trainInstances);
    System.out.println("Before randomizing");
    System.out.println(set);
    //        Matrix projection = new RectangularMatrix(new double[][]{ {.6, .6}, {.4, .6}});
    Matrix projection = new RectangularMatrix(new double[][] {{.1, .1}, {.1, .1}});

    for (int i = 0; i < set.size(); i++) {
      Instance instance = set.get(i);
      instance.setData(projection.times(instance.getData()));
    }
    System.out.println("Before ICA");
    System.out.println(set);
    IndependentComponentAnalysis filter = new IndependentComponentAnalysis(set, 1);
    filter.filter(set);
    System.out.println("After ICA");
    System.out.println(set);
  }
示例#2
0
  public static void main(String[] args) {
    Instance[] instances = DataHard.IRIS;

    DataSet set = new DataSet(instances);

    System.out.println("Before ICA");
    System.out.println(set);

    int components = 3;

    IndependentComponentAnalysis filter = new IndependentComponentAnalysis(set, components);
    filter.filter(set);

    System.out.println("After ICA");
    System.out.println(set);
  }