Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/17 08:37:27 (7 years ago)
Author:
bwerth
Message:

#2700 fixed displaying of randomly generated seed and some minor code simplifications

File:
1 edited

Legend:

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

    r14558 r14742  
    132132      this.results = results;
    133133      this.dataRowLookup = dataRowLookup;
    134       if (dataRows != null)
    135         this.dataRows = dataRows;
     134      if (dataRows != null) this.dataRows = dataRows;
    136135      else { this.dataRows = new Dictionary<string, ScatterPlotDataRow>(); }
    137136    }
     
    200199
    201200    private void SetUpResults(IReadOnlyCollection<T> data) {
    202       if (dataRowLookup == null) {
    203         dataRowLookup = new Dictionary<string, List<int>>();
    204         dataRowLookup.Add("Data", Enumerable.Range(0, data.Count).ToList());
    205       }
     201      if (dataRowLookup == null) dataRowLookup = new Dictionary<string, List<int>> { { "Data", Enumerable.Range(0, data.Count).ToList() } };
    206202      if (results == null) return;
     203
    207204      if (!results.ContainsKey(IterationResultName)) results.Add(new Result(IterationResultName, new IntValue(0)));
    208205      else ((IntValue)results[IterationResultName].Value).Value = 0;
     
    216213      var plot = results[ErrorPlotResultName].Value as DataTable;
    217214      if (plot == null) throw new ArgumentException("could not create/access Error-DataTable in Results-Collection");
    218       if (!plot.Rows.ContainsKey("errors")) {
    219         plot.Rows.Add(new DataRow("errors"));
    220       }
     215
     216      if (!plot.Rows.ContainsKey("errors")) plot.Rows.Add(new DataRow("errors"));
    221217      plot.Rows["errors"].Values.Clear();
     218
    222219      results.Add(new Result(ScatterPlotResultName, "Plot of the projected data", new ScatterPlot(DataResultName, "")));
    223220      results.Add(new Result(DataResultName, "Projected Data", new DoubleMatrix()));
     
    245242    private void FillScatterPlot(double[,] lowDimData, ScatterPlot plot) {
    246243      foreach (var rowName in dataRowLookup.Keys) {
    247         if (!plot.Rows.ContainsKey(rowName)) {
     244        if (!plot.Rows.ContainsKey(rowName))
    248245          plot.Rows.Add(dataRows.ContainsKey(rowName) ? dataRows[rowName] : new ScatterPlotDataRow(rowName, "", new List<Point2D<double>>()));
    249         }
    250         //else plot.Rows[rowName].Points.Clear();
    251246        plot.Rows[rowName].Points.Replace(dataRowLookup[rowName].Select(i => new Point2D<double>(lowDimData[i, 0], lowDimData[i, 1])));
    252         //plot.Rows[rowName].Points.AddRange();
    253247      }
    254248    }
     
    503497      tree.ComputeEdgeForces(rowP, colP, valP, n, posF);
    504498      var row = new double[d];
    505       for (int n1 = 0; n1 < n; n1++) {
     499      for (var n1 = 0; n1 < n; n1++) {
    506500        Buffer.BlockCopy(negF, (sizeof(double) * n1 * d), row, 0, d);
    507501        tree.ComputeNonEdgeForces(n1, theta, row, sumQ);
Note: See TracChangeset for help on using the changeset viewer.