Package org.encog.workbench.dialogs.training

Examples of org.encog.workbench.dialogs.training.TrainDialog


    this.parentTab = parentTab;
  }

  public void performTrain() {

    TrainDialog dialog = new TrainDialog(EncogWorkBench.getInstance()
        .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);
View Full Code Here

TOP

Related Classes of org.encog.workbench.dialogs.training.TrainDialog

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.