Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/08/16 14:24:51 (9 years ago)
Author:
abeham
Message:

#2457: Added SOM projection for problem instances, fixed a bug (learningRadius was not used)

Location:
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/HeuristicLab.OptimizationExpertSystem.Common-3.3.csproj

    r13722 r13750  
    132132      <Private>False</Private>
    133133    </Reference>
     134    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     135      <SpecificVersion>False</SpecificVersion>
     136      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     137      <Private>False</Private>
     138    </Reference>
    134139    <Reference Include="System" />
    135140    <Reference Include="System.Core" />
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs

    r13748 r13750  
    2121
    2222using HeuristicLab.Analysis;
     23using HeuristicLab.Analysis.SelfOrganizingMaps;
    2324using HeuristicLab.Collections;
    2425using HeuristicLab.Common;
     
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Persistence.Default.Xml;
     32using HeuristicLab.Random;
    3133using System;
    3234using System.Collections.Generic;
     
    232234      alglib.pcabuildbasis(ds, ds.GetLength(0), ds.GetLength(1), out info, out s2, out v);
    233235      #endregion
     236      #region SOM
     237      var features = new DoubleMatrix(commonCharacteristics.Count, instances.Count);
     238      foreach (var instance in instances) {
     239        var arr = instance.Value;
     240        for (var feature = 0; feature < arr.Length; feature++)
     241          features[feature, key2Idx.GetByFirst(instance.Key)] = arr[feature];
     242      }
     243      var somCoords = SOM.Map(features, new MersenneTwister(42), somSize: 20, learningRadius: 20, jittering: true);
     244      #endregion
    234245
    235246      ProblemInstances.UpdateOfRunsInProgress = true;
     
    256267            ((DoubleValue)item).Value = coords[key2Idx.GetByFirst(instance.Name), 1];
    257268          } else instance.Results.Add("Projection.MDS.Y", new DoubleValue(coords[key2Idx.GetByFirst(instance.Name), 1]));
     269
     270          if (instance.Results.TryGetValue("Projection.SOM.X", out item)) {
     271            ((DoubleValue)item).Value = somCoords[key2Idx.GetByFirst(instance.Name), 0];
     272          } else instance.Results.Add("Projection.SOM.X", new DoubleValue(somCoords[key2Idx.GetByFirst(instance.Name), 0]));
     273          if (instance.Results.TryGetValue("Projection.SOM.Y", out item)) {
     274            ((DoubleValue)item).Value = somCoords[key2Idx.GetByFirst(instance.Name), 1];
     275          } else instance.Results.Add("Projection.SOM.Y", new DoubleValue(somCoords[key2Idx.GetByFirst(instance.Name), 1]));
    258276        }
    259277      } finally { ProblemInstances.UpdateOfRunsInProgress = false; }
Note: See TracChangeset for help on using the changeset viewer.