- Timestamp:
- 09/14/09 10:08:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SupportVectorMachines/3.2/Predictor.cs
r2328 r2347 40 40 private Dictionary<string, int> variableNames = new Dictionary<string, int>(); 41 41 private string targetVariable; 42 private int minTimeOffset; 43 private int maxTimeOffset; 42 44 43 45 public Predictor() : base() { } // for persistence 44 46 45 public Predictor(SVMModel model, string targetVariable, Dictionary<string, int> variableNames) 47 public Predictor(SVMModel model, string targetVariable, Dictionary<string, int> variableNames) : 48 this(model, targetVariable, variableNames, 0, 0) { 49 } 50 51 public Predictor(SVMModel model, string targetVariable, Dictionary<string, int> variableNames, int minTimeOffset, int maxTimeOffset) 46 52 : base() { 47 53 this.svmModel = model; 48 54 this.targetVariable = targetVariable; 49 55 this.variableNames = variableNames; 56 this.minTimeOffset = minTimeOffset; 57 this.maxTimeOffset = maxTimeOffset; 50 58 } 51 59 … … 61 69 } 62 70 63 Problem p = SVMHelper.CreateSVMProblem(input, input.GetVariableIndex(targetVariable), newIndex, start, end); 71 Problem p = SVMHelper.CreateSVMProblem(input, input.GetVariableIndex(targetVariable), newIndex, 72 start, end, minTimeOffset, maxTimeOffset); 64 73 Problem scaledProblem = SVM.Scaling.Scale(p, transform); 65 74 … … 82 91 clone.targetVariable = targetVariable; 83 92 clone.variableNames = new Dictionary<string, int>(variableNames); 93 clone.minTimeOffset = minTimeOffset; 94 clone.maxTimeOffset = maxTimeOffset; 84 95 return clone; 85 96 } … … 90 101 targetVarAttr.Value = targetVariable; 91 102 node.Attributes.Append(targetVarAttr); 103 XmlAttribute minTimeOffsetAttr = document.CreateAttribute("MinTimeOffset"); 104 XmlAttribute maxTimeOffsetAttr = document.CreateAttribute("MaxTimeOffset"); 105 minTimeOffsetAttr.Value = XmlConvert.ToString(minTimeOffset); 106 maxTimeOffsetAttr.Value = XmlConvert.ToString(maxTimeOffset); 107 node.Attributes.Append(minTimeOffsetAttr); 108 node.Attributes.Append(maxTimeOffsetAttr); 92 109 node.AppendChild(PersistenceManager.Persist(svmModel, document, persistedObjects)); 93 110 XmlNode variablesNode = document.CreateElement("Variables"); … … 111 128 svmModel = (SVMModel)PersistenceManager.Restore(node.ChildNodes[0], restoredObjects); 112 129 130 if (node.Attributes["MinTimeOffset"] != null) minTimeOffset = XmlConvert.ToInt32(node.Attributes["MinTimeOffset"].Value); 131 if (node.Attributes["MaxTimeOffset"] != null) maxTimeOffset = XmlConvert.ToInt32(node.Attributes["MaxTimeOffset"].Value); 113 132 variableNames = new Dictionary<string, int>(); 114 133 XmlNode variablesNode = node.ChildNodes[1];
Note: See TracChangeset
for help on using the changeset viewer.