Skip to content

Workbench: Analyst generates C# code that doesn't compile #145

@PetrToman

Description

@PetrToman

Workbench has an option to generate a basic code skeleton, which looks like this:

using Encog.ML;
using Encog.ML.Data;
using Encog.Util.Simple;

namespace EncogGenerated
{
    // Code generated by Encog v3.2.0
    // Generation Date: Thu Jul 25 07:01:56 CEST 2013
    // Generated code may be used freely
    // http://www.heatonresearch.com/encog
    public class EncogExample
    {

        public static MLDataSet createTraining() {
            IMLDataSet result = EncogUtility.LoadEGB2Memory(new File("C:\data_train.egb"));
            return result;
        }

        public static IMLMethod createNetwork()
        {
            IMLMethod result = (IMLMethod)EncogDirectoryPersistence.LoadObject(new File("C:\data_train.eg"));
            return result;
        }

        static void Main(string[] args)
        {

            IMLMethod method = createNetwork();

            IMLDataSet training = createTraining();
            // Network and/or data is now loaded, you can add code to train, evaluate, etc.
        }
    }
}

...but there are several errors:

  • incomplete "using" statements
  • File used instead of FileInfo
  • missing "@" before path strings
  • wrong return type of createTraining() - should be IMLDataSet
  • method names should begin with an upper case character (C# coding standard)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions