BlosSOM
Interactive dimensionality reduction on large datasets (EmbedSOM and FLOWER combined)
scatter_model.h
Go to the documentation of this file.
1/* This file is part of BlosSOM.
2 *
3 * Copyright (C) 2021 Mirek Kratochvil
4 * Sona Molnarova
5 *
6 * BlosSOM is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
9 * any later version.
10 *
11 * BlosSOM is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * BlosSOM. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef SCATTER_MODEL_H
21#define SCATTER_MODEL_H
22
23#include <glm/glm.hpp>
24
25#include <vector>
26
27#include "batch_size_gen.h"
28#include "dirty.h"
29#include "landmark_model.h"
30#include "scaled_data.h"
31#include "training_config.h"
32
33#if ENABLE_CUDA
34#include "embedsom_cuda.h"
35#endif
36
37/**
38 * @brief Model of the two-dimensional data points.
39 *
40 */
41struct ScatterModel : public Sweeper
42{
43 /** Coordinates of the two-dimensional data points. */
44 std::vector<glm::vec2> points;
45
46#if ENABLE_CUDA
47 EmbedSOMCUDAContext embedsom_cuda;
48#endif
49
51
53
54 /**
55 * @brief Recomputes the coordinates if any of the the parameters of the
56 * embedsom algorithm has changed.
57 *
58 * @param d Scaled data used for recomputation.
59 * @param lm Landmark model used for recomputation.
60 * @param tc Dynamic parameters of the algorithms set in the GUI.
61 */
62 void update(const ScaledData &d,
63 const LandmarkModel &lm,
64 const TrainingConfig &tc,
65 FrameStats &frame_stats);
66
67 /**
68 * @brief Notifies @ref Sweeper that the parameters of the embedsom
69 * algorithm has been modified and that the coordinates has to be
70 * recomputed.
71 *
72 */
74 {
75 refresh(points.size());
76 }
77};
78
79#endif
Generator of the size of the next point batch.
A piece of cache that keeps track of the dirty status.
Definition: dirty.h:51
Data context wrapper for CUDA EmbedSOM.
Definition: embedsom_cuda.h:50
Model of the high- and low-dimensional landmarks.
Storage of the scaled data.
Definition: scaled_data.h:53
Model of the two-dimensional data points.
Definition: scatter_model.h:42
std::vector< glm::vec2 > points
Coordinates of the two-dimensional data points.
Definition: scatter_model.h:44
BatchSizeGen batch_size_gen
Definition: scatter_model.h:52
void touch_config()
Notifies Sweeper that the parameters of the embedsom algorithm has been modified and that the coordin...
Definition: scatter_model.h:73
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.
Cleaner lm_watch
Definition: scatter_model.h:50
A piece of multi-object cache.
Definition: dirty.h:95
void refresh(const Dirts &d)
Force-refresh the whole range.
Definition: dirty.h:105
Storage of the dynamic parameters of the algorithms that are set in the GUI by user.