Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringSolution.cs @ 6254

Last change on this file since 6254 was 6184, checked in by gkronber, 13 years ago

#1450: merged r5816 from the branch and implemented first version of ensemble solutions for regression. The ensembles are only produced by cross validation.

File size: 2.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.Collections.Generic;
23using System.Linq;
24using HeuristicLab.Common;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Problems.DataAnalysis {
28  /// <summary>
29  /// Represents a clustering data analysis solution
30  /// </summary>
31  [StorableClass]
32  public class ClusteringSolution : DataAnalysisSolution, IClusteringSolution {
33
34    [StorableConstructor]
35    protected ClusteringSolution(bool deserializing) : base(deserializing) { }
36    protected ClusteringSolution(ClusteringSolution original, Cloner cloner)
37      : base(original, cloner) {
38    }
39    public ClusteringSolution(IClusteringModel model, IClusteringProblemData problemData)
40      : base(model, problemData) {
41    }
42
43    public override IDeepCloneable Clone(Cloner cloner) {
44      return new ClusteringSolution(this, cloner);
45    }
46
47    #region IClusteringSolution Members
48
49    public new IClusteringModel Model {
50      get { return (IClusteringModel)base.Model; }
51      set { base.Model = value; }
52    }
53
54    public new IClusteringProblemData ProblemData {
55      get { return (IClusteringProblemData)base.ProblemData; }
56      set { base.ProblemData = value; }
57    }
58
59    public virtual IEnumerable<int> ClusterValues {
60      get {
61        return GetClusterValues(Enumerable.Range(0, ProblemData.Dataset.Rows));
62      }
63    }
64
65    public virtual IEnumerable<int> TrainingClusterValues {
66      get {
67        return GetClusterValues(ProblemData.TrainingIndizes);
68      }
69    }
70
71    public virtual IEnumerable<int> TestClusterValues {
72      get {
73        return GetClusterValues(ProblemData.TestIndizes);
74      }
75    }
76
77    public virtual IEnumerable<int> GetClusterValues(IEnumerable<int> rows) {
78      return Model.GetClusterValues(ProblemData.Dataset, rows);
79    }
80    #endregion
81  }
82}
Note: See TracBrowser for help on using the repository browser.