Holds a field to be analyzed.
Ejemplo n.º 1
0
 public AnalystField(AnalystField field)
 {
     if (8 != 0)
     {
         if (0 == 0)
         {
             this._x8affa5274961ba3a = new List<ClassItem>();
             this._xba38fdafb6633fdf = new Dictionary<string, int>();
             this._x945de103a2446d98 = field._x945de103a2446d98;
             this._x4a1b740f8a477de7 = field._x4a1b740f8a477de7;
         }
         else
         {
             goto Label_0093;
         }
     }
     this._x891507b50bbab0f9 = field._x891507b50bbab0f9;
     this._x136bfff0efb12047 = field._x136bfff0efb12047;
     this._xab8fe3cd8c5556fb = field._xab8fe3cd8c5556fb;
     Label_0093:
     if (0xff != 0)
     {
         this._xc15bd84e01929885 = field._xc15bd84e01929885;
         this._x9c13656d94fc62d0 = field._x9c13656d94fc62d0;
         this._xb28caf42bc38fd60 = field._xb28caf42bc38fd60;
     }
 }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public double[] HandleMissing(EncogAnalyst analyst, AnalystField stat)
 {
     var result = new double[stat.ColumnsNeeded];
     double n = stat.NormalizedHigh - (stat.NormalizedHigh - stat.NormalizedLow/2);
     for (int i = 0; i < result.Length; i++)
     {
         result[i] = n;
     }
     return result;
 }
Ejemplo n.º 3
0
 public double[] HandleMissing(EncogAnalyst analyst, AnalystField stat)
 {
     if (stat.Classify)
     {
         int classNumber = stat.DetermineMode(analyst);
         return stat.Encode(classNumber);
     }
     DataField field = analyst.Script.FindDataField(stat.Name);
     return new double[] { field.Mean };
 }
 /// <summary>
 /// Construct an analyst field.  Works like a C++ copy constructor.
 /// </summary>
 ///
 /// <param name="field">The field to clone.</param>
 public AnalystField(AnalystField field)
 {
     _classes        = new List <ClassItem>();
     _lookup         = new Dictionary <String, Int32>();
     _actualHigh     = field._actualHigh;
     _actualLow      = field._actualLow;
     _normalizedHigh = field._normalizedHigh;
     _normalizedLow  = field._normalizedLow;
     _action         = field._action;
     _name           = field._name;
     _output         = field._output;
     _timeSlice      = field._timeSlice;
 }
 /// <inheritdoc/>
 public double[] HandleMissing(EncogAnalyst analyst, AnalystField stat)
 {
     // mode?
     if (stat.Classify)
     {
         var m = stat.DetermineMode(analyst);
         return stat.Encode(m);
     }
     // mean
     var df = analyst.Script.FindDataField(stat.Name);
     var result = new double[1];
     result[0] = df.Mean;
     return result;
 }
