Examples of MLMethod


Examples of org.encog.ml.MLMethod

  public MLMethod obtainMethod() {
    final String resourceID = getProp().getPropertyString(
        ScriptProperties.ML_CONFIG_MACHINE_LEARNING_FILE);
    final File resourceFile = getScript().resolveFilename(resourceID);

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

    if (!(method instanceof MLMethod)) {
      throw new AnalystError(
          "The object to be trained must be an instance of MLMethod. "
              + method.getClass().getSimpleName());
    }

    return method;
  }
View Full Code Here

Examples of org.encog.ml.MLMethod

    final int input = egb.getInputCount();
    final int ideal = egb.getIdealCount();
    egb.close();

    final MLMethodFactory factory = new MLMethodFactory();
    final MLMethod obj = factory.create(type, arch, input, ideal);

    if (obj instanceof BayesianNetwork) {
      final String query = getProp().getPropertyString(
          ScriptProperties.ML_CONFIG_QUERY);
      ((BayesianNetwork) obj).defineClassificationStructure(query);
View Full Code Here

Examples of org.encog.ml.MLMethod

  private void embedNetwork(final EncogProgramNode node) {
    addBreak();

    final File methodFile = (File) node.getArgs().get(0).getValue();

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

    if (!(method instanceof MLFactory)) {
      throw new EncogError("Code generation not yet supported for: "
          + method.getClass().getName());
    }

    final MLFactory factoryMethod = (MLFactory) method;

    final String methodName = factoryMethod.getFactoryType();
View Full Code Here

Examples of org.encog.ml.MLMethod

        MLTrainFactory.PROPERTY_POPULATION_SIZE, false, 5000);
   
    MLTrain train = new MLMethodGeneticAlgorithm(new MethodFactory(){
      @Override
      public MLMethod factor() {
        final MLMethod result = (MLMethod) ObjectCloner.deepCopy(method);
        ((MLResettable)result).reset();
        return result;
      }}, score, populationSize);

    return train;
View Full Code Here

Examples of org.encog.ml.MLMethod

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

    final File outputFile = getAnalyst().getScript().resolveFilename(
        outputID);
   
    MLMethod m = (MLMethod) EncogDirectoryPersistence.loadObject(resourceFile);
   
    if( !(m instanceof MLRegression) ) {
      throw new AnalystError("The evaluate raw command can only be used with regression.");
    }
View Full Code Here

Examples of org.encog.ml.MLMethod

    final ScriptProperties prop = this.encogAnalyst.getScript().getProperties();
    final String resourceID = prop.getPropertyString(
        ScriptProperties.ML_CONFIG_MACHINE_LEARNING_FILE);
    final File resourceFile = this.encogAnalyst.getScript().resolveFilename(resourceID);

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

    if (!(method instanceof MLMethod)) {
      throw new AnalystError(
          "The object to be trained must be an instance of MLMethod. "
              + method.getClass().getSimpleName());
    }

    return method;
  }
View Full Code Here

Examples of org.encog.ml.MLMethod

    double e = calculateError();
    Assert.assertTrue(e<targetError);
  }
 
  public double calculateError() {
    MLMethod method = obtainMethod();
    MLDataSet data = obtainTrainingSet();
    return ((MLError)method).calculateError(data);
  }
View Full Code Here

Examples of org.encog.ml.MLMethod

    // try rewrite
    this.rules.rewrite(g);

    // decode
    final MLMethod phenotype = getCODEC().decode(g);
    double score;

    // deal with invalid decode
    if (phenotype == null) {
      if (getBestComparator().shouldMinimize()) {
View Full Code Here

Examples of org.encog.ml.MLMethod

  /**
   * Perform the task.
   */
  @Override
  public void run() {
    MLMethod phenotype = this.owner.getCodec().decode(this.genome);
    if (phenotype != null) {
      double score;
      try {
        score = this.scoreFunction.calculateScore(phenotype);
      } catch(EARuntimeError e) {
View Full Code Here

Examples of org.encog.ml.MLMethod

   * @param k The number of folds total.
   * @param foldNum The current fold.
   * @param fold The current fold.
   */
  private void fitFold(int k, int foldNum, DataFold fold) {
    MLMethod method = this.createMethod();
    MLTrain train = this.createTrainer(method, fold.getTraining());

    if (train.getImplementationType() == TrainingImplementationType.Iterative) {
      SimpleEarlyStoppingStrategy earlyStop = new SimpleEarlyStoppingStrategy(
          fold.getValidation());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.