Holds input data and the CSV row for a cluster item.
Inheritance: Encog.ML.Data.Basic.BasicMLDataPair
Example #1
0
        /// <summary>
        /// Analyze the data. This counts the records and prepares the data to be
        /// processed.
        /// </summary>
        ///
        /// <param name="theAnalyst">The analyst to use.</param>
        /// <param name="inputFile">The input file to analyze.</param>
        /// <param name="headers">True, if the input file has headers.</param>
        /// <param name="format">The format of the input file.</param>
        public void Analyze(EncogAnalyst theAnalyst,
                            FileInfo inputFile, bool headers, CSVFormat format)
        {
            InputFilename      = inputFile;
            ExpectInputHeaders = headers;
            InputFormat        = format;

            Analyzed = true;
            _analyst = theAnalyst;

            if (OutputFormat == null)
            {
                OutputFormat = InputFormat;
            }

            _data = new BasicMLDataSet();
            ResetStatus();
            int recordCount = 0;

            int outputLength = _analyst.DetermineTotalColumns();
            var csv          = new ReadCSV(InputFilename.ToString(),
                                           ExpectInputHeaders, InputFormat);

            ReadHeaders(csv);

            _analystHeaders = new CSVHeaders(InputHeadings);

            while (csv.Next() && !ShouldStop())
            {
                UpdateStatus(true);

                var row = new LoadedRow(csv, 1);

                double[] inputArray = AnalystNormalizeCSV.ExtractFields(
                    _analyst, _analystHeaders, csv, outputLength, true);
                var input = new ClusterRow(inputArray, row);
                _data.Add(input);

                recordCount++;
            }
            RecordCount = recordCount;
            Count       = csv.ColumnCount;

            ReadHeaders(csv);
            csv.Close();
            ReportDone(true);
        }
        /// <summary>
        /// Analyze the data. This counts the records and prepares the data to be
        /// processed.
        /// </summary>
        ///
        /// <param name="theAnalyst">The analyst to use.</param>
        /// <param name="inputFile">The input file to analyze.</param>
        /// <param name="headers">True, if the input file has headers.</param>
        /// <param name="format">The format of the input file.</param>
        public void Analyze(EncogAnalyst theAnalyst,
            FileInfo inputFile, bool headers, CSVFormat format)
        {
            InputFilename = inputFile;
            ExpectInputHeaders = headers;
            Format = format;

            Analyzed = true;
            _analyst = theAnalyst;

            _data = new BasicMLDataSet();
            ResetStatus();
            int recordCount = 0;

            int outputLength = _analyst.DetermineTotalColumns();
            var csv = new ReadCSV(InputFilename.ToString(),
                                  ExpectInputHeaders, Format);
            ReadHeaders(csv);

            _analystHeaders = new CSVHeaders(InputHeadings);

            while (csv.Next() && !ShouldStop())
            {
                UpdateStatus(true);

                var row = new LoadedRow(csv, 1);

                double[] inputArray = AnalystNormalizeCSV.ExtractFields(
                    _analyst, _analystHeaders, csv, outputLength, true);
                var input = new ClusterRow(inputArray, row);
                _data.Add(input);

                recordCount++;
            }
            RecordCount = recordCount;
            Count = csv.ColumnCount;

            ReadHeaders(csv);
            csv.Close();
            ReportDone(true);
        }
Example #3
0
 public void Analyze(EncogAnalyst theAnalyst, FileInfo inputFile, bool headers, CSVFormat format)
 {
     int num;
     int num2;
     ReadCSV dcsv;
     base.InputFilename = inputFile;
     if (0 == 0)
     {
         if ((((uint) headers) + ((uint) num2)) < 0)
         {
             goto Label_00CC;
         }
         base.ExpectInputHeaders = headers;
         base.InputFormat = format;
         if ((((uint) num) + ((uint) headers)) >= 0)
         {
             base.Analyzed = true;
             this._x554f16462d8d4675 = theAnalyst;
             if (base.OutputFormat == null)
             {
                 base.OutputFormat = base.InputFormat;
                 if (((uint) num2) < 0)
                 {
                     goto Label_007E;
                 }
             }
         }
     }
     goto Label_0184;
     Label_0044:
     base.RecordCount = num;
     base.Count = dcsv.ColumnCount;
     base.ReadHeaders(dcsv);
     dcsv.Close();
     base.ReportDone(true);
     if ((((uint) num2) | 0xfffffffe) != 0)
     {
         return;
     }
     goto Label_0184;
     Label_0074:
     if (!base.ShouldStop())
     {
         base.UpdateStatus(true);
         LoadedRow theRow = new LoadedRow(dcsv, 1);
         double[] input = AnalystNormalizeCSV.ExtractFields(this._x554f16462d8d4675, this._xc5416b6511261016, dcsv, num2, true);
         if ((((uint) num2) + ((uint) num)) >= 0)
         {
             ClusterRow inputData = new ClusterRow(input, theRow);
             this._x4a3f0a05c02f235f.Add(inputData);
             if ((((uint) num2) + ((uint) num2)) >= 0)
             {
                 num++;
                 if ((((uint) num2) & 0) == 0)
                 {
                     goto Label_007E;
                 }
                 goto Label_0074;
             }
             goto Label_00C5;
         }
         goto Label_011C;
     }
     goto Label_0044;
     Label_007E:
     if (dcsv.Next())
     {
         goto Label_0074;
     }
     goto Label_0044;
     Label_00C5:
     if (2 == 0)
     {
         goto Label_0074;
     }
     Label_00CC:
     this._xc5416b6511261016 = new CSVHeaders(base.InputHeadings);
     goto Label_007E;
     Label_011C:
     num2 = this._x554f16462d8d4675.DetermineTotalColumns();
     dcsv = new ReadCSV(base.InputFilename.ToString(), base.ExpectInputHeaders, base.InputFormat);
     base.ReadHeaders(dcsv);
     goto Label_00C5;
     Label_0184:
     this._x4a3f0a05c02f235f = new BasicMLDataSet();
     base.ResetStatus();
     if ((((uint) headers) - ((uint) num)) > uint.MaxValue)
     {
         goto Label_0044;
     }
     num = 0;
     goto Label_011C;
 }