Changeset 2436 for trunk/sources
- Timestamp:
- 10/15/09 14:47:01 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SupportVectorMachines/3.2/Predictor.cs
r2421 r2436 50 50 } 51 51 52 public Predictor() : base() { } // for persistence 52 // for persistence 53 public Predictor() : base() { } 53 54 54 55 public Predictor(SVMModel model, string targetVariable, IEnumerable<string> variableNames) : … … 57 58 58 59 public Predictor(SVMModel model, string targetVariable, IEnumerable<string> variableNames, int minTimeOffset, int maxTimeOffset) 59 : base() {60 : this() { 60 61 this.svmModel = model; 61 62 this.targetVariable = targetVariable; 62 this.variableNames = new List<string>(variableNames);63 63 this.minTimeOffset = minTimeOffset; 64 64 this.maxTimeOffset = maxTimeOffset; 65 this.variableNames = new List<string>(variableNames); 65 66 } 66 67 … … 169 170 170 171 public static Predictor Import(TextReader reader) { 171 Predictor p = new Predictor();172 172 string[] targetVariableLine = reader.ReadLine().Split(':'); 173 173 string[] lowerPredictionLimitLine = reader.ReadLine().Split(':'); … … 177 177 string[] inputVariableLine = reader.ReadLine().Split(':', ';'); 178 178 179 p.targetVariable = targetVariableLine[1].Trim(); 180 p.LowerPredictionLimit = double.Parse(lowerPredictionLimitLine[1], CultureInfo.InvariantCulture.NumberFormat); 181 p.UpperPredictionLimit = double.Parse(upperPredictionLimitLine[1], CultureInfo.InvariantCulture.NumberFormat); 182 p.maxTimeOffset = int.Parse(maxTimeOffsetLine[1]); 183 p.minTimeOffset = int.Parse(minTimeOffsetLine[1]); 179 string targetVariable = targetVariableLine[1].Trim(); 180 double lowerPredictionLimit = double.Parse(lowerPredictionLimitLine[1], CultureInfo.InvariantCulture.NumberFormat); 181 double upperPredictionLimit = double.Parse(upperPredictionLimitLine[1], CultureInfo.InvariantCulture.NumberFormat); 182 int maxTimeOffset = int.Parse(maxTimeOffsetLine[1]); 183 int minTimeOffset = int.Parse(minTimeOffsetLine[1]); 184 List<string> variableNames = new List<string>(); 184 185 foreach (string inputVariable in inputVariableLine.Skip(1)) { 185 p.variableNames.Add(inputVariable.Trim());186 variableNames.Add(inputVariable.Trim()); 186 187 } 187 p.svmModel = SVMModel.Import(reader); 188 SVMModel model = SVMModel.Import(reader); 189 Predictor p = new Predictor(model, targetVariable, variableNames, minTimeOffset, maxTimeOffset); 190 p.UpperPredictionLimit = upperPredictionLimit; 191 p.LowerPredictionLimit = lowerPredictionLimit; 188 192 return p; 189 193 }
Note: See TracChangeset
for help on using the changeset viewer.