Cosan  1.0
Data Analytics Library
Cosan::CosanMetric< NumericType > Class Template Reference

CosanMetric class for metric functionality. More...

#include <CosanMetric.h>

Inheritance diagram for Cosan::CosanMetric< NumericType >:
Cosan::Evaluation Cosan::CosanBO Cosan::MaxError< NumericType > Cosan::MeanAbsError< NumericType > Cosan::MeanSquareError< NumericType > Cosan::R2Score< NumericType >

Public Member Functions

 CosanMetric ()
 
 CosanMetric (const CosanMatrix< NumericType > &yPredict, const CosanMatrix< NumericType > &yTrue)
 
virtual NumericType GetError (const CosanMatrix< NumericType > &yPredict, const CosanMatrix< NumericType > &yTrue)
 
void setAttr (const CosanMatrix< NumericType > &yPredict, const CosanMatrix< NumericType > &yTrue)
 
- Public Member Functions inherited from Cosan::Evaluation
 Evaluation ()
 
- Public Member Functions inherited from Cosan::CosanBO
 CosanBO ()
 Default constructor. More...
 
virtual const std::string GetName () const
 Get the name of the objects. More...
 

Public Attributes

NumericType error
 

Detailed Description

template<Numeric NumericType>
class Cosan::CosanMetric< NumericType >

CosanMetric class for metric functionality.

Parameters
[in]yPredictdata for prediction
[in]yTruedata for truth Initialize metric class by
CosanMetric(const CosanMatrix <NumericType> &yPredict, const CosanMatrix <NumericType> &yTrue)
Get the metric error by
GetError(const CosanMatrix <NumericType> &yPredict, const CosanMatrix <NumericType> &yTrue)

Definition at line 37 of file CosanMetric.h.

Constructor & Destructor Documentation

◆ CosanMetric() [1/2]

template<Numeric NumericType>
Cosan::CosanMetric< NumericType >::CosanMetric ( )
inline

Definition at line 40 of file CosanMetric.h.

40 : Evaluation() {}

◆ CosanMetric() [2/2]

template<Numeric NumericType>
Cosan::CosanMetric< NumericType >::CosanMetric ( const CosanMatrix< NumericType > &  yPredict,
const CosanMatrix< NumericType > &  yTrue 
)
inline

Definition at line 45 of file CosanMetric.h.

45  : Evaluation() {
46  setAttr(yPredict, yTrue);
47  };

Member Function Documentation

◆ GetError()

template<Numeric NumericType>
virtual NumericType Cosan::CosanMetric< NumericType >::GetError ( const CosanMatrix< NumericType > &  yPredict,
const CosanMatrix< NumericType > &  yTrue 
)
inlinevirtual

◆ setAttr()

template<Numeric NumericType>
void Cosan::CosanMetric< NumericType >::setAttr ( const CosanMatrix< NumericType > &  yPredict,
const CosanMatrix< NumericType > &  yTrue 
)
inline

Definition at line 58 of file CosanMetric.h.

58  {
59  // check if the input matrices have the same size
60  if (!SameSize(yPredict, yTrue)) {
61  throw DiffSize;
62  }
63  // check the shape of the input
64  if (!LabelShape(yPredict)) {
65  throw InvalidLabelShape;
66  }
67  GetError(yPredict, yTrue);
68  }

Member Data Documentation

◆ error

template<Numeric NumericType>
NumericType Cosan::CosanMetric< NumericType >::error

Definition at line 70 of file CosanMetric.h.


The documentation for this class was generated from the following file:
Cosan::LabelShape
bool LabelShape(const CosanMatrix< NumericType > &m)
Definition: ArgCheck.h:46
Cosan::CosanMetric::CosanMetric
CosanMetric()
Definition: CosanMetric.h:40
Cosan::InvalidLabelShape
Cosan::InvalidLabelShapeException InvalidLabelShape
Cosan::Evaluation::Evaluation
Evaluation()
Definition: evaluation.h:13
Cosan::CosanMetric::setAttr
void setAttr(const CosanMatrix< NumericType > &yPredict, const CosanMatrix< NumericType > &yTrue)
Definition: CosanMetric.h:58
Cosan::SameSize
bool SameSize(const CosanMatrix< NumericType > &m1, const CosanMatrix< NumericType > &m2)
Definition: ArgCheck.h:29
Cosan::DiffSize
Cosan::DiffSizeException DiffSize
Cosan::CosanMetric::GetError
virtual NumericType GetError(const CosanMatrix< NumericType > &yPredict, const CosanMatrix< NumericType > &yTrue)
Definition: CosanMetric.h:51