philsupertramp/game-math
Loading...
Searching...
No Matches
include
math
ds
preprocessing
Encoder.h
Go to the documentation of this file.
1
#include "../Predictor.h"
2
3
4
class
OneHotEncoder
:
public
Transformer
5
{
6
Matrix<int>
unique_values
;
7
8
public
:
9
OneHotEncoder
()
10
:
Transformer
() { }
11
12
void
fit
(
const
Matrix<double>
& X, [[maybe_unused]]
const
Matrix<double>
& y)
override
{
unique_values
=
unique
(X, 0); }
13
14
Matrix<double>
transform
(
const
Matrix<double>
& in)
override
{
return
in; }
15
};
Matrix
Definition:
Matrix.h:42
OneHotEncoder
Definition:
Encoder.h:5
OneHotEncoder::unique_values
Matrix< int > unique_values
Definition:
Encoder.h:6
OneHotEncoder::transform
Matrix< double > transform(const Matrix< double > &in) override
Definition:
Encoder.h:14
OneHotEncoder::fit
void fit(const Matrix< double > &X, const Matrix< double > &y) override
Definition:
Encoder.h:12
OneHotEncoder::OneHotEncoder
OneHotEncoder()
Definition:
Encoder.h:9
Transformer
Definition:
Predictor.h:30
unique
Matrix< T > unique(const Matrix< T > &in, int axis=0)
Definition:
matrix_utils.h:466
Generated by
1.9.5