Encog training data input size is 0 but calculated input size is 5












0















Just as the title suggests I am receiving the error "The machine learning method has an input length of 5, but the training data has 0. They must be the same." because my input size is 0 for the training data, but the calculated input size is 5 (this is correct). The code used for reading the csv file and storing it as a dataset:



        //Get file path.
var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
path = path.Replace("file:\", "");
IVersatileDataSource source = new CSVDataSource(path + @"enpcsv.csv", false, CSVFormat.DecimalPoint);

//Setup training dataset.
var data = new VersatileMLDataSet(source);
data.DefineSourceColumn("A", 0, ColumnType.Continuous);
data.DefineSourceColumn("B", 1, ColumnType.Continuous);
data.DefineSourceColumn("C", 2, ColumnType.Continuous);
data.DefineSourceColumn("D", 3, ColumnType.Continuous);
data.DefineSourceColumn("E", 4, ColumnType.Continuous);
ColumnDefinition outputColumn = data.DefineSourceColumn("F", 5, ColumnType.Nominal);

data.Analyze();
data.DefineSingleOutputOthersInput(outputColumn);

data.Normalize();

//Setup network
BasicNetwork network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 5)); //Input.
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 10)); //Hidden.
network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1)); //Output.
network.Structure.FinalizeStructure();
network.Reset();

//Train.
IMLTrain learner = new Backpropagation(network, data);


Another point may be that similar to the input size the ideal size is 0 but the calculated ideal size is 6 which should not be the case as I have set one ideal. I have seen one solution to this problem where they are saving the dataset as a csv and then reading it again: Encog :"The Machine Learning Method has an input length of 7, but the training has 0" error
This seems like poor practice so I am looking to see if someone knows another solution or can call out an error in my code, thanks for your time.










share|improve this question



























    0















    Just as the title suggests I am receiving the error "The machine learning method has an input length of 5, but the training data has 0. They must be the same." because my input size is 0 for the training data, but the calculated input size is 5 (this is correct). The code used for reading the csv file and storing it as a dataset:



            //Get file path.
    var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
    path = path.Replace("file:\", "");
    IVersatileDataSource source = new CSVDataSource(path + @"enpcsv.csv", false, CSVFormat.DecimalPoint);

    //Setup training dataset.
    var data = new VersatileMLDataSet(source);
    data.DefineSourceColumn("A", 0, ColumnType.Continuous);
    data.DefineSourceColumn("B", 1, ColumnType.Continuous);
    data.DefineSourceColumn("C", 2, ColumnType.Continuous);
    data.DefineSourceColumn("D", 3, ColumnType.Continuous);
    data.DefineSourceColumn("E", 4, ColumnType.Continuous);
    ColumnDefinition outputColumn = data.DefineSourceColumn("F", 5, ColumnType.Nominal);

    data.Analyze();
    data.DefineSingleOutputOthersInput(outputColumn);

    data.Normalize();

    //Setup network
    BasicNetwork network = new BasicNetwork();
    network.AddLayer(new BasicLayer(null, true, 5)); //Input.
    network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 10)); //Hidden.
    network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1)); //Output.
    network.Structure.FinalizeStructure();
    network.Reset();

    //Train.
    IMLTrain learner = new Backpropagation(network, data);


    Another point may be that similar to the input size the ideal size is 0 but the calculated ideal size is 6 which should not be the case as I have set one ideal. I have seen one solution to this problem where they are saving the dataset as a csv and then reading it again: Encog :"The Machine Learning Method has an input length of 7, but the training has 0" error
    This seems like poor practice so I am looking to see if someone knows another solution or can call out an error in my code, thanks for your time.










    share|improve this question

























      0












      0








      0








      Just as the title suggests I am receiving the error "The machine learning method has an input length of 5, but the training data has 0. They must be the same." because my input size is 0 for the training data, but the calculated input size is 5 (this is correct). The code used for reading the csv file and storing it as a dataset:



              //Get file path.
      var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
      path = path.Replace("file:\", "");
      IVersatileDataSource source = new CSVDataSource(path + @"enpcsv.csv", false, CSVFormat.DecimalPoint);

      //Setup training dataset.
      var data = new VersatileMLDataSet(source);
      data.DefineSourceColumn("A", 0, ColumnType.Continuous);
      data.DefineSourceColumn("B", 1, ColumnType.Continuous);
      data.DefineSourceColumn("C", 2, ColumnType.Continuous);
      data.DefineSourceColumn("D", 3, ColumnType.Continuous);
      data.DefineSourceColumn("E", 4, ColumnType.Continuous);
      ColumnDefinition outputColumn = data.DefineSourceColumn("F", 5, ColumnType.Nominal);

      data.Analyze();
      data.DefineSingleOutputOthersInput(outputColumn);

      data.Normalize();

      //Setup network
      BasicNetwork network = new BasicNetwork();
      network.AddLayer(new BasicLayer(null, true, 5)); //Input.
      network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 10)); //Hidden.
      network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1)); //Output.
      network.Structure.FinalizeStructure();
      network.Reset();

      //Train.
      IMLTrain learner = new Backpropagation(network, data);


      Another point may be that similar to the input size the ideal size is 0 but the calculated ideal size is 6 which should not be the case as I have set one ideal. I have seen one solution to this problem where they are saving the dataset as a csv and then reading it again: Encog :"The Machine Learning Method has an input length of 7, but the training has 0" error
      This seems like poor practice so I am looking to see if someone knows another solution or can call out an error in my code, thanks for your time.










      share|improve this question














      Just as the title suggests I am receiving the error "The machine learning method has an input length of 5, but the training data has 0. They must be the same." because my input size is 0 for the training data, but the calculated input size is 5 (this is correct). The code used for reading the csv file and storing it as a dataset:



              //Get file path.
      var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
      path = path.Replace("file:\", "");
      IVersatileDataSource source = new CSVDataSource(path + @"enpcsv.csv", false, CSVFormat.DecimalPoint);

      //Setup training dataset.
      var data = new VersatileMLDataSet(source);
      data.DefineSourceColumn("A", 0, ColumnType.Continuous);
      data.DefineSourceColumn("B", 1, ColumnType.Continuous);
      data.DefineSourceColumn("C", 2, ColumnType.Continuous);
      data.DefineSourceColumn("D", 3, ColumnType.Continuous);
      data.DefineSourceColumn("E", 4, ColumnType.Continuous);
      ColumnDefinition outputColumn = data.DefineSourceColumn("F", 5, ColumnType.Nominal);

      data.Analyze();
      data.DefineSingleOutputOthersInput(outputColumn);

      data.Normalize();

      //Setup network
      BasicNetwork network = new BasicNetwork();
      network.AddLayer(new BasicLayer(null, true, 5)); //Input.
      network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 10)); //Hidden.
      network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1)); //Output.
      network.Structure.FinalizeStructure();
      network.Reset();

      //Train.
      IMLTrain learner = new Backpropagation(network, data);


      Another point may be that similar to the input size the ideal size is 0 but the calculated ideal size is 6 which should not be the case as I have set one ideal. I have seen one solution to this problem where they are saving the dataset as a csv and then reading it again: Encog :"The Machine Learning Method has an input length of 7, but the training has 0" error
      This seems like poor practice so I am looking to see if someone knows another solution or can call out an error in my code, thanks for your time.







      c# machine-learning neural-network artificial-intelligence encog






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 20:04









      HelloPleaseHelpHelloPleaseHelp

      34




      34
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307972%2fencog-training-data-input-size-is-0-but-calculated-input-size-is-5%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307972%2fencog-training-data-input-size-is-0-but-calculated-input-size-is-5%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine