Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14667


Ignore:
Timestamp:
02/11/17 01:07:19 (8 years ago)
Author:
abeham
Message:

#2457: added TSNE visualization of problem instance map

Location:
branches/PerformanceComparison
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Algorithms.MemPR/3.3

    • Property svn:ignore
      •  

        old new  
        99GeneratedArtifacts
        1010_Pvt_Extensions
         11*.DotSettings
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs

    r13878 r14667  
    3939using System.Threading;
    4040using System.Threading.Tasks;
     41using HeuristicLab.Algorithms.DataAnalysis;
    4142using Algorithm = HeuristicLab.Clients.OKB.Administration.Algorithm;
    4243using Problem = HeuristicLab.Clients.OKB.Administration.Problem;
     
    237238      var somCoords = SOM.Map(features, new MersenneTwister(42), somSize: 10, learningRadius: 20, iterations: 200, jittering: true);
    238239      #endregion
     240      #region TSNE
     241      var tsneFeatures = new DoubleArray[instances.Count];
     242      foreach (var instance in instances) {
     243        tsneFeatures[key2Idx.GetByFirst(instance.Key)] = new DoubleArray(instance.Value);
     244      }
     245      var tsneCoords = TSNE<DoubleArray>.Run(tsneFeatures, 2, Math.Min((instances.Count - 1) / 3, 50), 0.1, (a, b) => Math.Sqrt(a.Zip(b, (c, d) => (c - d) * (c - d)).Sum()), new FastRandom(42));
     246      #endregion
    239247
    240248      ProblemInstances.UpdateOfRunsInProgress = true;
     
    273281            ((DoubleValue)item).Value = somCoords[key2Idx.GetByFirst(instance), 1];
    274282          } else instance.Results.Add("Projection.SOM.Y", new DoubleValue(somCoords[key2Idx.GetByFirst(instance), 1]));
     283
     284          if (instance.Results.TryGetValue("Projection.TSNE.X", out item)) {
     285            ((DoubleValue)item).Value = tsneCoords[key2Idx.GetByFirst(instance), 0];
     286          } else instance.Results.Add("Projection.TSNE.X", new DoubleValue(tsneCoords[key2Idx.GetByFirst(instance), 0]));
     287          if (instance.Results.TryGetValue("Projection.TSNE.Y", out item)) {
     288            ((DoubleValue)item).Value = tsneCoords[key2Idx.GetByFirst(instance), 1];
     289          } else instance.Results.Add("Projection.TSNE.Y", new DoubleValue(tsneCoords[key2Idx.GetByFirst(instance), 1]));
    275290        }
    276291      } finally { ProblemInstances.UpdateOfRunsInProgress = false; }
Note: See TracChangeset for help on using the changeset viewer.