Changeset 8470
- Timestamp:
- 08/10/12 17:07:20 (12 years ago)
- Location:
- branches/NCA
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/NCA/HeuristicLab.Algorithms.NCA.Views/3.3/NCADimensionReductionView.cs
r8466 r8470 64 64 var rows = Content.ProblemData.ClassValues 65 65 .ToDictionary(c => c, c => new ScatterPlotDataRow(Content.ProblemData.GetClassName(c), string.Empty, Enumerable.Empty<Point2D<double>>())); 66 foreach (var r in rows.Values) 67 r.VisualProperties.PointSize = 5; 66 68 67 69 IEnumerable<int> range = null; -
branches/NCA/HeuristicLab.Algorithms.NCA/3.3/NcaAlgorithm.cs
r8466 r8470 45 45 public sealed class NcaAlgorithm : FixedDataAnalysisAlgorithm<IClassificationProblem> { 46 46 #region Parameter Properties 47 public I ValueLookupParameter<IntValue> KParameter {48 get { return (I ValueLookupParameter<IntValue>)Parameters["K"]; }47 public IFixedValueParameter<IntValue> KParameter { 48 get { return (IFixedValueParameter<IntValue>)Parameters["K"]; } 49 49 } 50 50 public IFixedValueParameter<IntValue> DimensionsParameter { … … 63 63 64 64 #region Properties 65 private IntValue K { 66 get { return KParameter.Value; } 65 private int K { 66 get { return KParameter.Value.Value; } 67 set { KParameter.Value.Value = value; } 67 68 } 68 69 private int Dimensions { … … 85 86 public NcaAlgorithm() 86 87 : base() { 87 Parameters.Add(new ValueLookupParameter<IntValue>("K", "The K for the nearest neighbor.", new IntValue(1)));88 Parameters.Add(new FixedValueParameter<IntValue>("K", "The K for the nearest neighbor.", new IntValue(1))); 88 89 Parameters.Add(new FixedValueParameter<IntValue>("Dimensions", "The number of dimensions that NCA should reduce the data to.", new IntValue(2))); 89 90 Parameters.Add(new ConstrainedValueParameter<INCAInitializer>("Initialization", "Which method should be used to initialize the matrix. Typically LDA (linear discriminant analysis) should provide a good estimate.")); … … 110 111 111 112 protected override void Run() { 112 var k = K.Value;113 113 var initializer = InitializationParameter.Value; 114 114 115 115 var clonedProblem = (IClassificationProblemData)Problem.ProblemData.Clone(); 116 var model = Train(clonedProblem, k, Dimensions, NeighborSamples, Iterations, initializer.Initialize(clonedProblem, Dimensions), ReportQuality, CancellationToken.None);116 var model = Train(clonedProblem, K, Dimensions, NeighborSamples, Iterations, initializer.Initialize(clonedProblem, Dimensions), ReportQuality, CancellationToken.None); 117 117 Results.Add(new Result("ClassificationSolution", "The classification solution.", model.CreateClassificationSolution(clonedProblem))); 118 118 }
Note: See TracChangeset
for help on using the changeset viewer.