/// <summary>
        ///     Analyze the file.
        /// </summary>
        private void AnalyzeFile()
        {
            ScriptProperties prop = _analyst.Script.Properties;

            // get filenames, headers & format
            String sourceID = prop.GetPropertyString(
                ScriptProperties.HeaderDatasourceRawFile);

            FileInfo  sourceFile = _analyst.Script.ResolveFilename(sourceID);
            CSVFormat format     = _analyst.Script.DetermineFormat();
            bool      headers    = _analyst.Script.ExpectInputHeaders(sourceID);

            // read the file
            _rowCount     = 0;
            _missingCount = 0;

            var csv = new ReadCSV(sourceFile.ToString(), headers, format);

            while (csv.Next())
            {
                _rowCount++;
                if (csv.HasMissing())
                {
                    _missingCount++;
                }
            }
            csv.Close();
        }
예제 #2
0
        /**
         * Obtain the training set.
         * @return The training set.
         */

        private IMLDataSet ObtainTrainingSet()
        {
            ScriptProperties prop       = EncogAnalyst.Script.Properties;
            String           trainingID = prop.GetPropertyString(
                ScriptProperties.MlConfigTrainingFile);

            FileInfo trainingFile = EncogAnalyst.Script.ResolveFilename(trainingID);

            IMLDataSet trainingSet = EncogUtility.LoadEGB2Memory(trainingFile);

            return(trainingSet);
        }
예제 #3
0
        /**
         * Obtain the ML method.
         * @return The method.
         */

        public IMLMethod ObtainMethod()
        {
            ScriptProperties prop       = EncogAnalyst.Script.Properties;
            String           resourceID = prop.GetPropertyString(
                ScriptProperties.MlConfigMachineLearningFile);
            FileInfo resourceFile = EncogAnalyst.Script.ResolveFilename(resourceID);

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

            if (!(method is IMLMethod))
            {
                throw new AnalystError(
                          "The object to be trained must be an instance of MLMethod. "
                          + method.GetType().Name);
            }

            return(method);
        }