- Timestamp:
- 03/10/17 08:37:27 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNE.cs
r14558 r14742 132 132 this.results = results; 133 133 this.dataRowLookup = dataRowLookup; 134 if (dataRows != null) 135 this.dataRows = dataRows; 134 if (dataRows != null) this.dataRows = dataRows; 136 135 else { this.dataRows = new Dictionary<string, ScatterPlotDataRow>(); } 137 136 } … … 200 199 201 200 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() } }; 206 202 if (results == null) return; 203 207 204 if (!results.ContainsKey(IterationResultName)) results.Add(new Result(IterationResultName, new IntValue(0))); 208 205 else ((IntValue)results[IterationResultName].Value).Value = 0; … … 216 213 var plot = results[ErrorPlotResultName].Value as DataTable; 217 214 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")); 221 217 plot.Rows["errors"].Values.Clear(); 218 222 219 results.Add(new Result(ScatterPlotResultName, "Plot of the projected data", new ScatterPlot(DataResultName, ""))); 223 220 results.Add(new Result(DataResultName, "Projected Data", new DoubleMatrix())); … … 245 242 private void FillScatterPlot(double[,] lowDimData, ScatterPlot plot) { 246 243 foreach (var rowName in dataRowLookup.Keys) { 247 if (!plot.Rows.ContainsKey(rowName)) {244 if (!plot.Rows.ContainsKey(rowName)) 248 245 plot.Rows.Add(dataRows.ContainsKey(rowName) ? dataRows[rowName] : new ScatterPlotDataRow(rowName, "", new List<Point2D<double>>())); 249 }250 //else plot.Rows[rowName].Points.Clear();251 246 plot.Rows[rowName].Points.Replace(dataRowLookup[rowName].Select(i => new Point2D<double>(lowDimData[i, 0], lowDimData[i, 1]))); 252 //plot.Rows[rowName].Points.AddRange();253 247 } 254 248 } … … 503 497 tree.ComputeEdgeForces(rowP, colP, valP, n, posF); 504 498 var row = new double[d]; 505 for ( intn1 = 0; n1 < n; n1++) {499 for (var n1 = 0; n1 < n; n1++) { 506 500 Buffer.BlockCopy(negF, (sizeof(double) * n1 * d), row, 0, d); 507 501 tree.ComputeNonEdgeForces(n1, theta, row, sumQ);
Note: See TracChangeset
for help on using the changeset viewer.