MagmaDNN  1.0
c++NeuralNetworkFramework
magmadnn::model::Model< T > Class Template Referenceabstract
Inheritance diagram for magmadnn::model::Model< T >:
Collaboration diagram for magmadnn::model::Model< T >:

Public Member Functions

 Model ()
 
virtual magmadnn_error_t fit (Tensor< T > *x, Tensor< T > *y, metric_t &metric_out, bool verbose=false)=0
 
virtual Tensor< T > * predict (Tensor< T > *sample)=0
 
virtual unsigned int predict_class (Tensor< T > *sample)=0
 
virtual double get_accuracy ()
 
virtual double get_loss ()
 
virtual double get_training_time ()
 
virtual std::string get_name ()
 

Protected Attributes

std::string _name
 
metric_t _last_training_metric
 

Constructor & Destructor Documentation

◆ Model()

template<typename T >
magmadnn::model::Model< T >::Model ( )
inline

Creates a new model.

Member Function Documentation

◆ fit()

template<typename T >
virtual magmadnn_error_t magmadnn::model::Model< T >::fit ( Tensor< T > *  x,
Tensor< T > *  y,
metric_t metric_out,
bool  verbose = false 
)
pure virtual

train this model on x and y.

Parameters
xmodel input data
yground truth data
metric_out[out] a metric_t struct in which the model run metrics are stored.
verboseif true then training info is printed every couple iterations
Returns
magmadnn_error_t 0 on success; non-zero otherwise

Implemented in magmadnn::model::NeuralNetwork< T >.

◆ get_accuracy()

template<typename T >
virtual double magmadnn::model::Model< T >::get_accuracy ( )
inlinevirtual

Gets the training accuracy of the last run.

Returns
double training accuracy of last run.

◆ get_loss()

template<typename T >
virtual double magmadnn::model::Model< T >::get_loss ( )
inlinevirtual

Gets the loss of the last run.

Returns
double loss of last run.

◆ get_name()

template<typename T >
virtual std::string magmadnn::model::Model< T >::get_name ( )
inlinevirtual

name of this model

Returns
std::string

◆ get_training_time()

template<typename T >
virtual double magmadnn::model::Model< T >::get_training_time ( )
inlinevirtual

Gets training time of last run.

Returns
double training time of last run.

◆ predict()

template<typename T >
virtual Tensor<T>* magmadnn::model::Model< T >::predict ( Tensor< T > *  sample)
pure virtual

return a one-hot encoded output of the network on this sample

Parameters
samplea single sample
Returns
Tensor<T>* one-hot encoded prediction

Implemented in magmadnn::model::NeuralNetwork< T >.

◆ predict_class()

template<typename T >
virtual unsigned int magmadnn::model::Model< T >::predict_class ( Tensor< T > *  sample)
pure virtual

This is equivalent to math::argmax(predict(sample)), where the one-hot encoded predict value is used.

Parameters
sample
Returns
unsigned int the index of the predicted class.

Implemented in magmadnn::model::NeuralNetwork< T >.


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