Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15551


Ignore:
Timestamp:
12/20/17 10:06:25 (7 years ago)
Author:
bwerth
Message:

#2850 fixed event registration

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/Distances/WeightedEuclideanDistance.cs

    r15532 r15551  
    5050    [StorableConstructor]
    5151    protected WeightedEuclideanDistance(bool deserializing) : base(deserializing) { }
     52    [StorableHook(HookType.AfterDeserialization)]
    5253    private void AfterDeserialization() {
    5354      RegisterParameterEvents();
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNEAlgorithm.cs

    r15548 r15551  
    230230        state = cloner.Clone(original.state);
    231231      iter = original.iter;
     232      RegisterParameterEvents();
    232233    }
    233234    public override IDeepCloneable Clone(Cloner cloner) {
     
    322323    protected override void RegisterProblemEvents() {
    323324      base.RegisterProblemEvents();
     325      if (Problem == null) return;
     326      Problem.ProblemDataChanged -= OnProblemDataChanged;
    324327      Problem.ProblemDataChanged += OnProblemDataChanged;
     328      if (Problem.ProblemData == null) return;
     329      Problem.ProblemData.Changed -= OnPerplexityChanged;
     330      Problem.ProblemData.Changed -= OnColumnsChanged;
     331      Problem.ProblemData.Changed += OnPerplexityChanged;
     332      Problem.ProblemData.Changed += OnColumnsChanged;
     333      if (Problem.ProblemData.Dataset == null) return;
     334      Problem.ProblemData.Dataset.RowsChanged -= OnPerplexityChanged;
     335      Problem.ProblemData.Dataset.ColumnsChanged -= OnColumnsChanged;
     336      Problem.ProblemData.Dataset.RowsChanged += OnPerplexityChanged;
     337      Problem.ProblemData.Dataset.ColumnsChanged += OnColumnsChanged;
    325338    }
    326339
     
    341354      OnPerplexityChanged(this, null);
    342355      OnColumnsChanged(this, null);
     356      Problem.ProblemData.Changed -= OnPerplexityChanged;
    343357      Problem.ProblemData.Changed += OnPerplexityChanged;
     358      Problem.ProblemData.Changed -= OnColumnsChanged;
    344359      Problem.ProblemData.Changed += OnColumnsChanged;
     360      if (Problem.ProblemData.Dataset == null) return;
     361      Problem.ProblemData.Dataset.RowsChanged -= OnPerplexityChanged;
     362      Problem.ProblemData.Dataset.ColumnsChanged -= OnColumnsChanged;
    345363      Problem.ProblemData.Dataset.RowsChanged += OnPerplexityChanged;
    346364      Problem.ProblemData.Dataset.ColumnsChanged += OnColumnsChanged;
     
    401419      var classificationData = problemData as ClassificationProblemData;
    402420      if (classificationData != null && classificationData.TargetVariable.Equals(ClassesName)) {
    403         var classNames = classificationData.ClassValues.Zip(classificationData.ClassNames, (v, n) => new { v, n }).ToDictionary(x => x.v, x => x.n);
     421        var classNames = classificationData.ClassValues.Zip(classificationData.ClassNames, (v, n) => new {v, n}).ToDictionary(x => x.v, x => x.n);
    404422        var classes = classificationData.Dataset.GetDoubleValues(classificationData.TargetVariable, allIndices).Select(v => classNames[v]).ToArray();
    405423        for (var i = 0; i < classes.Length; i++) {
     
    420438        double[][] borders;
    421439        CreateClusters(clusterdata, ClassesName, contours, out clusterModel, out contourMap, out borders);
    422         var contourorder = borders.Select((x, i) => new { x, i }).OrderBy(x => x.x[0]).Select(x => x.i).ToArray();
     440        var contourorder = borders.Select((x, i) => new {x, i}).OrderBy(x => x.x[0]).Select(x => x.i).ToArray();
    423441        for (var i = 0; i < contours; i++) {
    424442          var c = contourorder[i];
     
    437455        double[][] borders;
    438456        CreateClusters(clusterdata, ClassesName, contours, out clusterModel, out contourMap, out borders);
    439         var contourorder = borders.Select((x, i) => new { x, i }).OrderBy(x => x.x[0]).Select(x => x.i).ToArray();
     457        var contourorder = borders.Select((x, i) => new {x, i}).OrderBy(x => x.x[0]).Select(x => x.i).ToArray();
    440458        for (var i = 0; i < contours; i++) {
    441459          var c = contourorder[i];
Note: See TracChangeset for help on using the changeset viewer.