Package org.encog.ml.svm

Examples of org.encog.ml.svm.SVM


  public final File SERIAL_FILENAME = TEMP_DIR.createFile("encogtest.ser");
 
  private SVM create()
  {
    MLDataSet training = new BasicMLDataSet(XOR.XOR_INPUT,XOR.XOR_IDEAL);
    SVM result = new SVM(2,SVMType.EpsilonSupportVectorRegression,KernelType.RadialBasisFunction);
    final SVMTrain train = new SVMTrain(result, training);
    train.iteration();
    return result;
  }
View Full Code Here


    return result;
  }
 
  public void testPersistEG()
  {
    SVM network = create();

    EncogDirectoryPersistence.saveObject((EG_FILENAME), network);
    SVM network2 = (SVM)EncogDirectoryPersistence.loadObject((EG_FILENAME));
    validate(network2);
  }
View Full Code Here

    validate(network2);
  }
 
  public void testPersistSerial() throws IOException, ClassNotFoundException
  {
    SVM network = create();
   
    SerializeObject.save(SERIAL_FILENAME, network);
    SVM network2 = (SVM)SerializeObject.load(SERIAL_FILENAME);
       
    validate(network2);
  }
View Full Code Here

  @Override
  public final MLMethod generate() {
    if (this.outputNeurons != 1) {
      throw new PatternError("A SVM may only have one output.");
    }
    final SVM network = new SVM(this.inputNeurons, this.svmType,
        this.kernelType);
    return network;
  }
View Full Code Here

    return temp.process(this.normalizedSunspots);
  }
 
  public SVM createNetwork()
  {
    SVM network = new SVM(WINDOW_SIZE,true);
    return network;
  }
View Full Code Here

  }
 
  public void run()
  {
    normalizeSunspots(0.1,0.9);
    SVM network = createNetwork();
    MLDataSet training = generateTraining();
    train(network,training);
    predict(network);
   
  }
View Full Code Here

  public void finishTraining() {
    stop();
  }

  private SVM generateSVM() {
    final SVM svm = new SVM(this.modelSVM.getInputCount(),
        this.modelSVM.getSVMType(), this.modelSVM.getKernelType());
    return svm;
  }
View Full Code Here

   * This method creates, and trains, a SVM with the best const and gamma.
   * @return The best SVM.
   */
  @Override
  public MLMethod getMethod() {
    final SVM result = generateSVM();
    result.getParams().C = this.bestConst;
    result.getParams().gamma = this.bestGamma;
    result.setModel(svm.svm_train(this.problem, result.getParams()));
    return result;
  }
View Full Code Here

  public Object requestNextTask() {
    if (this.done || getShouldStop()) {
      return null;
    }

    final SVM svm = generateSVM();

    // advance
    this.currentConst += this.constStep;
    if (this.currentConst > this.constEnd) {
      this.currentConst = this.constBegin;
View Full Code Here

  }
 
  public void testFactorySVM() {
    String architecture = "?->C(KERNEL=RBF,TYPE=NEW)->?";
    MLMethodFactory factory = new MLMethodFactory();
    SVM network = (SVM)factory.create(MLMethodFactory.TYPE_SVM, architecture, 4, 1);
    Assert.assertEquals(4,network.getInputCount());
    Assert.assertEquals(1,network.getOutputCount());
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.svm.SVM

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.