![]() |
SG++-Doxygen-Documentation
|
#include <VisualizerDensityEstimation.hpp>
Public Member Functions | |
void | runVisualization (ModelFittingBase &model, DataSource &dataSource, size_t fold, size_t batch) override |
Method to run the visualization process for a given batch and fold. | |
VisualizerDensityEstimation ()=default | |
VisualizerDensityEstimation (VisualizerConfiguration config) | |
Constructor given a configuration. | |
~VisualizerDensityEstimation () override=default | |
Default destructor. | |
![]() | |
const VisualizerConfiguration & | getVisualizerConfiguration () const |
Get the configuration of the visualizer object. | |
Visualizer () | |
virtual | ~Visualizer ()=default |
Virtual destructor. | |
Protected Member Functions | |
void | getHeatmap (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which starts the heatmap generation for Density Estimation Models. | |
void | getHeatmap2D (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which generates the heatmap of models of 2 dimensions. | |
void | getHeatmap3D (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which generates the heatmap of models of 3 dimensions. | |
void | getHeatmapMore4D (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which generates the heatmap of models of 4 or more dimensions. | |
void | getLinearCuts (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which starts the linear cut generation for Density Estimation Models. | |
void | getLinearCuts1D (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which generates the linear cuts graphs for models of 1 dimension. | |
void | getLinearCuts2D (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which generates the linear cuts graphs for models of 2 dimensions. | |
void | getLinearCutsMore3D (ModelFittingBase &model, std::string currentDirectory, DataMatrix &matrix) |
Method which generates the linear cuts graphs for models of 3 or more dimensions. | |
void | initializeMatrices (ModelFittingBase &model, DataMatrix &cutMatrix, DataMatrix &heatMapMatrix) |
Method which builds the matrices used to generate the cuts and the heatmaps. | |
void | storeCutJson (DataMatrix &matrix, std::string filepath) |
Method to generate and store in json format for the plotly library the output of the linear cuts for models of 1 dimension. | |
void | storeCutJson (DataMatrix &matrix, std::vector< size_t > indexes, size_t &varDim, std::string filepath) |
Method to generate and store in json format for the plotly library the output of the linear cuts for models of 2 or more dimensions. | |
void | storeGrid (ModelFittingBase &model, std::string currentDirectory) |
Method which stores the coordinates of the grid points of a Density Estimation model. | |
void | storeHeatmapJson (DataMatrix &matrix, ModelFittingBase &model, std::string filepath) |
Method to generate and store in json format for the plotly library the output of the heatmaps for models of 2 dimensions. | |
void | storeHeatmapJson (DataMatrix &matrix, ModelFittingBase &model, std::vector< size_t > indexes, size_t &varDim1, size_t &varDim2, std::string filepath) |
Method to generate and store in json format for the plotly library the output of the hetamaps for models of 3 or more dimensions. | |
void | storeTsneJson (DataMatrix &matrix, ModelFittingBase &model, std::string currentDirectory) |
Method to generate and store in json format for the plotly library the output of the tsne algorithm. | |
void | swapColumns (DataMatrix &matrix, size_t col1, size_t col2) |
Method to swap to columns of a matrix. | |
void | translateColumns (DataMatrix &matrix, size_t maxColumns) |
Method which shifts one position the columns of a matrix from left to right in a circular fashion until the column given by the parameters maxColumns. | |
void | translateColumnsLeft (DataMatrix &matrix, std::vector< size_t > indexes) |
Method which shifts the columns given by the vector indexes of a matrix from right to left in a circular fashion. | |
void | translateColumnsRight (DataMatrix &matrix, std::vector< size_t > indexes) |
Method which shifts the columns given by the vector indexes of a matrix from left to right in a circular fashion. | |
void | updateIndexesCuts (std::vector< size_t > &columnIndexes, DataMatrix &matrix) |
Method to update the columns indexes to be shifted when generating the linear cuts. | |
void | updateIndexesHeatmap (std::vector< size_t > &columnIndexes, DataMatrix &matrix) |
Method to update the columns indexes to be shifted when generating the heatmap. | |
![]() | |
void | createFolder (std::string folder_path) |
Method to create a folder based on the operating system of the user. | |
Additional Inherited Members | |
![]() | |
VisualizerConfiguration | config |
Configuration object for the fitter. | |
std::string | currentDirectory |
Variable to store the current folder in which the visualizer is working on. | |
DataMatrix | originalData |
Matrix to store the data from the datasource. | |
size_t | resolution |
Resolution used in the graphs. | |
DataMatrix | tsneCompressedData |
Matrix to store the data provided by the tsne algorithm. | |
|
default |
|
explicit |
Constructor given a configuration.
config | The VisualizerConfiguration object which contains the configuration to run the visualization module |
References sgpp::datadriven::Visualizer::config.
|
overridedefault |
Default destructor.
|
protected |
Method which starts the heatmap generation for Density Estimation Models.
model | The model used to evaluate the heatmap |
currentDirectory | The current directory to store the heatmap results |
matrix | The matrix containing the points to evaluate the heatmap |
References sgpp::datadriven::Visualizer::createFolder(), sgpp::datadriven::Visualizer::currentDirectory, sgpp::base::GeneralGridConfiguration::dim_, sgpp::datadriven::ModelFittingBase::getFitterConfiguration(), sgpp::datadriven::FitterConfiguration::getGridConfig(), getHeatmap2D(), getHeatmap3D(), and getHeatmapMore4D().
Referenced by sgpp::datadriven::VisualizerClassification::runVisualization(), and runVisualization().
|
protected |
Method which generates the heatmap of models of 2 dimensions.
model | The model used to evaluate the heatmap |
currentDirectory | The current directory to store the heatmap results |
matrix | The matrix containing the points to evaluate the heatmap |
References sgpp::base::DataMatrix::appendCol(), sgpp::datadriven::Visualizer::config, sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::evaluate(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::json, storeHeatmapJson(), sgpp::datadriven::VisualizationGeneralConfig::targetFileType_, and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by getHeatmap().
|
protected |
Method which generates the heatmap of models of 3 dimensions.
model | The model used to evaluate the heatmap |
currentDirectory | The current directory to store the heatmap results |
matrix | The matrix containing the points to evaluate the heatmap |
References sgpp::base::DataMatrix::appendCol(), sgpp::datadriven::Visualizer::config, sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::evaluate(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::json, sgpp::datadriven::Visualizer::resolution, storeHeatmapJson(), sgpp::datadriven::VisualizationGeneralConfig::targetFileType_, translateColumns(), and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by getHeatmap().
|
protected |
Method which generates the heatmap of models of 4 or more dimensions.
model | The model used to evaluate the heatmap |
currentDirectory | The current directory to store the heatmap results |
matrix | The matrix containing the points to evaluate the heatmap |
References sgpp::base::DataMatrix::appendCol(), sgpp::datadriven::Visualizer::config, sgpp::datadriven::Visualizer::createFolder(), sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::evaluate(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::json, storeHeatmapJson(), sgpp::datadriven::VisualizationGeneralConfig::targetFileType_, translateColumnsLeft(), translateColumnsRight(), updateIndexesHeatmap(), and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by getHeatmap().
|
protected |
Method which starts the linear cut generation for Density Estimation Models.
model | The model used to evaluate the linear cuts |
currentDirectory | The current directory to store the linear cuts results |
matrix | The matrix containing the points to evaluate the cuts |
References sgpp::datadriven::Visualizer::createFolder(), sgpp::datadriven::Visualizer::currentDirectory, sgpp::base::GeneralGridConfiguration::dim_, sgpp::datadriven::ModelFittingBase::getFitterConfiguration(), sgpp::datadriven::FitterConfiguration::getGridConfig(), getLinearCuts1D(), getLinearCuts2D(), and getLinearCutsMore3D().
Referenced by sgpp::datadriven::VisualizerClassification::runVisualization(), and runVisualization().
|
protected |
Method which generates the linear cuts graphs for models of 1 dimension.
model | the model used to evaluate the linear cuts |
currentDirectory | The current directory to store the linear cuts results |
matrix | The matrix containing the points to evaluate the cuts |
References sgpp::base::DataMatrix::appendCol(), sgpp::datadriven::Visualizer::config, sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::evaluate(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::json, storeCutJson(), sgpp::datadriven::VisualizationGeneralConfig::targetFileType_, and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by getLinearCuts().
|
protected |
Method which generates the linear cuts graphs for models of 2 dimensions.
model | the model used to evaluate the linear cuts |
currentDirectory | The current directory to store the linear cuts results |
matrix | The matrix containing the points to evaluate the cuts |
References sgpp::base::DataMatrix::appendCol(), sgpp::datadriven::Visualizer::config, sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::evaluate(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::json, storeCutJson(), sgpp::datadriven::VisualizationGeneralConfig::targetFileType_, translateColumns(), and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by getLinearCuts().
|
protected |
Method which generates the linear cuts graphs for models of 3 or more dimensions.
model | the model used to evaluate the linear cuts |
currentDirectory | The current directory to store the linear cuts results |
matrix | The matrix containing the points to evaluate the cuts |
References sgpp::base::DataMatrix::appendCol(), sgpp::datadriven::Visualizer::config, sgpp::datadriven::Visualizer::createFolder(), sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::evaluate(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::datadriven::json, storeCutJson(), sgpp::datadriven::VisualizationGeneralConfig::targetFileType_, translateColumnsRight(), updateIndexesCuts(), and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by getLinearCuts().
|
protected |
Method which builds the matrices used to generate the cuts and the heatmaps.
model | The model used to evaluate the linear cuts and the heatmaps |
cutMatrix | Matrix to be initialized which will be used to evaluate the linear cuts |
heatMapMatrix | Matrix to be initialized which will be used to evaluate the heatmaps |
References sgpp::base::DataMatrix::appendRow(), sgpp::datadriven::ModelFittingBase::getDataset(), sgpp::datadriven::Dataset::getDimension(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::resize(), sgpp::datadriven::Visualizer::resolution, and sgpp::base::DataVector::set().
Referenced by sgpp::datadriven::VisualizerClassification::runVisualization(), and runVisualization().
|
overridevirtual |
Method to run the visualization process for a given batch and fold.
model | The model used to evaluate the visualization |
dataSource | The datasource from where the data points are obtained |
fold | The current fold being processed |
batch | The current batch being processed |
Implements sgpp::datadriven::Visualizer.
References sgpp::datadriven::VisualizationGeneralConfig::algorithm_, sgpp::datadriven::Visualizer::config, sgpp::datadriven::Visualizer::createFolder(), sgpp::datadriven::VisualizationGeneralConfig::crossValidation_, sgpp::datadriven::CSV, sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::VisualizationGeneralConfig::execute_, sgpp::datadriven::DataSource::getAllSamples(), sgpp::datadriven::Dataset::getData(), sgpp::datadriven::ModelFittingBase::getFitterConfiguration(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::datadriven::FitterConfiguration::getGridConfig(), getHeatmap(), getLinearCuts(), sgpp::datadriven::VisualizerConfiguration::getVisualizationParameters(), initializeMatrices(), sgpp::base::GeneralGridConfiguration::level_, sgpp::datadriven::VisualizationGeneralConfig::numBatches_, sgpp::datadriven::VisualizationParameters::numberCores_, sgpp::datadriven::Visualizer::originalData, sgpp::datadriven::Visualizer::resolution, storeGrid(), sgpp::datadriven::VisualizationGeneralConfig::targetDirectory_, and sgpp::datadriven::VisualizationGeneralConfig::targetFileType_.
|
protected |
Method to generate and store in json format for the plotly library the output of the linear cuts for models of 1 dimension.
matrix | Matrix with the content to be stored |
filepath | The current directory to store the json file |
References json::DictNode::addDictAttr(), json::Node::addDictValue(), json::DictNode::addIDAttr(), json::DictNode::addListAttr(), sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNrows(), json::JSON::serialize(), and sgpp::base::DataVector::toString().
|
protected |
Method to generate and store in json format for the plotly library the output of the linear cuts for models of 2 or more dimensions.
matrix | Matrix with the content to be stored |
indexes | Vectors containing the dimensions used when generating these cuts |
varDim | THe dimension number varying and whose evaluation is shown in the model |
filepath | The current directory to store the json file |
References json::DictNode::addDictAttr(), json::Node::addDictValue(), json::DictNode::addIDAttr(), json::Node::addIdValue(), json::DictNode::addListAttr(), sgpp::base::DataMatrix::copyFrom(), sgpp::base::DataVector::get(), sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getRow(), sgpp::base::DataMatrix::resizeToSubMatrix(), json::JSON::serialize(), and sgpp::base::DataVector::toString().
Referenced by getLinearCuts1D(), getLinearCuts2D(), and getLinearCutsMore3D().
|
protected |
Method which stores the coordinates of the grid points of a Density Estimation model.
model | The model from where the grid is obtained |
currentDirectory | The current directory to store the grid data |
References sgpp::base::Grid::clone(), sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBaseSingleGrid::getGrid(), grid(), and sgpp::datadriven::CSVTools::writeMatrixToCSVFile().
Referenced by runVisualization().
|
protected |
Method to generate and store in json format for the plotly library the output of the heatmaps for models of 2 dimensions.
matrix | Matrix with the content to be stored |
model | The model used when evaluating the heatmaps |
filepath | The current directory to store the json file |
References json::DictNode::addDictAttr(), json::Node::addDictValue(), json::DictNode::addIDAttr(), json::DictNode::addListAttr(), sgpp::base::Grid::clone(), sgpp::base::DataMatrix::getColumn(), sgpp::datadriven::ModelFittingBaseSingleGrid::getGrid(), sgpp::base::DataMatrix::getNrows(), grid(), sgpp::base::DataMatrix::max(), sgpp::base::DataMatrix::min(), json::JSON::serialize(), and sgpp::base::DataVector::toString().
|
protected |
Method to generate and store in json format for the plotly library the output of the hetamaps for models of 3 or more dimensions.
matrix | Matrix with the content to be stored |
model | The model used when evaluating the heatmaps |
indexes | Vectors containing the dimensions used when generating these heatmaps |
varDim1 | The first dimension number varying and whose evaluation is shown in the model |
varDim2 | The second dimension number varying and whose evaluation is shown in the model |
filepath | The current directory to store the json file |
References json::DictNode::addDictAttr(), json::Node::addDictValue(), json::DictNode::addIDAttr(), json::Node::addIdValue(), json::DictNode::addListAttr(), sgpp::base::DataMatrix::appendRow(), sgpp::base::Grid::clone(), sgpp::base::DataMatrix::copyFrom(), sgpp::base::DataVector::get(), sgpp::base::DataMatrix::getColumn(), sgpp::datadriven::ModelFittingBaseSingleGrid::getGrid(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getRow(), grid(), sgpp::base::DataMatrix::max(), sgpp::base::DataMatrix::min(), sgpp::base::DataMatrix::resizeToSubMatrix(), json::JSON::serialize(), and sgpp::base::DataVector::toString().
Referenced by getHeatmap2D(), getHeatmap3D(), and getHeatmapMore4D().
|
protected |
Method to generate and store in json format for the plotly library the output of the tsne algorithm.
matrix | Matrix with the content to be stored |
model | Model used in the evaluation |
currentDirectory | The current directory to store the json file |
References json::DictNode::addDictAttr(), json::Node::addDictValue(), json::DictNode::addIDAttr(), json::DictNode::addListAttr(), sgpp::datadriven::Visualizer::currentDirectory, sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNrows(), json::JSON::serialize(), and sgpp::base::DataVector::toString().
|
protected |
Method to swap to columns of a matrix.
matrix | The matrix whose columns are to be swaped |
col1 | The column identifier to be swaped with the column identified by col2 |
col2 | The colum identifier to be swaped with the column identified by col1 |
References sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::setColumn().
Referenced by updateIndexesCuts(), and updateIndexesHeatmap().
|
protected |
Method which shifts one position the columns of a matrix from left to right in a circular fashion until the column given by the parameters maxColumns.
matrix | The matrix to be shifted |
maxColumns | The max number of columns used when shifting |
References sgpp::base::DataMatrix::copyFrom(), sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::setColumn().
Referenced by getHeatmap3D(), sgpp::datadriven::VisualizerClassification::getHeatmap3DClassification(), and getLinearCuts2D().
|
protected |
Method which shifts the columns given by the vector indexes of a matrix from right to left in a circular fashion.
If indexes are <1,3,6> Then column 1 will be shifted to 6, 6 to 3 and 1 to 6.
matrix | The matrix to be shifted |
indexes | Vector containing the columns to shift |
References sgpp::base::DataMatrix::copyFrom(), sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::setColumn().
Referenced by getHeatmapMore4D(), and sgpp::datadriven::VisualizerClassification::getHeatmapMore4DClassification().
|
protected |
Method which shifts the columns given by the vector indexes of a matrix from left to right in a circular fashion.
If indexes are <1,3,6> Then column 1 will be shifted to 3, 3 to 6 and 6 to 1.
matrix | The matrix to be shifted |
indexes | Vector containing the columns to shift |
References sgpp::base::DataMatrix::copyFrom(), sgpp::base::DataMatrix::getColumn(), sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::setColumn().
Referenced by getHeatmapMore4D(), sgpp::datadriven::VisualizerClassification::getHeatmapMore4DClassification(), and getLinearCutsMore3D().
|
protected |
Method to update the columns indexes to be shifted when generating the linear cuts.
columnIndexes | Vector to update |
matrix | The matrix whose columns are being shifted |
References sgpp::base::DataMatrix::getNcols(), and swapColumns().
Referenced by getLinearCutsMore3D().
|
protected |
Method to update the columns indexes to be shifted when generating the heatmap.
columnIndexes | Vector to update |
matrix | The matrix whose columns are being shifted |
References sgpp::base::DataMatrix::getNcols(), and swapColumns().
Referenced by getHeatmapMore4D(), and sgpp::datadriven::VisualizerClassification::getHeatmapMore4DClassification().