Changeset 5853
- Timestamp:
- 03/29/11 00:39:18 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
- Files:
-
- 1 added
- 1 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Clustering/ClusteringSolutionEstimatedClusterView.cs
r5851 r5853 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Views { 31 [View("ClassificationSolution EstimatedClassValues")] 32 [Content(typeof(IClassificationSolution))] 33 public partial class ClassificationSolutionEstimatedClassValuesView : ItemView, IClassificationSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedClassValues"; 31 [View("ClusteringSolution EstimatedCluster")] 32 [Content(typeof(IClusteringSolution))] 33 public partial class ClusteringSolutionEstimatedClusterView : ItemView, IClusteringSolutionEvaluationView { 34 private const string CLUSTER_NAMES = "Cluster"; 36 35 37 public new ICl assificationSolution Content {38 get { return (ICl assificationSolution)base.Content; }36 public new IClusteringSolution Content { 37 get { return (IClusteringSolution)base.Content; } 39 38 set { 40 39 base.Content = value; … … 44 43 private StringConvertibleMatrixView matrixView; 45 44 46 public Cl assificationSolutionEstimatedClassValuesView()45 public ClusteringSolutionEstimatedClusterView() 47 46 : base() { 48 47 InitializeComponent(); … … 77 76 protected override void OnContentChanged() { 78 77 base.OnContentChanged(); 79 Update EstimatedValues();78 UpdateClusterValues(); 80 79 } 81 80 82 private void Update EstimatedValues() {83 if (InvokeRequired) Invoke((Action)Update EstimatedValues);81 private void UpdateClusterValues() { 82 if (InvokeRequired) Invoke((Action)UpdateClusterValues); 84 83 else { 85 84 DoubleMatrix matrix = null; 86 85 if (Content != null) { 87 double[,] values = new double[Content.ProblemData.Dataset.Rows, 2]; 86 int[] clusters = Content.Model.GetClusterValues(Content.ProblemData.Dataset, Enumerable.Range(0, Content.ProblemData.Dataset.Rows)).ToArray(); 87 var dataset = Content.ProblemData.Dataset; 88 int columns = Content.ProblemData.AllowedInputVariables.Count() + 1; 89 var columnsIndixes = Content.ProblemData.AllowedInputVariables.Select(x => dataset.GetVariableIndex(x)).ToList(); 88 90 89 double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable); 90 double[] estimated = Content.EstimatedClassValues.ToArray(); 91 for (int row = 0; row < target.Length; row++) { 92 values[row, 0] = target[row]; 93 values[row, 1] = estimated[row]; 91 double[,] values = new double[dataset.Rows, columns]; 92 for (int row = 0; row < dataset.Rows; row++) { 93 values[row, 0] = clusters[row]; 94 95 int column = 1; 96 foreach (int columnIndex in columnsIndixes) { 97 values[row, column] = dataset[row, columnIndex]; 98 column++; 99 } 94 100 } 95 101 96 102 matrix = new DoubleMatrix(values); 97 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME }; 103 var columnNames = dataset.VariableNames.ToList(); 104 columnNames.Insert(0, CLUSTER_NAMES); 105 matrix.ColumnNames = columnNames; 98 106 } 99 107 matrixView.Content = matrix; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/ClusteringSolutionView.Designer.cs
r5851 r5853 21 21 22 22 namespace HeuristicLab.Problems.DataAnalysis.Views { 23 partial class RegressionSolutionView {23 partial class ClusteringSolutionView { 24 24 /// <summary> 25 25 /// Required designer variable. -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/ClusteringSolutionView.cs
r5851 r5853 27 27 namespace HeuristicLab.Problems.DataAnalysis.Views { 28 28 [View("RegressionSolution View")] 29 [Content(typeof( RegressionSolution), true)]30 public partial class RegressionSolutionView : DataAnalysisSolutionView {31 public RegressionSolutionView() {29 [Content(typeof(ClusteringSolution), true)] 30 public partial class ClusteringSolutionView : DataAnalysisSolutionView { 31 public ClusteringSolutionView() { 32 32 InitializeComponent(); 33 33 34 var regressionSolutionEvaluationViewTypes = ApplicationManager.Manager.GetTypes(typeof(IRegressionSolutionEvaluationView), true);35 foreach (Type viewType in regressionSolutionEvaluationViewTypes)34 var clusteringSolutionEvaluationViewTypes = ApplicationManager.Manager.GetTypes(typeof(IClusteringSolutionEvaluationView), true); 35 foreach (Type viewType in clusteringSolutionEvaluationViewTypes) 36 36 AddViewListViewItem(viewType); 37 37 } 38 38 39 public new RegressionSolution Content {40 get { return ( RegressionSolution)base.Content; }39 public new ClusteringSolution Content { 40 get { return (ClusteringSolution)base.Content; } 41 41 set { base.Content = value; } 42 42 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r5829 r5853 146 146 <DependentUpon>DiscriminantFunctionClassificationSolutionThresholdView.cs</DependentUpon> 147 147 </Compile> 148 <Compile Include="Clustering\ClusteringSolutionEstimatedClusterView.cs"> 149 <SubType>UserControl</SubType> 150 </Compile> 151 <Compile Include="Clustering\ClusteringSolutionEstimatedClusterView.Designer.cs"> 152 <DependentUpon>ClusteringSolutionEstimatedClusterView.cs</DependentUpon> 153 </Compile> 154 <Compile Include="ClusteringSolutionView.cs"> 155 <SubType>UserControl</SubType> 156 </Compile> 157 <Compile Include="ClusteringSolutionView.Designer.cs"> 158 <DependentUpon>ClusteringSolutionView.cs</DependentUpon> 159 </Compile> 148 160 <Compile Include="DiscriminantFunctionClassificationSolutionView.cs"> 149 161 <SubType>UserControl</SubType> … … 296 308 </BootstrapperPackage> 297 309 </ItemGroup> 298 <ItemGroup> 299 <Folder Include="Clustering\" /> 300 </ItemGroup> 310 <ItemGroup /> 301 311 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 302 312 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.