mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-16 07:55:58 +00:00
* Add better check in testKBins.py * Add Discretizer base class for Both discretizers * Refactor order of constructors init
30 lines
693 B
C++
30 lines
693 B
C++
#ifndef BINDISC_H
|
|
#define BINDISC_H
|
|
|
|
#include "typesFImdlp.h"
|
|
#include "Discretizer.h"
|
|
#include <string>
|
|
|
|
namespace mdlp {
|
|
|
|
enum class strategy_t {
|
|
UNIFORM,
|
|
QUANTILE
|
|
};
|
|
class BinDisc : public Discretizer {
|
|
public:
|
|
BinDisc(int n_bins = 3, strategy_t strategy = strategy_t::UNIFORM);
|
|
~BinDisc();
|
|
// y is included for compatibility with the Discretizer interface
|
|
void fit(samples_t& X_, labels_t& y) override;
|
|
void fit(samples_t& X);
|
|
private:
|
|
void fit_uniform(samples_t&);
|
|
void fit_quantile(samples_t&);
|
|
void normalizeCutPoints();
|
|
int n_bins;
|
|
strategy_t strategy;
|
|
};
|
|
}
|
|
#endif
|