public static IMLDataSet LoadAndNormalizeData(FileInfo fileInfo, AnalystGoal problemType, NormalizationAction normalizationType, bool randomize = true)
        {
            var analyst = new EncogAnalyst();
            var wizard = new AnalystWizard(analyst);
            wizard.Goal = problemType;
            wizard.Wizard(fileInfo, true, AnalystFileFormat.DecpntComma);
            var fields = analyst.Script.Normalize.NormalizedFields;

            if (problemType == AnalystGoal.Classification)
                fields[fields.Count - 1].Action = normalizationType;

            var norm = new AnalystNormalizeCSV();
            norm.Analyze(fileInfo, true, CSVFormat.DecimalPoint, analyst);

            var normalizedDataFileInfo = new FileInfo("temp/temp.csv");
            norm.Normalize(normalizedDataFileInfo);

            var inputNeurons = fields.Count - 1;
            int outputNeurons;
            if (problemType == AnalystGoal.Classification)
                outputNeurons = fields.Last().Classes.Count - (normalizationType == NormalizationAction.Equilateral ? 1 : 0);
            else
                outputNeurons = fields.Count - inputNeurons;
            var result = CSVHelper.LoadCSVToDataSet(normalizedDataFileInfo, inputNeurons, outputNeurons, randomize);
            normalizedDataFileInfo.Delete();
            return result;
        }
示例#2
0
        public void Wizard(AnalystGoal goal, WizardMethodType methodType, bool headers)
        {
            EncogAnalyst.MaxIteration = MaxIterations;
            var wiz = new AnalystWizard(EncogAnalyst)
            {
                Goal = goal, MethodType = methodType, EvidenceSegements = 3
            };

            wiz.Wizard(_rawFile, headers, FileFormat);

            EncogAnalyst.Save(_analystFile);
            EncogAnalyst.Load(_analystFile);
        }
        /// <summary>
        ///     Set a property.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="v">The value.</param>
        public void SetProperty(String name, AnalystGoal v)
        {
            switch (v)
            {
            case AnalystGoal.Classification:
                _data[name] = "classification";
                break;

            case AnalystGoal.Regression:
                _data[name] = "regression";
                break;

            default:
                _data[name] = "";
                break;
            }
        }
示例#4
0
 /// <summary>
 /// Construct the analyst wizard.
 /// </summary>
 ///
 /// <param name="theAnalyst">The analyst to use.</param>
 public AnalystWizard(EncogAnalyst theAnalyst)
 {
     _directClassification = false;
     _taskSegregate        = true;
     _taskRandomize        = true;
     _taskNormalize        = true;
     _taskBalance          = false;
     _taskCluster          = true;
     _range              = NormalizeRange.NegOne2One;
     _analyst            = theAnalyst;
     _script             = _analyst.Script;
     _methodType         = WizardMethodType.FeedForward;
     _targetField        = "";
     _goal               = AnalystGoal.Classification;
     _leadWindowSize     = 0;
     _lagWindowSize      = 0;
     _includeTargetField = false;
     _missing            = new DiscardMissing();
 }
 /// <summary>
 ///     Set a property.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="v">The value.</param>
 public void SetProperty(String name, AnalystGoal v)
 {
     switch (v)
     {
         case AnalystGoal.Classification:
             _data[name] = "classification";
             break;
         case AnalystGoal.Regression:
             _data[name] = "regression";
             break;
         default:
             _data[name] = "";
             break;
     }
 }
示例#6
0
 public AnalystWizard(EncogAnalyst theAnalyst)
 {
     if (15 == 0)
     {
         return;
     }
     this._x7047063a9bee4054 = true;
     Label_0071:
     this._xc24b506a94383a44 = false;
     this._x34231b3d9a1591be = true;
     this._x9b10ace6509508c0 = NormalizeRange.NegOne2One;
     this._x554f16462d8d4675 = theAnalyst;
     this._x594135906c55045c = this._x554f16462d8d4675.Script;
     this._xa24f4208aa2278f4 = WizardMethodType.FeedForward;
     this._x0768e2edc97194de = "";
     if (8 != 0)
     {
         this._x29c8e5bee3cb25f8 = AnalystGoal.Classification;
         this._xb6540cd895237850 = 0;
         if (1 != 0)
         {
             this._x654428e3563552e3 = 0;
             this._x0236ea04f9fa4aaa = false;
             this._x771edacf1be2c386 = new DiscardMissing();
         }
         else
         {
             goto Label_0071;
         }
     }
 }
 /// <summary>
 ///     Construct the analyst wizard.
 /// </summary>
 /// <param name="theAnalyst">The analyst to use.</param>
 public AnalystWizard(EncogAnalyst theAnalyst)
 {
     _directClassification = false;
     _taskSegregate = true;
     _taskRandomize = true;
     _taskNormalize = true;
     _taskBalance = false;
     _taskCluster = true;
     _range = NormalizeRange.NegOne2One;
     _analyst = theAnalyst;
     _script = _analyst.Script;
     _methodType = WizardMethodType.FeedForward;
     TargetFieldName = "";
     _goal = AnalystGoal.Classification;
     _leadWindowSize = 0;
     _lagWindowSize = 0;
     _includeTargetField = false;
     _missing = new DiscardMissing();
     MaxError = DefaultTrainError;
     NaiveBayes = false;
 }
        public void Wizard(AnalystGoal goal, WizardMethodType methodType, bool headers)
        {
            EncogAnalyst.MaxIteration = MaxIterations;
            var wiz = new AnalystWizard(EncogAnalyst) {Goal = goal, MethodType = methodType, EvidenceSegements = 3};
            wiz.Wizard(_rawFile, headers, FileFormat);

            EncogAnalyst.Save(_analystFile);
            EncogAnalyst.Load(_analystFile);
        }
示例#9
0
        public void SetProperty(string name, AnalystGoal v)
        {
            switch (v)
            {
                case AnalystGoal.Regression:
                    this._x4a3f0a05c02f235f[name] = "regression";
                    return;

                case AnalystGoal.Classification:
                    this._x4a3f0a05c02f235f[name] = "classification";
                    return;
            }
            this._x4a3f0a05c02f235f[name] = "";
        }