BlosSOM
Interactive dimensionality reduction on large datasets (EmbedSOM and FLOWER combined)
state.cpp
Go to the documentation of this file.
1/* This file is part of BlosSOM.
2 *
3 * Copyright (C) 2021 Martin Krulis
4 * Mirek Kratochvil
5 * Sona Molnarova
6 *
7 * BlosSOM is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 3 of the License, or (at your option)
10 * any later version.
11 *
12 * BlosSOM is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * BlosSOM. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include "state.h"
22#include "fcs_parser.h"
23#include "tsv_parser.h"
24
25void
26State::update(float actual_time, bool vert_pressed, int vert_ind)
27{
28 // avoid simulation explosions on long frames
29 float time = actual_time;
30 if (time > 0.05)
31 time = 0.05;
32
33 // Compute time for estimation batch sizes computations.
35
37
40
41 // TODO only run this on data reset, ideally from trans or from a common
42 // trigger
43#ifdef STATE_DEBUG // TODO remove
45#else
47#endif
48
51 scaled,
55 landmarks);
56
60 training_conf.kns); // TODO: Edges are not removed, once
61 // they are created.
62
64 graph_layout_step(layout_data, vert_pressed, vert_ind, landmarks, time);
65
67 tsne_layout_step(tsne_data, vert_pressed, vert_ind, landmarks, time);
68
71 scaled,
75 landmarks);
76
79}
void graph_layout_step(GraphLayoutData &data, bool vert_pressed, int vert_ind, LandmarkModel &lm, float time)
One iteration step of the landmark layouting algorithm.
void kmeans_landmark_step(KMeansData &data, const ScaledData &model, size_t iters, float alpha, float gravity, LandmarkModel &lm)
Run a k-means-like optimization of high-dimensional landmark positions.
void som_landmark_step(KMeansData &data, const ScaledData &model, size_t iters, float alpha, float sigma, LandmarkModel &lm)
Run a SOM to optimize high-dimensional landmark positions.
void make_knn_edges(KnnEdgesData &data, LandmarkModel &landmarks, const size_t kns)
Definition: knn_edges.cpp:33
void update(const TransData &td, const LandmarkModel &lm, FrameStats &frame_stats)
Recomputes color of the 2D data points if user has changed any of the color settings.
Definition: color_data.cpp:25
void update_times()
Compute durations of the estimation batch sizes computations.
Definition: frame_stats.h:91
void update_dim(size_t dim)
Updates current dimension and calls init_grid().
void update(const DataModel &dm)
Recomputes the statistics if the input data changed.
Definition: trans_data.cpp:24
void update(const TransData &td, FrameStats &frame_stats)
Recomputes the data if any of the config has been touched.
Definition: scaled_data.cpp:25
size_t dim() const
Returns dimension of the scaled data.
Definition: scaled_data.h:66
void update(const ScaledData &d, const LandmarkModel &lm, const TrainingConfig &tc, FrameStats &frame_stats)
Recomputes the coordinates if any of the the parameters of the embedsom algorithm has changed.
DataModel data
Definition: state.h:51
void update(float time, bool vert_pressed, int vert_ind)
Performs simulation steps of all active algorithms and updates data according to the user interaction...
Definition: state.cpp:26
GraphLayoutData layout_data
Definition: state.h:58
ScaledData scaled
Definition: state.h:54
ScatterModel scatter
Definition: state.h:64
LandmarkModel landmarks
Definition: state.h:55
FrameStats frame_stats
Definition: state.h:66
TransData trans
Definition: state.h:53
RawDataStats stats
Definition: state.h:52
TSNELayoutData tsne_data
Definition: state.h:59
ColorData colors
Definition: state.h:63
KnnEdgesData knn_data
Definition: state.h:61
KMeansData kmeans_data
Definition: state.h:60
TrainingConfig training_conf
Definition: state.h:57
float sigma
Sigma value for SOM algorithm.
int kmeans_iters
Number of iterations value for kmeans algorithm.
float som_alpha
Alpha value for SOM algorithm.
bool tsne_layout
Flag that indicates if the t-SNE algorithm should be used.
int kns
k-neighbors value for generating knn graph algorithm.
int som_iters
Number of iterations value for SOM algorithm.
float gravity
Gravity value for kmeans algorithm.
bool graph_layout
Flag that indicates if the graph layout algorithm should be used.
float kmeans_alpha
Alpha value for kmeans algorithm.
bool som_landmark
Flag that indicates if the SOM algorithm should be used.
bool kmeans_landmark
Flag that indicates if the kmeans algorithm should be used.
bool knn_edges
Flag that indicates if the kNN graph should be generated.
void update(const DataModel &dm, const RawDataStats &s, FrameStats &frame_stats)
Recomputes the data if any of the config has been touched.
Definition: trans_data.cpp:53
void tsne_layout_step(TSNELayoutData &data, bool vert_pressed, int vert_ind, LandmarkModel &lm, float time)
Optimize the positions of low-dimensional landmarks using the t-SNE algorithm.
Definition: tsne_layout.cpp:28