RapidLib  v2.2.0
A simple library for interactive machine learning
modelSet< T > Class Template Reference

#include <modelSet.h>

Inheritance diagram for modelSet< T >:
Inheritance graph
Collaboration diagram for modelSet< T >:
Collaboration graph

Public Member Functions

 modelSet ()
 
virtual ~modelSet ()
 
virtual bool train (const std::vector< trainingExampleTemplate< T > > &trainingSet)
 
bool reset ()
 
std::vector< T > run (const std::vector< T > &inputVector)
 
std::string getJSON ()
 
void writeJSON (const std::string &filepath)
 
bool putJSON (const std::string &jsonMessage)
 
bool readJSON (const std::string &filepath)
 

Protected Member Functions

void threadTrain (std::size_t i, const std::vector< trainingExampleTemplate< T > > &training_set)
 

Protected Attributes

std::vector< baseModel< T > * > myModelSet
 
int numInputs
 
std::vector< std::string > inputNames
 
int numOutputs
 
bool isTraining
 
bool isTrained
 

Detailed Description

template<typename T>
class modelSet< T >

This class holds a set of models with the same or different algorithms.

Constructor & Destructor Documentation

◆ modelSet()

template<typename T >
modelSet< T >::modelSet

No arguments, don't create any models yet

◆ ~modelSet()

template<typename T >
modelSet< T >::~modelSet
virtual

Member Function Documentation

◆ getJSON()

template<typename T >
std::string modelSet< T >::getJSON

Get a JSON representation of the model

Returns
Styled string JSON representation

◆ putJSON()

template<typename T >
bool modelSet< T >::putJSON ( const std::string &  jsonMessage)

configure empty model with string. See getJSON()

◆ readJSON()

template<typename T >
bool modelSet< T >::readJSON ( const std::string &  filepath)

read a JSON file at file path and build a modelSet from it

◆ reset()

template<typename T >
bool modelSet< T >::reset

reset to pre-training state

◆ run()

template<typename T >
std::vector< T > modelSet< T >::run ( const std::vector< T > &  inputVector)

Generate an output value from a single input vector.

Will return an error if training in progress.

Parameters
vectorA standard vector of type T that is the input for classification or regression.
Returns
vector A vector type T that are the predictions for each model in the set.

◆ threadTrain()

template<typename T >
void modelSet< T >::threadTrain ( std::size_t  i,
const std::vector< trainingExampleTemplate< T > > &  training_set 
)
protected

◆ train()

template<typename T >
bool modelSet< T >::train ( const std::vector< trainingExampleTemplate< T > > &  trainingSet)
virtual

Train on a specified set, causes creation if not created

Reimplemented in regressionTemplate< T >, and classificationTemplate< T >.

◆ writeJSON()

template<typename T >
void modelSet< T >::writeJSON ( const std::string &  filepath)

Write a JSON model description to specified file path

Parameters
filepath

Member Data Documentation

◆ inputNames

template<typename T >
std::vector<std::string> modelSet< T >::inputNames
protected

◆ isTrained

template<typename T >
bool modelSet< T >::isTrained
protected

◆ isTraining

template<typename T >
bool modelSet< T >::isTraining
protected

◆ myModelSet

template<typename T >
std::vector<baseModel<T>*> modelSet< T >::myModelSet
protected

◆ numInputs

template<typename T >
int modelSet< T >::numInputs
protected

◆ numOutputs

template<typename T >
int modelSet< T >::numOutputs
protected

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