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

#include <overunderflow.h>

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

Public Member Functions

 OverUnderFlow ()=delete
 
 OverUnderFlow (CosanRawData< NumericType > &RD)
 
- 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)
 

Detailed Description

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

Clean up row with underflow or overflow data enty.

Definition at line 14 of file overunderflow.h.

Constructor & Destructor Documentation

◆ OverUnderFlow() [1/2]

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

◆ OverUnderFlow() [2/2]

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

Definition at line 17 of file overunderflow.h.

17  :Preprocessor<NumericType>(){
18  this->fit(RD);
19  }

Member Function Documentation

◆ fit()

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

Definition at line 22 of file overunderflow.h.

22  {
23  fmt::print("*********************************\n");
24  fmt::print("Begin cleaning up data of overflow/underflow!\n");
25 
26  std::set<gsl::index> InfIdx;
27  for (auto & each: RD.GetIdxpinfX()){
28  InfIdx.insert(each[0]);
29  }
30  for (auto & each: RD.GetIdxminfX()){
31  InfIdx.insert(each[0]);
32  }
33  for (auto & each: RD.GetIdxpinfY()){
34  InfIdx.insert(each[0]);
35  }
36  for (auto & each: RD.GetIdxminfY()){
37  InfIdx.insert(each[0]);
38  }
39  std::vector<gsl::index> SelectedIdx;
40  for (auto i = 0; i<RD.GetrowsX();i++){
41  if (InfIdx.find(i)==InfIdx.end()){
42  SelectedIdx.push_back(i);
43  }
44  }
45  fmt::print("There are {:d} rows that have overflow/underflow data! Delete the whole rows. \n",InfIdx.size());
46  if (RD.GetTarget().size()==0){
47  RD.UpdateData(RD.GetInput()(SelectedIdx,Eigen::all));
48  }
49  else{
50  RD.UpdateData(RD.GetInput()(SelectedIdx,Eigen::all),RD.GetTarget()(SelectedIdx,Eigen::all));
51  }
52 
53  gsl::index NumOfCat = RD.GetcolCatX().size();
54  fmt::print("End of cleaning up data of overflow/underflow!\n");
55  fmt::print("*********************************\n");
56  if (NumOfCat==0){
57  return ;
58  }
59  std::vector<std::string> svaluesX;
60  std::vector<std::string> svaluesY;
61  for (gsl::index i=0; i< RD.GetsvaluesX().size();i++){
62  if (InfIdx.find(i/NumOfCat)==InfIdx.end()){
63  svaluesX.push_back(RD.GetsvaluesX().at(i));
64  }
65  }
66  RD.UpdateCat(svaluesX);
67 
68  }

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