SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::datadriven::VisualizerClassification Class Reference

#include <VisualizerClassification.hpp>

Inheritance diagram for sgpp::datadriven::VisualizerClassification:
sgpp::datadriven::VisualizerDensityEstimation sgpp::datadriven::Visualizer

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.
 
 VisualizerClassification ()=default
 
 VisualizerClassification (VisualizerConfiguration config)
 Constructor given a configuration.
 
 ~VisualizerClassification () override=default
 
- Public Member Functions inherited from sgpp::datadriven::VisualizerDensityEstimation
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.
 
- Public Member Functions inherited from sgpp::datadriven::Visualizer
const VisualizerConfigurationgetVisualizerConfiguration () const
 Get the configuration of the visualizer object.
 
 Visualizer ()
 
virtual ~Visualizer ()=default
 Virtual destructor.
 

Protected Member Functions

void getHeatmap2DClassification (ModelFittingBase &model, std::string currentDirectory, DataMatrix &classMatrix)
 Method which generates the classification heatmap of models of 2 dimensions.
 
void getHeatmap3DClassification (ModelFittingBase &model, std::string currentDirectory, DataMatrix &classMatrix)
 Method which generates the classification heatmap of models of 3 sdimensions.
 
void getHeatmapMore4DClassification (ModelFittingBase &model, std::string currentDirectory, DataMatrix &classMatrix)
 Method which generates the classification heatmap of models of 4 or more dimensions.
 
void getHeatmapsClassification (ModelFittingBase &model, std::string currentDirectory, DataMatrix &classMatrix)
 Method which starts the heatmap generation for Classification Models.
 
void initializeMatrices (ModelFittingBase &model, DataMatrix &classMatrix)
 Method which builds the matrices used to generate the cuts and the heatmaps.
 
void storeHeatmapJsonClassification (DataMatrix &matrix, ModelFittingBase &model, std::string filepath)
 Method to generate and store in json format for the plotly library the output of the classification heatmaps for models of 3 or more dimensions.
 
