Encog :"The Machine Learning Method has an input length of 7, but the training has 0" error

381 views Asked by At

I'm currently having a project in which I use ENcog(.net) to classify emg signal, the features is already extracted, when I try to train it, it gets error as the title says. Here is the code I use :

        BasicNetwork JST = new BasicNetwork();
        JST.AddLayer(new BasicLayer(7));
        JST.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 10));
        JST.AddLayer(new BasicLayer(new ActivationLinear(), true, 4));
        JST.Structure.FinalizeStructure();
        JST.Reset();

        openFileDialog1.Title = "Open Feature File...";
        openFileDialog1.FileName = "";
        openFileDialog1.Filter = "CSV (comma delimited)|*.csv|All Files|*.*";
        if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
        {
            MessageBox.Show("Choice Cancelled");
        }
        else
        {
            IVersatileDataSource data = new CSVDataSource(openFileDialog1.FileName, false, CSVFormat.DecimalComma);
            var InputJST = new VersatileMLDataSet(data);
            InputJST.DefineSourceColumn("MAV", 0, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            InputJST.DefineSourceColumn("RMS", 1, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            InputJST.DefineSourceColumn("VAR", 2, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            InputJST.DefineSourceColumn("SD", 3, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            InputJST.DefineSourceColumn("WL", 4, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            InputJST.DefineSourceColumn("ZC", 5, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            InputJST.DefineSourceColumn("SSC", 6, Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
            ColumnDefinition outputColumn = InputJST.DefineSourceColumn("Arrow", 7, ColumnType.Nominal);
            InputJST.DefineSingleOutputOthersInput(outputColumn);
            InputJST.Analyze();

            var model = new EncogModel(InputJST);
            model.SelectMethod(InputJST, MLMethodFactory.TypeFeedforward);
            InputJST.Normalize();

            var train = new LevenbergMarquardtTraining(JST, InputJST);

My question is why the dataset have Inputsize and idealsize 0, eventhough the calculated size is correct?

Thanks.

1

There are 1 answers

0
f thecatrock On

After buzzing around with the codes, I do get the solutions, simply save the normalized dataset into csv, then reload it back with csvmldataset.

If everybody wonders why not using the csv normalizer, because the result is undesired (equilateral).

PS : Anybody who have other solution is still apreciated, thanks.