Changeset 5692 for trunk/sources
- Timestamp:
- 03/15/11 15:51:55 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/DataAnalysis Refactoring/HeuristicLab.ExtLibs merged eligible /branches/CloningRefactoring/HeuristicLab.ExtLibs 4656-4721 /branches/DataAnalysis/HeuristicLab.ExtLibs 4458-4459,4462,4464 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.ExtLibs 5060 /branches/NET40/sources/HeuristicLab.ExtLibs 5138-5162 /branches/ParallelEngine/HeuristicLab.ExtLibs 5175-5192 /branches/SuccessProgressAnalysis/HeuristicLab.ExtLibs 5370-5682
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.LibSVM/1.6.3/LibSVM-1.6.3/Model.cs
r4545 r5692 31 31 private int _numberOfClasses; 32 32 private int _supportVectorCount; 33 private int[] _supportVectorIndizes;34 33 private Node[][] _supportVectors; 35 34 private double[][] _supportVectorCoefficients; … … 77 76 set { 78 77 _supportVectorCount = value; 79 }80 }81 82 /// <summary>83 /// Indizes of support vectors identified in the training.84 /// </summary>85 public int[] SupportVectorIndizes {86 get {87 return _supportVectorIndizes;88 }89 set {90 _supportVectorIndizes = value;91 78 } 92 79 } … … 215 202 model.ClassLabels = null; 216 203 model.NumberOfSVPerClass = null; 217 model.SupportVectorIndizes = new int[0];218 204 219 205 bool headerFinished = false; … … 416 402 output.Write("nr_sv"); 417 403 for (int i = 0; i < nr_class; i++) 418 output.Write(" " + model.NumberOfSVPerClass[i] .ToString("r"));404 output.Write(" " + model.NumberOfSVPerClass[i]); 419 405 output.Write(Environment.NewLine); 420 406 } -
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.LibSVM/1.6.3/LibSVM-1.6.3/Solver.cs
r4068 r5692 1460 1460 if (Math.Abs(f.alpha[i]) > 0) ++nSV; 1461 1461 model.SupportVectorCount = nSV; 1462 model.SupportVectorIndizes = new int[nSV];1463 1462 model.SupportVectors = new Node[nSV][]; 1464 1463 model.SupportVectorCoefficients[0] = new double[nSV]; … … 1468 1467 if (Math.Abs(f.alpha[i]) > 0) { 1469 1468 model.SupportVectors[j] = prob.X[i]; 1470 model.SupportVectorIndizes[j] = i;1471 1469 model.SupportVectorCoefficients[0][j] = f.alpha[i]; 1472 1470 … … 1596 1594 model.SupportVectorCount = nnz; 1597 1595 model.SupportVectors = new Node[nnz][]; 1598 model.SupportVectorIndizes = new int[nnz];1599 1596 p = 0; 1600 1597 for (i = 0; i < l; i++) { 1601 1598 if (nonzero[i]) { 1602 1599 model.SupportVectors[p] = x[i]; 1603 model.SupportVectorIndizes[p] = i;1604 1600 p++; 1605 1601 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis (added) merged: 5690
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Regression merged eligible /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression merged eligible /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Regression merged eligible /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression 4656-4721 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Regression 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Regression 5175-5192 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Regression 5370-5682
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs
r5445 r5692 46 46 } 47 47 48 public Dataset SupportVectors {49 get { return CalculateSupportVectors(); }50 }51 52 48 private List<double> estimatedValues; 53 49 public override IEnumerable<double> EstimatedValues { … … 70 66 } 71 67 68 public Dataset SupportVectors { 69 get { 70 int nCol = inputVariables.Count; 71 double[,] data = new double[Model.Model.SupportVectorCount, nCol]; 72 int row = 0; 73 foreach (var sv in Model.SupportVectors) { 74 for (int col = 0; col < nCol; col++) { 75 data[row, col] = sv[col]; 76 } 77 row++; 78 } 79 return new Dataset(inputVariables, data); 80 } 81 } 82 83 [Storable] 84 private List<string> inputVariables; 85 72 86 [StorableConstructor] 73 87 private SupportVectorRegressionSolution(bool deserializing) : base(deserializing) { } 74 private SupportVectorRegressionSolution(SupportVectorRegressionSolution original, Cloner cloner) : base(original, cloner) { } 88 private SupportVectorRegressionSolution(SupportVectorRegressionSolution original, Cloner cloner) 89 : base(original, cloner) { 90 this.inputVariables = new List<string>(original.inputVariables); 91 } 75 92 public SupportVectorRegressionSolution() : base() { } 76 93 public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit) 77 94 : base(problemData, lowerEstimationLimit, upperEstimationLimit) { 78 95 this.Model = model; 96 this.inputVariables = new List<string>(inputVariables); 97 } 98 99 [StorableHook(HookType.AfterDeserialization)] 100 private void AfterDeserialization() { 101 #region backwards compatibility 102 if (inputVariables == null) inputVariables = ProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value).ToList(); 103 #endregion 79 104 } 80 105 81 106 public override IDeepCloneable Clone(Cloner cloner) { 82 107 return new SupportVectorRegressionSolution(this, cloner); 83 }84 85 protected override void OnProblemDataChanged() {86 Model.Model.SupportVectorIndizes = new int[0];87 base.OnProblemDataChanged();88 }89 90 private Dataset CalculateSupportVectors() {91 if (Model.Model.SupportVectorIndizes.Length == 0)92 return new Dataset(new List<string>(), new double[0, 0]);93 94 double[,] data = new double[Model.Model.SupportVectorIndizes.Length, ProblemData.Dataset.Columns];95 for (int i = 0; i < Model.Model.SupportVectorIndizes.Length; i++) {96 for (int column = 0; column < ProblemData.Dataset.Columns; column++)97 data[i, column] = ProblemData.Dataset[Model.Model.SupportVectorIndizes[i], column];98 }99 return new Dataset(ProblemData.Dataset.VariableNames, data);100 108 } 101 109 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs
r5445 r5692 37 37 [Item("SupportVectorMachineModel", "Represents a support vector machine model.")] 38 38 public sealed class SupportVectorMachineModel : NamedItem, IDataAnalysisModel { 39 [StorableConstructor]40 private SupportVectorMachineModel(bool deserializing) : base(deserializing) { }41 private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner)42 : base(original, cloner) {43 // only using a shallow copy here! (gkronber)44 this.model = original.model;45 this.rangeTransform = original.rangeTransform;46 }47 public SupportVectorMachineModel() : base() { }48 49 39 private SVM.Model model; 50 40 /// <summary> … … 77 67 } 78 68 69 public IEnumerable<double[]> SupportVectors { 70 get { 71 return from sv in Model.SupportVectors 72 select (from svx in sv 73 select svx.Value).ToArray(); 74 } 75 } 76 77 [StorableConstructor] 78 private SupportVectorMachineModel(bool deserializing) : base(deserializing) { } 79 private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner) 80 : base(original, cloner) { 81 // only using a shallow copy here! (gkronber) 82 this.model = original.model; 83 this.rangeTransform = original.rangeTransform; 84 } 85 public SupportVectorMachineModel() : base() { } 86 79 87 public IEnumerable<double> GetEstimatedValues(DataAnalysisProblemData problemData, int start, int end) { 80 88 SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(problemData, Enumerable.Range(start, end - start)); … … 96 104 97 105 #region persistence 98 [Storable]99 private int[] SupportVectorIndizes {100 get { return this.Model.SupportVectorIndizes; }101 set { this.Model.SupportVectorIndizes = value; }102 }103 104 106 [Storable] 105 107 private string ModelAsString {
Note: See TracChangeset
for help on using the changeset viewer.