Analyze() public method

Analyze the data. This counts the records and prepares the data to be processed.
public Analyze ( EncogAnalyst theAnalyst, FileInfo inputFile, bool headers, CSVFormat format ) : void
theAnalyst EncogAnalyst The analyst to use.
inputFile System.IO.FileInfo The input file.
headers bool True if headers are present.
format Encog.Util.CSV.CSVFormat The format the file is in.
return void
        /// <inheritdoc />
        public override sealed bool ExecuteCommand(String args)
        {
            // get filenames
            String evalID = Prop.GetPropertyString(
                ScriptProperties.MlConfigEvalFile);
            String resourceID = Prop.GetPropertyString(
                ScriptProperties.MlConfigMachineLearningFile);

            String outputID = Prop.GetPropertyString(
                ScriptProperties.MlConfigOutputFile);

            EncogLogging.Log(EncogLogging.LevelDebug, "Beginning evaluate raw");
            EncogLogging.Log(EncogLogging.LevelDebug, "evaluate file:" + evalID);
            EncogLogging.Log(EncogLogging.LevelDebug, "resource file:"
                                                      + resourceID);

            FileInfo evalFile = Script.ResolveFilename(evalID);
            FileInfo resourceFile = Script.ResolveFilename(resourceID);

            FileInfo outputFile = Analyst.Script.ResolveFilename(
                outputID);

            var m = (IMLMethod) EncogDirectoryPersistence.LoadObject(resourceFile);

            if (!(m is IMLRegression))
            {
                throw new AnalystError("The evaluate raw command can only be used with regression.");
            }

            var method = (IMLRegression) m;

            bool headers = Script.ExpectInputHeaders(evalID);

            var eval = new AnalystEvaluateRawCSV {Script = Script};
            Analyst.CurrentQuantTask = eval;
            eval.Report = new AnalystReportBridge(Analyst);
            eval.Analyze(Analyst, evalFile, headers, Prop
                                                         .GetPropertyCSVFormat(ScriptProperties.SetupConfigCSVFormat));
            eval.Process(outputFile, method);
            Analyst.CurrentQuantTask = null;
            return eval.ShouldStop();
        }
Beispiel #2
0
 public override sealed bool ExecuteCommand(string args)
 {
     string str2;
     string str3;
     FileInfo info;
     FileInfo info2;
     FileInfo info3;
     IMLRegression regression;
     bool flag;
     AnalystEvaluateRawCSV wcsv;
     string propertyString = base.Prop.GetPropertyString("ML:CONFIG_evalFile");
     goto Label_0169;
     Label_0016:
     wcsv.Process(info3, regression);
     Label_0021:
     base.Analyst.CurrentQuantTask = null;
     if (((uint) flag) <= uint.MaxValue)
     {
         if ((((uint) flag) + ((uint) flag)) >= 0)
         {
             return wcsv.ShouldStop();
         }
         if ((((uint) flag) & 0) == 0)
         {
             goto Label_0169;
         }
         goto Label_010D;
     }
     Label_008D:
     info3 = base.Analyst.Script.ResolveFilename(str3);
     regression = (IMLRegression) EncogDirectoryPersistence.LoadObject(info2);
     flag = base.Script.ExpectInputHeaders(propertyString);
     wcsv = new AnalystEvaluateRawCSV {
         Script = base.Script
     };
     if (0 != 0)
     {
         goto Label_0016;
     }
     base.Analyst.CurrentQuantTask = wcsv;
     wcsv.Report = new AnalystReportBridge(base.Analyst);
     wcsv.Analyze(base.Analyst, info, flag, base.Prop.GetPropertyCSVFormat("SETUP:CONFIG_csvFormat"));
     if (-1 != 0)
     {
         goto Label_0016;
     }
     goto Label_008D;
     Label_010D:
     if ((((uint) flag) - ((uint) flag)) > uint.MaxValue)
     {
         goto Label_018B;
     }
     info2 = base.Script.ResolveFilename(str2);
     goto Label_008D;
     Label_0169:
     str2 = base.Prop.GetPropertyString("ML:CONFIG_machineLearningFile");
     str3 = base.Prop.GetPropertyString("ML:CONFIG_outputFile");
     Label_018B:
     EncogLogging.Log(0, "Beginning evaluate raw");
     if (((uint) flag) > uint.MaxValue)
     {
         goto Label_0021;
     }
     EncogLogging.Log(0, "evaluate file:" + propertyString);
     EncogLogging.Log(0, "resource file:" + str2);
     info = base.Script.ResolveFilename(propertyString);
     goto Label_010D;
 }