Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14787


Ignore:
Timestamp:
03/27/17 15:28:48 (7 years ago)
Author:
gkronber
Message:

#2700: more changes while reviewing

Location:
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
3 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r14785 r14787  
    331331    <Compile Include="Interfaces\ISupportVectorMachineSolution.cs" />
    332332    <Compile Include="Interfaces\IDataAnalysisAlgorithm.cs" />
    333     <Compile Include="Interfaces\TSNEInterfaces\ICell.cs" />
    334     <Compile Include="Interfaces\TSNEInterfaces\IDataPoint.cs" />
    335333    <Compile Include="Interfaces\TSNEInterfaces\IDistance.cs" />
    336334    <Compile Include="Interfaces\TSNEInterfaces\ISpacePartitioningTree.cs" />
     
    418416    </Compile>
    419417    <Compile Include="TimeSeries\AutoregressiveModeling.cs" />
    420     <Compile Include="TSNE\Cell.cs" />
    421418    <Compile Include="TSNE\Distances\DistanceBase.cs" />
    422419    <Compile Include="TSNE\Distances\EuclideanDistance.cs" />
  • branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/SpacePartitioningTree.cs

    r14785 r14787  
    5858using System.Linq;
    5959using HeuristicLab.Common;
    60 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    6160
    6261namespace HeuristicLab.Algorithms.DataAnalysis {
     
    6463  /// Space partitioning tree (SPTree)
    6564  /// </summary>
    66   [StorableClass]
    67   public class SpacePartitioningTree : DeepCloneable, ISpacePartitioningTree {
     65  public class SpacePartitioningTree : ISpacePartitioningTree {
    6866    private const uint QT_NODE_CAPACITY = 1;
    6967
    70     #region properties
    71     [Storable]
    7268    private double[] buff;
    73     [Storable]
    7469    private SpacePartitioningTree parent;
    75     [Storable]
    7670    private int dimension;
    77     [Storable]
    7871    private bool isLeaf;
    79     [Storable]
    8072    private uint size;
    81     [Storable]
    8273    private uint cumulativeSize;
    8374
    8475    // Axis-aligned bounding box stored as a center with half-dimensions to represent the boundaries of this quad tree
    85     [Storable]
    86     private ICell boundary;
     76    private Cell boundary;
    8777
    8878    // Indices in this space-partitioning tree node, corresponding center-of-mass, and list of all children
    89     [Storable]
    90     public double[,] Data { private get; set; }
    91     [Storable]
     79    public double[,] Data { private get; set; } // TODO public setter, private getter?
     80
    9281    private double[] centerOfMass;
    93     [Storable]
    94     private int[] index = new int[QT_NODE_CAPACITY];
     82    private readonly int[] index = new int[QT_NODE_CAPACITY];
    9583
    9684    // Children
    9785    private SpacePartitioningTree[] children;
    98     [Storable]
    9986    private uint noChildren;
    100     #endregion
    101 
    102     #region HLConstructors & Cloning
    103     [StorableConstructor]
    104     protected SpacePartitioningTree(bool deserializing) { }
    105     protected SpacePartitioningTree(SpacePartitioningTree original, Cloner cloner)
    106       : base(original, cloner) {
    107       buff = original.buff.Select(x => x).ToArray();
    108       parent = cloner.Clone(original.parent);
    109       dimension = original.dimension;
    110       isLeaf = original.isLeaf;
    111       size = original.size;
    112       cumulativeSize = original.cumulativeSize;
    113       boundary = cloner.Clone(original.boundary);
    114       if (original.Data != null) {
    115         Data = new double[size, dimension];
    116         Buffer.BlockCopy(original.Data, 0, Data, 0, original.Data.Length * sizeof(double));
    117       }
    118       centerOfMass = original.centerOfMass.Select(x => x).ToArray();
    119       index = original.index.Select(x => x).ToArray();
    120       children = original.children.Select(cloner.Clone).ToArray();
    121       noChildren = original.noChildren;
    122     }
    123     public override IDeepCloneable Clone(Cloner cloner) { return new SpacePartitioningTree(this, cloner); }
    12487
    12588    public SpacePartitioningTree(double[,] inpData) {
     
    151114      Init(parent, inpData, impCorner, impWith);
    152115    }
    153     #endregion
    154116
    155117    public ISpacePartitioningTree GetParent() {
     
    327289    #endregion
    328290
     291
     292    private class Cell  {
     293      private readonly uint dimension;
     294      private readonly double[] corner;
     295      private readonly double[] width;
     296
     297      public Cell(uint inpDimension) {
     298        dimension = inpDimension;
     299        corner = new double[dimension];
     300        width = new double[dimension];
     301      }
     302
     303      public double GetCorner(int d) {
     304        return corner[d];
     305      }
     306      public double GetWidth(int d) {
     307        return width[d];
     308      }
     309      public void SetCorner(int d, double val) {
     310        corner[d] = val;
     311      }
     312      public void SetWidth(int d, double val) {
     313        width[d] = val;
     314      }
     315      public bool ContainsPoint(double[] point) {
     316        for (var d = 0; d < dimension; d++)
     317          if (corner[d] - width[d] > point[d] || corner[d] + width[d] < point[d]) return false;
     318        return true;
     319      }
     320    }
    329321  }
    330322}
  • branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/VantagePointTree.cs

    r14785 r14787  
    5454#endregion
    5555
    56 using System;
    5756using System.Collections.Generic;
    5857using System.Linq;
    5958using HeuristicLab.Collections;
    60 using HeuristicLab.Common;
    61 using HeuristicLab.Core;
    62 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    6359using HeuristicLab.Random;
    6460
     
    7268  /// </summary>
    7369  /// <typeparam name="T"></typeparam>
    74   [StorableClass]
    7570  public class VantagePointTree<T> : IVantagePointTree<T> {
    7671    #region properties
Note: See TracChangeset for help on using the changeset viewer.