Package org.encog.ml

Examples of org.encog.ml.MLMethod


  public void performEvaluate() {
    try {
      EvaluateDialog dialog = new EvaluateDialog(EncogWorkBench
          .getInstance().getMainWindow());
      if (dialog.process()) {
        MLMethod method = dialog.getNetwork();
        MLDataSet training = dialog.getTrainingSet();

        double error = 0;

        if (method instanceof MLError) {
          error = ((MLError) method).calculateError(training);
          EncogWorkBench.displayMessage("Error For this Network", ""
              + Format.formatPercent(error));

        } else {
          EncogWorkBench.displayError("Error",
              "The Machine Learning method "
                  + method.getClass().getSimpleName()
                  + " does not support error calculation.");
        }
      }
    } catch (Throwable t) {
      EncogWorkBench.displayError("Error Evaluating Network", t);
View Full Code Here


      while (!this.cancel) {
        this.iteration++;
        this.lastError = this.train.getError();

        if (this.resetOption.get() != -1) {
          MLMethod method = null;
         
          if( getEncogObject() instanceof ProjectEGFile ) {
            method = (MLMethod)((ProjectEGFile)getEncogObject()).getObject();
          }
         
View Full Code Here

   
    MLDataSet trainingData = generateTraining(INPUT_OUTPUT_COUNT, COMPL);
   
    for(int i=0;i<TRIES;i++) {
   
      MLMethod method = EncogUtility.simpleFeedForward(INPUT_OUTPUT_COUNT,
          HIDDEN_COUNT, 0, INPUT_OUTPUT_COUNT, false);
     
      Propagation train = new Backpropagation((ContainsFlat)method, trainingData,1.7,0);
      //Propagation train = new ResilientPropagation((ContainsFlat)method, trainingData);
      ((Propagation)train).fixFlatSpot(true);
View Full Code Here

 
  public void process(String methodName, String methodArchitecture,String trainerName, String trainerArgs,int outputNeurons) {
   
    // first, create the machine learning method
    MLMethodFactory methodFactory = new MLMethodFactory();   
    MLMethod method = methodFactory.create(methodName, methodArchitecture, 2, outputNeurons);
   
    // second, create the data set   
    MLDataSet dataSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
   
    // third, create the trainer
View Full Code Here

  }

  public void reportTraining(MLTrain train) {
    // reset if needed
    if (this.resetOption.get() != -1) {
      MLMethod method = this.analyst.getMethod();
           
      if( method==null )
      {
        this.resetOption.set(-1);
        EncogWorkBench.displayError("Error", "This machine learning method cannot be reset or randomized.");
View Full Code Here

        .getMainWindow());
    if (mlMethod != null)
      dialog.setMethod(mlMethod);

    if (dialog.process()) {
      MLMethod method = dialog.getNetwork();
      MLDataSet trainingData = dialog.getTrainingSet();

      if (method == null) {
        EncogWorkBench.displayError("Error",
            "Machine language method is required to train.");
        return;
      }

      if (method instanceof ART1) {
        EncogWorkBench
            .displayError("Error",
                "ART1 Networks are not trained, they learn as they are queried.");
        return;
      }

      if (trainingData == null) {
        EncogWorkBench.displayError("Error",
            "Training set is required to train.");
        return;
      }

      if (method instanceof HopfieldNetwork) {
        HopfieldNetwork hp = (HopfieldNetwork) method;
        ProjectEGFile file = (ProjectEGFile) dialog.getComboNetwork()
            .getSelectedValue();
        for (MLDataPair pair : trainingData) {
          hp.addPattern(pair.getInput());
        }
        if (EncogWorkBench.askQuestion("Hopfield",
            "Training done, save?")) {
          file.save();
        }
      } else if (method instanceof SOM) {
        ProjectEGFile file = (ProjectEGFile) dialog.getComboNetwork()
            .getSelectedValue();
        performSOM(file, trainingData);
      } else if (method instanceof SVM) {
        ProjectEGFile file = (ProjectEGFile) dialog.getComboNetwork()
            .getSelectedValue();
        performSVM(file, trainingData);
      } else if (method instanceof CPN) {
        ProjectEGFile file = (ProjectEGFile) dialog.getComboNetwork()
            .getSelectedValue();
        performCPN(file, trainingData);
      } else if (method instanceof BasicNetwork || method instanceof RBFNetwork ) {

        ChooseBasicNetworkTrainingMethod choose = new ChooseBasicNetworkTrainingMethod(
            EncogWorkBench.getInstance().getMainWindow(),method);
        if (choose.process()) {
          ProjectEGFile file = (ProjectEGFile) dialog
              .getComboNetwork().getSelectedValue();

          switch (choose.getType()) {
          case SCG:
            performSCG(file, trainingData);
            break;
          case PropagationResilient:
            performRPROP(file, trainingData);
            break;
          case PropagationBack:
            performBPROP(file, trainingData);
            break;
          case PropagationManhattan:
            performManhattan(file, trainingData);
            break;
          case LevenbergMarquardt:
            performLMA(file, trainingData);
            break;
          case Genetic:
            performGenetic(file, trainingData);
            break;
          case Annealing:
            performAnnealing(file, trainingData);
            break;
          case ADALINE:
            performADALINE(file, trainingData);
            break;
          case PropagationQuick:
            performQPROP(file, trainingData);
            break;
          }
        }
      } else {
        EncogWorkBench.displayError("Unknown Method",
            "No training method is available for: "
                + method.getClass().getName());
      }
    }
  }
View Full Code Here

import org.encog.workbench.tabs.incremental.IncrementalPruneTab;

public class CreateNeuralNetwork {

  public static void process(File path) {
    MLMethod network = null;
    CreateNeuralNetworkDialog dialog = new CreateNeuralNetworkDialog(
        EncogWorkBench.getInstance().getMainWindow());
    dialog.setType(NeuralNetworkType.Feedforward);
    if (dialog.process()) {
      switch (dialog.getType()) {
View Full Code Here

   */
  public final MLMethod create(final String methodType,
      final String architecture, final int input, final int output) {
    for (EncogPluginBase plugin : Encog.getInstance().getPlugins()) {
      if (plugin instanceof EncogPluginService1) {
        MLMethod result = ((EncogPluginService1) plugin).createMethod(
            methodType, architecture, input, output);
        if (result != null) {
          return result;
        }
      }
View Full Code Here

    final File resourceFile = getScript().resolveFilename(resourceID);

    final File outputFile = getAnalyst().getScript().resolveFilename(
        outputID);

    final MLMethod method = (MLMethod) EncogDirectoryPersistence
        .loadObject(resourceFile);

    final boolean headers = getScript().expectInputHeaders(evalID);

    final AnalystEvaluateCSV eval = new AnalystEvaluateCSV();
View Full Code Here

  @Override
  public final boolean executeCommand(final String args) {

    this.kfold = obtainCross();
    final MLDataSet trainingSet = obtainTrainingSet();
    MLMethod method = obtainMethod();
    final MLTrain trainer = createTrainer(method, trainingSet);
   
    EncogLogging.log(EncogLogging.LEVEL_DEBUG, "Beginning training");

    performTraining(trainer, method, trainingSet);
View Full Code Here

TOP

Related Classes of org.encog.ml.MLMethod

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.