void storeHeatmapJsonClassification (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 classification heatmaps for models of 2 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.
 
- Protected Member Functions inherited from sgpp::datadriven::VisualizerDensityEstimation
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.
 
- Protected Member Functions inherited from sgpp::datadriven::Visualizer
void createFolder (std::string folder_path)
 Method to create a folder based on the operating system of the user.
 

Additional Inherited Members

- Protected Attributes inherited from sgpp::datadriven::Visualizer
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.
 

Constructor & Destructor Documentation

◆ VisualizerClassification() [1/2]

sgpp::datadriven::VisualizerClassification::VisualizerClassification ( )
default

◆ VisualizerClassification() [2/2]

sgpp::datadriven::VisualizerClassification::VisualizerClassification ( VisualizerConfiguration  config)
explicit

Constructor given a configuration.

Parameters
configThe VisualizerConfiguration object which contains the configuration to run the visualization module

References sgpp::datadriven::Visualizer::config.

◆ ~VisualizerClassification()

sgpp::datadriven::VisualizerClassification::~VisualizerClassification ( )
overridedefault

Member Function Documentation

◆ getHeatmap2DClassification()

void sgpp::datadriven::VisualizerClassification::getHeatmap2DClassification ( ModelFittingBase model,
std::string  currentDirectory,
DataMatrix classMatrix 
)
protected

◆ getHeatmap3DClassification()

void sgpp::datadriven::VisualizerClassification::getHeatmap3DClassification ( ModelFittingBase model,
std::string  currentDirectory,
DataMatrix classMatrix 
)
protected

◆ getHeatmapMore4DClassification()

◆ getHeatmapsClassification()

void sgpp::datadriven::VisualizerClassification::getHeatmapsClassification ( ModelFittingBase model,
std::string  currentDirectory,
DataMatrix classMatrix 
)
protected

Method which starts the heatmap generation for Classification Models.

Parameters
modelThe model used to evaluate the heatmap
currentDirectoryThe current directory to store the heatmap results
classMatrixmatrix to be evaluated to generate the heatmap

References sgpp::datadriven::Visualizer::createFolder(), sgpp::datadriven::Visualizer::currentDirectory, sgpp::datadriven::ModelFittingBase::getDataset(), sgpp::datadriven::Dataset::getDimension(), getHeatmap2DClassification(), getHeatmap3DClassification(), and getHeatmapMore4DClassification().

Referenced by runVisualization().

◆ initializeMatrices()

void sgpp::datadriven::VisualizerClassification::initializeMatrices ( ModelFittingBase model,
DataMatrix classMatrix 
)
protected

Method which builds the matrices used to generate the cuts and the heatmaps.

Parameters
modelThe model used to evaluate the linear cuts and the heatmaps
classMatrixmatrix to be initialized

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 runVisualization().

◆ runVisualization()

void sgpp::datadriven::VisualizerClassification::runVisualization ( ModelFittingBase model,
DataSource dataSource,
size_t  fold,
size_t  batch 
)
overridevirtual

Method to run the visualization process for a given batch and fold.

Parameters
modelThe model used to evaluate the visualization
dataSourceThe datasource from where the data points are obtained
foldThe current fold being processed
batchThe 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::Visualizer::currentDirectory, sgpp::datadriven::VisualizationGeneralConfig::execute_, sgpp::base::DataVector::get(), sgpp::datadriven::DataSource::getAllSamples(), sgpp::datadriven::ModelFittingClassification::getClassIdx(), sgpp::datadriven::Dataset::getData(), sgpp::datadriven::ModelFittingBase::getFitterConfiguration(), sgpp::datadriven::VisualizerConfiguration::getGeneralConfig(), sgpp::datadriven::FitterConfiguration::getGridConfig(), sgpp::datadriven::VisualizerDensityEstimation::getHeatmap(), getHeatmapsClassification(), sgpp::datadriven::VisualizerDensityEstimation::getLinearCuts(), sgpp::datadriven::ModelFittingClassification::getModels(), sgpp::datadriven::VisualizerConfiguration::getVisualizationParameters(), initializeMatrices(), sgpp::datadriven::VisualizerDensityEstimation::initializeMatrices(), sgpp::base::GeneralGridConfiguration::level_, sgpp::datadriven::VisualizationGeneralConfig::numBatches_, sgpp::datadriven::VisualizationParameters::numberCores_, sgpp::datadriven::Visualizer::originalData, sgpp::base::DataVector::resizeZero(), sgpp::datadriven::Visualizer::resolution, sgpp::base::DataVector::set(), and sgpp::datadriven::VisualizationGeneralConfig::targetDirectory_.

◆ storeHeatmapJsonClassification() [1/2]

◆ storeHeatmapJsonClassification() [2/2]

void sgpp::datadriven::VisualizerClassification::storeHeatmapJsonClassification ( DataMatrix matrix,
ModelFittingBase model,
std::vector< size_t >  indexes,
size_t &  varDim1,
size_t &  varDim2,
std::string  filepath 
)
protected

Method to generate and store in json format for the plotly library the output of the classification heatmaps for models of 2 dimensions.

Parameters
matrixMatrix with the content to be stored
modelThe model used when evaluating the heatmaps
indexesVectors containing the dimensions used when generating these heatmaps
varDim1The first dimension number varying and whose evaluation is shown in the model
varDim2The second dimension number varying and whose evaluation is shown in the model
filepathThe 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::appendCol(), sgpp::base::DataMatrix::appendRow(), sgpp::base::DataMatrix::copyFrom(), sgpp::datadriven::ModelFittingClassification::evaluate(), sgpp::base::DataVector::get(), sgpp::base::DataMatrix::getColumn(), sgpp::datadriven::ModelFittingClassification::getModels(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getRow(), sgpp::base::DataVector::getSize(), grid(), sgpp::base::DataMatrix::max(), sgpp::base::DataMatrix::min(), sgpp::datadriven::Visualizer::originalData, sgpp::base::DataMatrix::resizeToSubMatrix(), json::JSON::serialize(), and sgpp::base::DataVector::toString().

◆ storeTsneJson()

void sgpp::datadriven::VisualizerClassification::storeTsneJson ( DataMatrix matrix,
ModelFittingBase model,
std::string  currentDirectory 
)
protected

Method to generate and store in json format for the plotly library the output of the tsne algorithm.

Parameters
matrixMatrix with the content to be stored
modelModel used in the evaluation
currentDirectoryThe 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().


The documentation for this class was generated from the following files: