Used by the analyst to cluster a CSV file.
Inheritance: Encog.App.Analyst.CSV.Basic.BasicFile
        /// <inheritdoc/>
        public override sealed bool ExecuteCommand(String args)
        {
            // get filenames
            String sourceID = Prop.GetPropertyString(
                ScriptProperties.ClusterConfigSourceFile);
            String targetID = Prop.GetPropertyString(
                ScriptProperties.ClusterConfigTargetFile);
            int clusters = Prop.GetPropertyInt(
                ScriptProperties.ClusterConfigClusters);
            Prop.GetPropertyString(ScriptProperties.ClusterConfigType);

            EncogLogging.Log(EncogLogging.LevelDebug, "Beginning cluster");
            EncogLogging.Log(EncogLogging.LevelDebug, "source file:" + sourceID);
            EncogLogging.Log(EncogLogging.LevelDebug, "target file:" + targetID);
            EncogLogging.Log(EncogLogging.LevelDebug, "clusters:" + clusters);

            FileInfo sourceFile = Script.ResolveFilename(sourceID);
            FileInfo targetFile = Script.ResolveFilename(targetID);

            // get formats
            CSVFormat inputFormat = Script
                .DetermineInputFormat(sourceID);
            CSVFormat outputFormat = Script.DetermineOutputFormat();

            // mark generated
            Script.MarkGenerated(targetID);

            // prepare to normalize
            var cluster = new AnalystClusterCSV {Script = Script};
            Analyst.CurrentQuantTask = cluster;
            cluster.Report = new AnalystReportBridge(Analyst);
            bool headers = Script.ExpectInputHeaders(sourceID);
            cluster.Analyze(Analyst, sourceFile, headers, inputFormat);
            cluster.OutputFormat = outputFormat;
            cluster.Process(targetFile, clusters, Analyst, DefaultIterations);
            Analyst.CurrentQuantTask = null;
            return cluster.ShouldStop();
        }
Example #2
0
 public override sealed bool ExecuteCommand(string args)
 {
     string str2;
     int propertyInt;
     FileInfo info;
     FileInfo info2;
     CSVFormat format;
     CSVFormat format2;
     AnalystClusterCSV rcsv;
     AnalystClusterCSV rcsv2;
     string propertyString = base.Prop.GetPropertyString("CLUSTER:CONFIG_sourceFile");
     goto Label_019A;
     Label_0039:
     rcsv.Report = new AnalystReportBridge(base.Analyst);
     bool headers = base.Script.ExpectInputHeaders(propertyString);
     rcsv.Analyze(base.Analyst, info, headers, format);
     rcsv.OutputFormat = format2;
     rcsv.Process(info2, propertyInt, base.Analyst, 100);
     if (0 == 0)
     {
         base.Analyst.CurrentQuantTask = null;
         return rcsv.ShouldStop();
     }
     Label_0094:
     rcsv2 = new AnalystClusterCSV();
     rcsv2.Script = base.Script;
     rcsv = rcsv2;
     base.Analyst.CurrentQuantTask = rcsv;
     goto Label_0039;
     Label_00BB:
     format = base.Script.DetermineInputFormat(propertyString);
     if ((((uint) propertyInt) + ((uint) propertyInt)) >= 0)
     {
         format2 = base.Script.DetermineOutputFormat();
         base.Script.MarkGenerated(str2);
         goto Label_0094;
     }
     Label_00E5:
     info2 = base.Script.ResolveFilename(str2);
     if (0 == 0)
     {
         goto Label_00BB;
     }
     goto Label_0039;
     Label_019A:
     str2 = base.Prop.GetPropertyString("CLUSTER:CONFIG_targetFile");
     propertyInt = base.Prop.GetPropertyInt("CLUSTER:CONFIG_clusters");
     Label_011F:
     base.Prop.GetPropertyString("CLUSTER:CONFIG_type");
     if ((((uint) propertyInt) - ((uint) propertyInt)) < 0)
     {
         goto Label_00BB;
     }
     EncogLogging.Log(0, "Beginning cluster");
     EncogLogging.Log(0, "source file:" + propertyString);
     EncogLogging.Log(0, "target file:" + str2);
     EncogLogging.Log(0, "clusters:" + propertyInt);
     info = base.Script.ResolveFilename(propertyString);
     if (((uint) propertyInt) <= uint.MaxValue)
     {
         if (-1 != 0)
         {
             goto Label_00E5;
         }
     }
     else
     {
         goto Label_011F;
     }
     goto Label_019A;
 }