Reputation: 326
I am doing encog equilateral normalization. My code for encog analyst looks like this:
'Analyst
Dim analyst = New EncogAnalyst()
'Wizard
Dim wizard = New AnalystWizard(analyst)
Dim BaseFile As FileInfo = FileUtil.CombinePath(New FileInfo(CSV_EXPORTS_PATH), 'baseFile.csv')
wizard.Wizard(BaseFile, True, AnalystFileFormat.DecpntComma)
While my base file does not contain all the classes of one of the input columns at index 8 so, I normalized by adding all classes before performing equilateral normalization like this:
analyst.Script.Normalize.NormalizedFields(8).Classes.Clear()
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_1",0))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_2",1))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_3",2))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_4",3))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_5",4))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_6",5))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_7",6))
analyst.Script.Normalize.NormalizedFields(8).Classes.Add(New Encog.Util.Arrayutil.ClassItem("CLASS_8",7))
analyst.Script.Normalize.NormalizedFields(8).Output = False
analyst.Script.Normalize.NormalizedFields(8).Action = Encog.Util.Arrayutil.NormalizationAction.Equilateral
However, when I save my analyst file,
'save the analyst file
analyst.Save(AnalystFile)
I get only those classes that were in the base file, the segment from ega file looks like this:
[DATA:CLASSES]
"field","code","name"
"TYPE_CLASS","CLASS_3","CLASS_3",1
"TYPE_CLASS","CLASS_2","CLASS_2",12
"TYPE_CLASS","CLASS_6","CLASS_6",33
"TYPE_CLASS","CLASS_8","CLASS_8",1
Thus, when I load this .ega file again, and if the input contains some class other then CLASS_3, CLASS_2, CLASS_6, CLASS_8, I get an error saying Can't determine class for: CLASS_1
I want encog analyst to save all the classes that I feed it manually , not just those that were in the base file. How do I do it?
Upvotes: 0
Views: 149
Reputation: 1443
I'm able to generate the extra [DATA:CLASSES] using code like this (parden my C# code, I'm not a VB programmer):
analyst.Script.Fields[8].ClassMembers.Clear();
analyst.Script.Fields[8].ClassMembers.Add(new Encog.App.Analyst.Script.AnalystClassItem("CLASS_1", "CLASS_1", 0));
analyst.Script.Fields[8].ClassMembers.Add(new Encog.App.Analyst.Script.AnalystClassItem("CLASS_2", "CLASS_2", 1));
analyst.Script.Fields[8].ClassMembers.Add(new Encog.App.Analyst.Script.AnalystClassItem("CLASS_3", "CLASS_3", 2));
analyst.Script.Fields[8].ClassMembers.Add(new Encog.App.Analyst.Script.AnalystClassItem("CLASS_4", "CLASS_4", 3));
But I think you would be much better off if you used a data file with fake rows for the missing values. Since you are likely going to create a bunch more data files anyway to do some segregation of data (training, cross-validation, testing), and also create normalized files, I don't think adding an extra file with a few extra nonsense rows is going to be too obtrusive.
Upvotes: 1