Package fr.lip6.jkernelmachines.kernel.extra

Examples of fr.lip6.jkernelmachines.kernel.extra.CustomTrainTestMatrixKernel


    double[][] matrix = new double[l.size()][l.size()];
   
//    if(gammas[x] == 0)
//      return matrix;
    //computing matrix       
    ThreadedMatrixOperator factory = new ThreadedMatrixOperator()
    {
      @Override
      public void doLines(double[][] matrix, int from, int to) {
        double tmp = 0;
        for(int index = from ; index < to ; index++)
        {
          double s1 = l.get(index).sample[x];
          for(int j = 0 ; j < matrix.length ; j++){
            tmp = s1 - l.get(j).sample[x];
//            matrix[index][j] = gammas[x]*tmp*tmp;
            matrix[index][j] = tmp*tmp;
          }
           
        }
      }
    };
   
    factory.getMatrix(matrix);
   
    return matrix;
  }
View Full Code Here


  public double[][] getDistanceMatrix(final List<TrainingSample<T>> l)
  {
    double[][] matrix = new double[l.size()][l.size()];
   
    //computing matrix       
    ThreadedMatrixOperator factory = new ThreadedMatrixOperator()
    {
      @Override
      public void doLines(double[][] matrix, int from, int to) {
        for(int index = from ; index < to ; index++)
        {
          T s1 = l.get(index).sample;
          for(int j = 0 ; j < matrix.length ; j++)
            matrix[index][j] = distanceValueOf(s1, l.get(j).sample);
        }
      }
    };
   
    factory.getMatrix(matrix);
   
    return matrix;
  }
View Full Code Here

    double[][] matrix = new double[l.size()][l.size()];
   
//    if(gammas[x] == 0)
//      return matrix;
    //computing matrix       
    ThreadedMatrixOperator factory = new ThreadedMatrixOperator()
    {
      @Override
      public void doLines(double[][] matrix, int from, int to) {
        double tmp = 0;
        for(int index = from ; index < to ; index++)
        {
          double s1 = l.get(index).sample[x];
          for(int j = 0 ; j < matrix.length ; j++){
            tmp = s1 - l.get(j).sample[x];
//            matrix[index][j] = gammas[x]*tmp*tmp;
            matrix[index][j] = tmp*tmp;
          }
           
        }
      }
    };
   
    factory.getMatrix(matrix);
   
    return matrix;
  }
View Full Code Here

    //rebuild matrix
    kmatrix = kernel.getKernelMatrix(tlist);
   
    //rebuild gradient
    final double[] tmp = new double[g.length];
    (new ThreadedMatrixOperator(){

      @Override
      public void doLines(double[][] matrix, int from, int to) {
        for(int index = from ; index < to ; index++)
        {
View Full Code Here

  LaSVM<double[]> svm;

  @Before
  public void setUp() throws Exception {
   
    GaussianGenerator g = new GaussianGenerator(10, 5.0f, 1.0);
    train = g.generateList(10);
   
    DoubleGaussL2 k = new DoubleGaussL2(1.0);
    svm = new LaSVM<double[]>(k);
  }
View Full Code Here

  LaSVM<double[]> svm;

  @Before
  public void setUp() throws Exception {
   
    GaussianGenerator g = new GaussianGenerator(10, 5.0f, 1.0);
    train = g.generateList(10);
   
    DoubleGaussL2 k = new DoubleGaussL2(1.0);
    svm = new LaSVM<double[]>(k);
  }
View Full Code Here

  /**
   * @throws java.lang.Exception
   */
  @Before
  public void setUp() throws Exception {
    g = new GaussianGenerator();
  }
View Full Code Here

  /**
   * Test method for {@link fr.lip6.jkernelmachines.util.generators.GaussianGenerator#GaussianGenerator(int)}.
   */
  @Test
  public final void testGaussianGeneratorInt() {
    g = new GaussianGenerator(2);
    assertEquals(2, g.getDimension());
  }
View Full Code Here

  /**
   * @throws java.lang.Exception
   */
  @Before
  public void setUp() throws Exception {
    GaussianGenerator gen = new GaussianGenerator(2, 2, 1.0);
    List<TrainingSample<double[]>> list = gen.generateList(100, 100);
    train = new ArrayList<double[]>();
    for (TrainingSample<double[]> t : list) {
      train.add(t.sample);
    }
  }
View Full Code Here

  /**
   * Test method for {@link fr.lip6.jkernelmachines.util.generators.GaussianGenerator#GaussianGenerator(int, float, double)}.
   */
  @Test
  public final void testGaussianGeneratorIntFloatDouble() {
    g = new GaussianGenerator(2, 4.0f, 1.0);
    assertEquals(2, g.getDimension());
    assertEquals(4.0f, g.getP(), 1e-15);
    assertEquals(1.0, g.getSigma(), 1e-15);
  }
View Full Code Here

TOP

Related Classes of fr.lip6.jkernelmachines.kernel.extra.CustomTrainTestMatrixKernel

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.