Ejemplo n.º 6
0
 public double[] HandleMissing(EncogAnalyst analyst, AnalystField stat)
 {
     double num;
     int num2;
     double[] numArray = new double[stat.ColumnsNeeded];
     if (2 != 0)
     {
         num = stat.NormalizedHigh - (stat.NormalizedHigh - (stat.NormalizedLow / 2.0));
         num2 = 0;
         goto Label_001A;
     }
     Label_0012:
     numArray[num2] = num;
     num2++;
     Label_001A:
     if (num2 < numArray.Length)
     {
         goto Label_0012;
     }
     return numArray;
 }
        /// <summary>
        ///     Generate the normalized fields.
        /// </summary>
        private void GenerateNormalizedFields()
        {
            IList<AnalystField> norm = _script.Normalize.NormalizedFields;
            norm.Clear();
            DataField[] dataFields = _script.Fields;

            for (int i = 0; i < _script.Fields.Length; i++)
            {
                DataField f = dataFields[i];

                NormalizationAction action;
                bool isLast = i == _script.Fields.Length - 1;

                if (_methodType == WizardMethodType.BayesianNetwork)
                {
                    AnalystField af;
                    if (f.Class)
                    {
                        af = new AnalystField(f.Name,
                                              NormalizationAction.SingleField, 0, 0);
                    }
                    else
                    {
                        af = new AnalystField(f.Name,
                                              NormalizationAction.PassThrough, 0, 0);
                    }
                    norm.Add(af);
                }
                else if ((f.Integer || f.Real) && !f.Class)
                {
                    action = NormalizationAction.Normalize;
                    AnalystField af = _range == NormalizeRange.NegOne2One
                                          ? new AnalystField(f.Name, action, 1, -1)
                                          : new AnalystField(f.Name, action, 1, 0);
                    norm.Add(af);
                    af.ActualHigh = f.Max;
                    af.ActualLow = f.Min;
                }
                else if (f.Class)
                {
                    if (isLast && _directClassification)
                    {
                        action = NormalizationAction.SingleField;
                    }
                    else if (f.ClassMembers.Count > 2)
                    {
                        action = NormalizationAction.Equilateral;
                    }
                    else
                    {
                        action = NormalizationAction.OneOf;
                    }

                    norm.Add(_range == NormalizeRange.NegOne2One
                                 ? new AnalystField(f.Name, action, 1, -1)
                                 : new AnalystField(f.Name, action, 1, 0));
                }
                else
                {
                    action = NormalizationAction.Ignore;
                    norm.Add(new AnalystField(action, f.Name));
                }
            }

            _script.Normalize.Init(_script);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Construct an analyst field.  Works like a C++ copy constructor.  
 /// </summary>
 ///
 /// <param name="field">The field to clone.</param>
 public AnalystField(AnalystField field)
 {
     _classes = new List<ClassItem>();
     _lookup = new Dictionary<String, Int32>();
     _actualHigh = field._actualHigh;
     _actualLow = field._actualLow;
     _normalizedHigh = field._normalizedHigh;
     _normalizedLow = field._normalizedLow;
     _action = field._action;
     _name = field._name;
     _output = field._output;
     _timeSlice = field._timeSlice;
     FixSingleValue();
 }
Ejemplo n.º 9
0
        /// <summary>
        ///     Handle normalization ranges.
        /// </summary>
        /// <param name="section">The section being loaded.</param>
        private void HandleNormalizeRange(EncogFileSection section)
        {
            _script.Normalize.NormalizedFields.Clear();
            bool first = true;

            foreach (String line in section.Lines)
            {
                if (!first)
                {
                    IList<String> cols = EncogFileSection.SplitColumns(line);
                    String name = cols[0];
                    bool isOutput = cols[1].ToLower()
                                           .Equals("output");
                    int timeSlice = Int32.Parse(cols[2]);
                    String action = cols[3];
                    double high = CSVFormat.EgFormat.Parse(cols[4]);
                    double low = CSVFormat.EgFormat.Parse(cols[5]);

                    NormalizationAction des;
                    if (action.Equals("range"))
                    {
                        des = NormalizationAction.Normalize;
                    }
                    else if (action.Equals("ignore"))
                    {
                        des = NormalizationAction.Ignore;
                    }
                    else if (action.Equals("pass"))
                    {
                        des = NormalizationAction.PassThrough;
                    }
                    else if (action.Equals("equilateral"))
                    {
                        des = NormalizationAction.Equilateral;
                    }
                    else if (action.Equals("single"))
                    {
                        des = NormalizationAction.SingleField;
                    }
                    else if (action.Equals("oneof"))
                    {
                        des = NormalizationAction.OneOf;
                    }
                    else
                    {
                        throw new AnalystError("Unknown field type:" + action);
                    }

                    var nf = new AnalystField(name, des, high, low) {TimeSlice = timeSlice, Output = isOutput};
                    _script.Normalize.NormalizedFields.Add(nf);
                }
                else
                {
                    first = false;
                }
            }
        }
Ejemplo n.º 10
0
 public double[] HandleMissing(EncogAnalyst analyst, AnalystField stat)
 {
     return null;
 }
Ejemplo n.º 11
0
 private static bool x3e64998256ab1982(AnalystField xe01ae93d9fe5a880)
 {
     return xe01ae93d9fe5a880.Input;
 }
Ejemplo n.º 12
0
 private void xa39295d07e81cd8c()
 {
     DataField[] fields;
     int num;
     DataField field;
     NormalizationAction singleField;
     bool flag;
     IList<AnalystField> normalizedFields = this._x594135906c55045c.Normalize.NormalizedFields;
     if ((((uint) num) - ((uint) flag)) >= 0)
     {
         normalizedFields.Clear();
         fields = this._x594135906c55045c.Fields;
         if (-2 == 0)
         {
             goto Label_016B;
         }
         num = 0;
     }
     else
     {
         if ((((uint) flag) + ((uint) flag)) > uint.MaxValue)
         {
             goto Label_00A4;
         }
         if (0 != 0)
         {
             goto Label_016B;
         }
         goto Label_0138;
     }
     Label_0031:
     if (num < this._x594135906c55045c.Fields.Length)
     {
         field = fields[num];
         flag = num == (this._x594135906c55045c.Fields.Length - 1);
         if (((uint) num) >= 0)
         {
             goto Label_0160;
         }
         goto Label_016B;
     }
     this._x594135906c55045c.Normalize.Init(this._x594135906c55045c);
     if (0 == 0)
     {
         return;
     }
     if ((((uint) num) + ((uint) flag)) <= uint.MaxValue)
     {
         goto Label_0138;
     }
     Label_007B:
     singleField = NormalizationAction.Ignore;
     normalizedFields.Add(new AnalystField(singleField, field.Name));
     Label_0091:
     num++;
     if (3 != 0)
     {
         if (0 != 0)
         {
             return;
         }
         goto Label_0031;
     }
     goto Label_0138;
     Label_00A4:
     singleField = NormalizationAction.OneOf;
     if ((((uint) flag) - ((uint) num)) < 0)
     {
         goto Label_00A4;
     }
     Label_00BF:
     normalizedFields.Add((this._x9b10ace6509508c0 == NormalizeRange.NegOne2One) ? new AnalystField(field.Name, singleField, 1.0, -1.0) : new AnalystField(field.Name, singleField, 1.0, 0.0));
     goto Label_0091;
     Label_0138:
     if (!field.Class)
     {
         goto Label_007B;
     }
     if (flag && this._x990368722123b229)
     {
         singleField = NormalizationAction.SingleField;
         goto Label_00BF;
     }
     if (field.ClassMembers.Count > 2)
     {
         singleField = NormalizationAction.Equilateral;
         goto Label_00BF;
     }
     goto Label_00A4;
     Label_0160:
     if (field.Integer)
     {
         goto Label_0203;
     }
     Label_016B:
     if (!field.Real)
     {
         goto Label_0138;
     }
     Label_0203:
     singleField = NormalizationAction.Normalize;
     while (this._x9b10ace6509508c0 != NormalizeRange.NegOne2One)
     {
         break;
     }
     AnalystField item = new AnalystField(field.Name, singleField, 1.0, -1.0);
     normalizedFields.Add(item);
     if ((((uint) num) | 0xfffffffe) == 0)
     {
         goto Label_0160;
     }
     item.ActualHigh = field.Max;
     item.ActualLow = field.Min;
     goto Label_0091;
 }
Ejemplo n.º 13
0
 private void x23a952ae96385f94(EncogFileSection xb32f8dd719a105db)
 {
     this._x594135906c55045c.Normalize.NormalizedFields.Clear();
     bool flag = true;
     using (IEnumerator<string> enumerator = xb32f8dd719a105db.Lines.GetEnumerator())
     {
         string str;
         IList<string> list;
         string str2;
         bool flag2;
         int num;
         string str3;
         double num2;
         double num3;
         NormalizationAction oneOf;
         AnalystField field;
         AnalystField field2;
         goto Label_0047;
     Label_0026:
         this._x594135906c55045c.Normalize.NormalizedFields.Add(field);
         goto Label_0047;
     Label_003F:
         if (!flag)
         {
             goto Label_02B1;
         }
         flag = false;
     Label_0047:
         if (enumerator.MoveNext())
         {
             goto Label_02C2;
         }
         goto Label_0064;
     Label_0055:
         field2.Output = flag2;
         field = field2;
         goto Label_0026;
     Label_0064:
         if (((uint) num2) >= 0)
         {
             goto Label_009C;
         }
     Label_0076:
         if ((((uint) flag) + ((uint) flag2)) > uint.MaxValue)
         {
             goto Label_0145;
         }
         field2.TimeSlice = num;
         goto Label_0055;
     Label_009C:
         if ((((uint) num3) | 0xff) != 0)
         {
             return;
         }
         goto Label_00DA;
     Label_00CA:
         field2 = new AnalystField(str2, oneOf, num2, num3);
         goto Label_0076;
     Label_00DA:
         if (str3.Equals("equilateral"))
         {
             goto Label_013D;
         }
         if (str3.Equals("single"))
         {
             oneOf = NormalizationAction.SingleField;
             goto Label_00CA;
         }
         if (!str3.Equals("oneof"))
         {
             throw new AnalystError("Unknown field type:" + str3);
         }
         oneOf = NormalizationAction.OneOf;
         if (0xff != 0)
         {
             goto Label_00CA;
         }
         goto Label_0076;
     Label_011D:
         if ((((uint) num3) + ((uint) num3)) < 0)
         {
             goto Label_024D;
         }
         goto Label_00DA;
     Label_013D:
         oneOf = NormalizationAction.Equilateral;
         goto Label_00CA;
     Label_0145:
         if (((uint) flag) > uint.MaxValue)
         {
             goto Label_0177;
         }
     Label_0157:
         if (str3.Equals("pass"))
         {
             goto Label_0177;
         }
         goto Label_00DA;
     Label_016F:
         oneOf = NormalizationAction.Ignore;
         goto Label_00CA;
     Label_0177:
         oneOf = NormalizationAction.PassThrough;
         goto Label_00CA;
     Label_017F:
         if ((((uint) flag) - ((uint) flag2)) < 0)
         {
             goto Label_00DA;
         }
         if (!str3.Equals("ignore"))
         {
             goto Label_0157;
         }
         if (((uint) flag) >= 0)
         {
             goto Label_016F;
         }
         if (((uint) num2) >= 0)
         {
             goto Label_00DA;
         }
         if ((((uint) num3) - ((uint) flag2)) <= uint.MaxValue)
         {
             goto Label_0145;
         }
         goto Label_011D;
     Label_01E9:
         oneOf = NormalizationAction.Normalize;
         goto Label_00CA;
     Label_01F1:
         if (str3.Equals("range"))
         {
             goto Label_01E9;
         }
         goto Label_017F;
     Label_0215:
         num3 = CSVFormat.EgFormat.Parse(list[5]);
         goto Label_01F1;
     Label_022D:
         str2 = list[0];
         flag2 = list[1].ToLower().Equals("output");
     Label_024D:
         num = int.Parse(list[2]);
         str3 = list[3];
         if ((((uint) flag2) - ((uint) num3)) > uint.MaxValue)
         {
             goto Label_022D;
         }
         num2 = CSVFormat.EgFormat.Parse(list[4]);
         if ((((uint) flag2) + ((uint) num)) <= uint.MaxValue)
         {
             goto Label_0215;
         }
         goto Label_01F1;
     Label_02B1:
         list = EncogFileSection.SplitColumns(str);
         goto Label_022D;
     Label_02C2:
         str = enumerator.Current;
         goto Label_003F;
     }
 }
Ejemplo n.º 14
0
 private static bool x39c9f3878dc6803f(AnalystField xe01ae93d9fe5a880)
 {
     return (xe01ae93d9fe5a880.TimeSlice != 0);
 }
Ejemplo n.º 15
0
 private static int x003a13383c339170(int x3bd62873fafa6252, AnalystField xe01ae93d9fe5a880)
 {
     return Math.Max(x3bd62873fafa6252, xe01ae93d9fe5a880.TimeSlice);
 }
Ejemplo n.º 16
0
 private static bool x8b977eb5800872ff(AnalystField xe01ae93d9fe5a880)
 {
     return xe01ae93d9fe5a880.Output;
 }
Ejemplo n.º 17
0
 private static int x6336b641dc5ba406(AnalystField xe01ae93d9fe5a880)
 {
     return xe01ae93d9fe5a880.ColumnsNeeded;
 }
Ejemplo n.º 18
0
 private static int x4a01373bb5d8ba23(AnalystField xe01ae93d9fe5a880)
 {
     return xe01ae93d9fe5a880.ColumnsNeeded;
 }
        /// <summary>
        ///     Expand the time-series fields.
        /// </summary>
        private void ExpandTimeSlices()
        {
            IList<AnalystField> oldList = _script.Normalize.NormalizedFields;
            IList<AnalystField> newList = new List<AnalystField>();

            // generate the inputs foreach the new list
            foreach (AnalystField field  in  oldList)
            {
                if (!field.Ignored)
                {
                    if (_includeTargetField || field.Input)
                    {
                        for (int i = 0; i < _lagWindowSize; i++)
                        {
                            var newField = new AnalystField(field) {TimeSlice = -i, Output = false};
                            newList.Add(newField);
                        }
                    }
                }
                else
                {
                    newList.Add(field);
                }
            }

            // generate the outputs foreach the new list
            foreach (AnalystField field  in  oldList)
            {
                if (!field.Ignored)
                {
                    if (field.Output)
                    {
                        for (int i = 1; i <= _leadWindowSize; i++)
                        {
                            var newField = new AnalystField(field) {TimeSlice = i};
                            newList.Add(newField);
                        }
                    }
                }
            }

            // generate the ignores foreach the new list
            foreach (AnalystField field  in  oldList)
            {
                if (field.Ignored)
                {
                    newList.Add(field);
                }
            }

            // swap back in
            oldList.Clear();
            foreach (AnalystField item in oldList)
            {
                oldList.Add(item);
            }
        }
Ejemplo n.º 20
0
 private void xfd33c8a1cd5c5a19()
 {
     IList<AnalystField> list2;
     int num;
     int num2;
     IList<AnalystField> normalizedFields = this._x594135906c55045c.Normalize.NormalizedFields;
     if (((uint) num2) >= 0)
     {
         goto Label_017E;
     }
     Label_0026:
     using (IEnumerator<AnalystField> enumerator2 = normalizedFields.GetEnumerator())
     {
         AnalystField field4;
         AnalystField field6;
         goto Label_0049;
     Label_0032:
         if (!field4.Ignored && field4.Output)
         {
             goto Label_00B1;
         }
     Label_0049:
         if (enumerator2.MoveNext())
         {
             goto Label_00A3;
         }
         goto Label_0084;
     Label_0054:
         field6 = new AnalystField(field4);
         field6.TimeSlice = num2;
         AnalystField item = field6;
         list2.Add(item);
     Label_0072:
         num2++;
     Label_0078:
         if (num2 <= this._xb6540cd895237850)
         {
             goto Label_0054;
         }
         goto Label_0049;
     Label_0084:
         if ((((uint) num) + ((uint) num)) <= uint.MaxValue)
         {
             goto Label_00C4;
         }
         goto Label_00A3;
     Label_009E:
         if (0 != 0)
         {
             goto Label_0072;
         }
         goto Label_0078;
     Label_00A3:
         field4 = enumerator2.Current;
         goto Label_0032;
     Label_00B1:
         num2 = 1;
         goto Label_009E;
     }
     Label_00C4:
     using (IEnumerator<AnalystField> enumerator3 = normalizedFields.GetEnumerator())
     {
         AnalystField current;
         goto Label_00F5;
     Label_00D0:
         list2.Add(current);
         goto Label_00F5;
     Label_00DA:
         if (current.Ignored || (((uint) num2) < 0))
         {
             goto Label_00D0;
         }
     Label_00F5:
         if (enumerator3.MoveNext())
         {
             current = enumerator3.Current;
             goto Label_00DA;
         }
     }
     normalizedFields.Clear();
     foreach (AnalystField field8 in normalizedFields)
     {
         normalizedFields.Add(field8);
     }
     return;
     if (((uint) num) > uint.MaxValue)
     {
         goto Label_0026;
     }
     if (((uint) num) >= 0)
     {
         return;
     }
     Label_017E:
     list2 = new List<AnalystField>();
     using (IEnumerator<AnalystField> enumerator = normalizedFields.GetEnumerator())
     {
         AnalystField field;
         AnalystField field2;
         AnalystField field3;
         goto Label_01B7;
     Label_018E:
         if (((uint) num2) > uint.MaxValue)
         {
             goto Label_026B;
         }
         list2.Add(field);
         goto Label_01B7;
     Label_01AC:
         if (field.Input)
         {
             goto Label_026B;
         }
     Label_01B7:
         if (enumerator.MoveNext())
         {
             goto Label_0276;
         }
         goto Label_0026;
     Label_01C5:
         if (num < this._x654428e3563552e3)
         {
             goto Label_0215;
         }
         goto Label_01B7;
     Label_01D0:
         if (!field.Ignored)
         {
             goto Label_0260;
         }
         goto Label_018E;
     Label_01DF:
         if ((((uint) num2) - ((uint) num2)) > uint.MaxValue)
         {
             goto Label_01AC;
         }
     Label_01F7:
         list2.Add(field2);
         num++;
         if (1 != 0)
         {
             goto Label_01C5;
         }
         goto Label_0026;
     Label_020F:
         field2 = field3;
         goto Label_01DF;
     Label_0215:
         field3 = new AnalystField(field);
         field3.TimeSlice = -num;
         field3.Output = false;
         if ((((uint) num2) | uint.MaxValue) == 0)
         {
             goto Label_01F7;
         }
         if ((((uint) num2) | 1) != 0)
         {
             goto Label_020F;
         }
         goto Label_026B;
     Label_0260:
         if (!this._x0236ea04f9fa4aaa)
         {
             goto Label_01AC;
         }
     Label_026B:
         num = 0;
         goto Label_01C5;
     Label_0276:
         field = enumerator.Current;
         goto Label_01D0;
     }
     if ((((uint) num2) + ((uint) num)) < 0)
     {
         return;
     }
     goto Label_0026;
 }
Ejemplo n.º 21
0
 private static bool x76f0417a648ac746(AnalystField xe01ae93d9fe5a880)
 {
     return (xe01ae93d9fe5a880.TimeSlice > 0);
 }
Ejemplo n.º 22
0
 private static bool x4b90a4532700f8c1(AnalystField xe01ae93d9fe5a880)
 {
     return (xe01ae93d9fe5a880.TimeSlice < 0);
 }
Ejemplo n.º 23
0
 private static int xfd645fc8075c58ea(int x3bd62873fafa6252, AnalystField xe01ae93d9fe5a880)
 {
     return Math.Max(x3bd62873fafa6252, Math.Abs(xe01ae93d9fe5a880.TimeSlice));
 }