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

#include <minmaxscaler.h>

Inheritance diagram for Cosan::MinmaxScaler< NumericType >:
Cosan::Preprocessor< NumericType > Cosan::CosanBO

Public Member Functions

 MinmaxScaler ()=delete
 
 MinmaxScaler (CosanRawData< NumericType > &RD)
 
 MinmaxScaler (CosanRawData< NumericType > &RD, NumericType to_lb, NumericType to_ub)
 
- Public Member Functions inherited from Cosan::Preprocessor< NumericType >
 Preprocessor ()
 
virtual ~Preprocessor ()=default
 
virtual void fit (const CosanMatrix< NumericType > &X)
 
virtual CosanMatrix< NumericTypetransform (const CosanMatrix< NumericType > &X)
 
- Public Member Functions inherited from Cosan::CosanBO
 CosanBO ()
 Default constructor. More...
 
virtual const std::string GetName () const
 Get the name of the objects. More...
 

Private Member Functions

void fit (CosanRawData< NumericType > &RD)
 
void fit (CosanRawData< NumericType > &RD, NumericType to_lb, NumericType to_ub)
 

Detailed Description

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

Definition at line 12 of file minmaxscaler.h.

Constructor & Destructor Documentation

◆ MinmaxScaler() [1/3]

template<Numeric NumericType>
Cosan::MinmaxScaler< NumericType >::MinmaxScaler ( )
delete

◆ MinmaxScaler() [2/3]

template<Numeric NumericType>
Cosan::MinmaxScaler< NumericType >::MinmaxScaler ( CosanRawData< NumericType > &  RD)
inline

Definition at line 15 of file minmaxscaler.h.

15  :Preprocessor<NumericType>(){
16  this->fit(RD);
17  }

◆ MinmaxScaler() [3/3]

template<Numeric NumericType>
Cosan::MinmaxScaler< NumericType >::MinmaxScaler ( CosanRawData< NumericType > &  RD,
NumericType  to_lb,
NumericType  to_ub 
)
inline

Definition at line 18 of file minmaxscaler.h.

18  :Preprocessor<NumericType>(){
19  this->fit(RD,to_lb,to_ub);
20  }

Member Function Documentation

◆ fit() [1/2]

template<Numeric NumericType>
void Cosan::MinmaxScaler< NumericType >::fit ( CosanRawData< NumericType > &  RD)
inlineprivate

Definition at line 23 of file minmaxscaler.h.

23  {
24  fmt::print("*********************************\n");
25  fmt::print("Begin transformation X to [0,1]!\n");
26  CosanMatrix<NumericType> X = RD.GetInput();
27  X = (X.array().rowwise()-X.colwise().minCoeff().array()).rowwise()/(X.colwise().maxCoeff()-X.colwise().minCoeff()).array();
28  RD.UpdateData(X);
29  fmt::print("End of transformation X to [0,1]\n");
30  fmt::print("*********************************\n");
31  }

◆ fit() [2/2]

template<Numeric NumericType>
void Cosan::MinmaxScaler< NumericType >::fit ( CosanRawData< NumericType > &  RD,
NumericType  to_lb,
NumericType  to_ub 
)
inlineprivate

Definition at line 32 of file minmaxscaler.h.

32  {
33  fmt::print("*********************************\n");
34  fmt::print("Begin transformation to X to [{:},{:}]!\n",to_lb,to_ub);
35  CosanMatrix<NumericType> X = RD.GetInput();
36  X = (X.array().rowwise()-X.colwise().minCoeff().array()).rowwise()/(X.colwise().maxCoeff()-X.colwise().minCoeff()).array();
37  X = X.array()*(to_ub-to_lb)+to_lb;
38  RD.UpdateData(X);
39  fmt::print("End of transformation to X to [{:},{:}]!\n",to_lb,to_ub);
40  fmt::print("*********************************\n");
41  }

The documentation for this class was generated from the following file:
Cosan::MinmaxScaler::fit
void fit(CosanRawData< NumericType > &RD)
Definition: minmaxscaler.h:23