Changeset 3858 for trunk/sources
- Timestamp:
- 05/20/10 16:47:12 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.LibSVM/1.6.3/LibSVM-1.6.3/Model.cs
r2645 r3858 33 33 private int _numberOfClasses; 34 34 private int _supportVectorCount; 35 private int[] _supportVectorIndizes; 35 36 private Node[][] _supportVectors; 36 37 private double[][] _supportVectorCoefficients; … … 78 79 set { 79 80 _supportVectorCount = value; 81 } 82 } 83 84 /// <summary> 85 /// Indizes of support vectors identified in the training. 86 /// </summary> 87 public int[] SupportVectorIndizes { 88 get { 89 return _supportVectorIndizes; 90 } 91 set { 92 _supportVectorIndizes = value; 80 93 } 81 94 } -
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.LibSVM/1.6.3/LibSVM-1.6.3/Solver.cs
r2645 r3858 1673 1673 if (Math.Abs(f.alpha[i]) > 0) ++nSV; 1674 1674 model.SupportVectorCount = nSV; 1675 model.SupportVectorIndizes = new int[nSV]; 1675 1676 model.SupportVectors = new Node[nSV][]; 1676 1677 model.SupportVectorCoefficients[0] = new double[nSV]; 1678 1677 1679 int j = 0; 1678 1680 for (i = 0; i < prob.Count; i++) … … 1680 1682 { 1681 1683 model.SupportVectors[j] = prob.X[i]; 1684 model.SupportVectorIndizes[j] = i; 1682 1685 model.SupportVectorCoefficients[0][j] = f.alpha[i]; 1686 1683 1687 ++j; 1684 1688 } … … 1820 1824 model.SupportVectorCount = nnz; 1821 1825 model.SupportVectors = new Node[nnz][]; 1826 model.SupportVectorIndizes = new int[nnz]; 1822 1827 p = 0; 1823 for (i = 0; i < l; i++) 1824 if (nonzero[i]) model.SupportVectors[p++] = x[i]; 1828 for (i = 0; i < l; i++) { 1829 if (nonzero[i]) { 1830 model.SupportVectors[p] = x[i]; 1831 model.SupportVectorIndizes[p] = i; 1832 p++; 1833 } 1834 } 1825 1835 1826 1836 int[] nz_start = new int[nr_class]; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs
r3842 r3858 49 49 } 50 50 51 [Storable] 52 private List<string> inputVariables; 51 public Dataset SupportVectors { 52 get { return CalculateSupportVectors(); } 53 } 53 54 54 55 public SupportVectorRegressionSolution() : base() { } … … 56 57 : base(problemData, lowerEstimationLimit, upperEstimationLimit) { 57 58 this.model = model; 58 this.inputVariables = new List<string>(inputVariables);59 59 } 60 60 61 61 protected override void OnProblemDataChanged(EventArgs e) { 62 62 RecalculateEstimatedValues(); 63 model.Model.SupportVectorIndizes = new int[0]; 64 } 65 66 private Dataset CalculateSupportVectors() { 67 if (model.Model.SupportVectorIndizes.Length == 0) 68 return new Dataset(); 69 70 Dataset dataset = new Dataset(ProblemData.Dataset.VariableNames, new double[model.Model.SupportVectorCount, ProblemData.Dataset.Columns]); 71 for (int i = 0; i < model.Model.SupportVectorIndizes.Length; i++) { 72 for (int column = 0; column < ProblemData.Dataset.Columns; column++) 73 dataset[i, column] = ProblemData.Dataset[model.Model.SupportVectorIndizes[i], column]; 74 } 75 return dataset; 63 76 } 64 77 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/SupportVectorRegressionSolutionView.Designer.cs
r3853 r3858 46 46 this.modelTabControl = new System.Windows.Forms.TabControl(); 47 47 this.modelTabPage = new System.Windows.Forms.TabPage(); 48 this.modelPanel = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 48 49 this.dataTabPage = new System.Windows.Forms.TabPage(); 49 this.modelPanel = new HeuristicLab.MainForm.WindowsForms.ViewHost();50 50 this.dataPanel = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 51 this.supportVectorTabControl = new System.Windows.Forms.TabPage(); 52 this.supportVectorViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 51 53 this.modelTabControl.SuspendLayout(); 52 54 this.modelTabPage.SuspendLayout(); 53 55 this.dataTabPage.SuspendLayout(); 56 this.supportVectorTabControl.SuspendLayout(); 54 57 this.SuspendLayout(); 55 58 // … … 61 64 this.modelTabControl.Controls.Add(this.modelTabPage); 62 65 this.modelTabControl.Controls.Add(this.dataTabPage); 66 this.modelTabControl.Controls.Add(this.supportVectorTabControl); 63 67 this.modelTabControl.Location = new System.Drawing.Point(3, 3); 64 68 this.modelTabControl.Name = "modelTabControl"; … … 78 82 this.modelTabPage.UseVisualStyleBackColor = true; 79 83 // 84 // modelPanel 85 // 86 this.modelPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 87 | System.Windows.Forms.AnchorStyles.Left) 88 | System.Windows.Forms.AnchorStyles.Right))); 89 this.modelPanel.Caption = "View"; 90 this.modelPanel.Content = null; 91 this.modelPanel.Location = new System.Drawing.Point(6, 6); 92 this.modelPanel.Name = "modelPanel"; 93 this.modelPanel.ReadOnly = false; 94 this.modelPanel.Size = new System.Drawing.Size(227, 207); 95 this.modelPanel.TabIndex = 0; 96 this.modelPanel.ViewType = null; 97 // 80 98 // dataTabPage 81 99 // … … 89 107 this.dataTabPage.UseVisualStyleBackColor = true; 90 108 // 91 // modelPanel92 //93 this.modelPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)94 | System.Windows.Forms.AnchorStyles.Left)95 | System.Windows.Forms.AnchorStyles.Right)));96 this.modelPanel.Location = new System.Drawing.Point(6, 6);97 this.modelPanel.Name = "modelPanel";98 this.modelPanel.Size = new System.Drawing.Size(227, 207);99 this.modelPanel.TabIndex = 0;100 //101 109 // dataPanel 102 110 // … … 104 112 | System.Windows.Forms.AnchorStyles.Left) 105 113 | System.Windows.Forms.AnchorStyles.Right))); 114 this.dataPanel.Caption = "View"; 115 this.dataPanel.Content = null; 106 116 this.dataPanel.Location = new System.Drawing.Point(6, 6); 107 117 this.dataPanel.Name = "dataPanel"; 118 this.dataPanel.ReadOnly = false; 108 119 this.dataPanel.Size = new System.Drawing.Size(227, 207); 109 120 this.dataPanel.TabIndex = 0; 121 this.dataPanel.ViewType = null; 122 // 123 // supportVectorTabControl 124 // 125 this.supportVectorTabControl.Controls.Add(this.supportVectorViewHost); 126 this.supportVectorTabControl.Location = new System.Drawing.Point(4, 22); 127 this.supportVectorTabControl.Name = "supportVectorTabControl"; 128 this.supportVectorTabControl.Padding = new System.Windows.Forms.Padding(3); 129 this.supportVectorTabControl.Size = new System.Drawing.Size(239, 219); 130 this.supportVectorTabControl.TabIndex = 2; 131 this.supportVectorTabControl.Text = "Support vectors"; 132 this.supportVectorTabControl.UseVisualStyleBackColor = true; 133 // 134 // supportVectorViewHost 135 // 136 this.supportVectorViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 137 | System.Windows.Forms.AnchorStyles.Left) 138 | System.Windows.Forms.AnchorStyles.Right))); 139 this.supportVectorViewHost.Caption = "SupportVectors"; 140 this.supportVectorViewHost.Content = null; 141 this.supportVectorViewHost.Location = new System.Drawing.Point(6, 6); 142 this.supportVectorViewHost.Name = "supportVectorViewHost"; 143 this.supportVectorViewHost.ReadOnly = false; 144 this.supportVectorViewHost.Size = new System.Drawing.Size(227, 207); 145 this.supportVectorViewHost.TabIndex = 1; 146 this.supportVectorViewHost.ViewType = null; 110 147 // 111 148 // SupportVectorRegressionSolutionView … … 120 157 this.modelTabPage.ResumeLayout(false); 121 158 this.dataTabPage.ResumeLayout(false); 159 this.supportVectorTabControl.ResumeLayout(false); 122 160 this.ResumeLayout(false); 123 161 … … 131 169 private System.Windows.Forms.TabPage dataTabPage; 132 170 private HeuristicLab.MainForm.WindowsForms.ViewHost dataPanel; 171 private System.Windows.Forms.TabPage supportVectorTabControl; 172 private HeuristicLab.MainForm.WindowsForms.ViewHost supportVectorViewHost; 133 173 134 174 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/SupportVectorRegressionSolutionView.cs
r3855 r3858 59 59 dataPanel.Content = Content.ProblemData; 60 60 modelPanel.Content = Content.Model; 61 supportVectorViewHost.Content = Content.SupportVectors; 61 62 } else { 62 63 dataPanel.Content = null; 63 64 modelPanel.Content = null; 65 supportVectorViewHost.Content = null; 64 66 } 65 67 }
Note: See TracChangeset
for help on using the changeset viewer.