示例#1
0
  @Test
  public void SVMTest() throws IOException {

    trainer.train();

    Assert.assertEquals(4, trainer.getValidSet().getRecordCount());
  }
示例#2
0
  @BeforeClass
  public void setUp() throws IOException {
    config = new ModelConfig(); // .createInitModelConfig("./", "./");
    config.getTrain().setAlgorithm("SVM");
    config.getDataSet().setSource(SourceType.LOCAL);
    config.getVarSelect().setFilterNum(2);
    config.getDataSet().setDataDelimiter(",");
    config.getDataSet().setSource(SourceType.HDFS);

    config.getTrain().setParams(new HashMap<String, Object>());
    config.getTrain().getParams().put("Const", 1.1);
    config.getTrain().getParams().put("Gamma", 0.95);
    config.getTrain().getParams().put("Kernel", "rbf");
    config.getTrain().setBaggingSampleRate(1.0);
    config.getTrain().setBaggingWithReplacement(false);

    trainer = new SVMTrainer(config, 0, false);
    trainer.setTrainSet(xor_Trainset);
    trainer.setValidSet(xor_Validset);
  }