You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/preprocessing/categorical_encoder.rs
+33-34Lines changed: 33 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
//! # One-hot Encoding For [RealNumber](../../math/num/trait.RealNumber.html) Matricies
2
2
//! Transform a data [Matrix](../../linalg/trait.BaseMatrix.html) by replacing all categorical variables with their one-hot equivalents
3
3
//!
4
-
//! Internally OneHotEncoder treats every categorical column as a series and transforms it using [SeriesOneHotEncoder](../series_encoder/struct.SeriesOneHotEncoder.html)
4
+
//! Internally OneHotEncoder treats every categorical column as a series and transforms it using [CategoryMapper](../series_encoder/struct.CategoryMapper.html)
5
5
//!
6
6
//! ### Usage Example
7
7
//! ```
8
8
//! use smartcore::linalg::naive::dense_matrix::DenseMatrix;
9
-
//! use smartcore::preprocessing::categorical_encoder::{OneHotEnc, OneHotEncoderParams};
9
+
//! use smartcore::preprocessing::categorical_encoder::{OneHotEncoder, OneHotEncoderParams};
10
10
//! let data = DenseMatrix::from_2d_array(&[
11
11
//! &[1.5, 1.0, 1.5, 3.0],
12
12
//! &[1.5, 2.0, 1.5, 4.0],
@@ -15,7 +15,7 @@
15
15
//! ]);
16
16
//! let encoder_params = OneHotEncoderParams::from_cat_idx(&[1, 3]);
17
17
//! // Infer number of categories from data and return a reusable encoder
18
-
//! let encoder = OneHotEnc::fit(&data, encoder_params).unwrap();
18
+
//! let encoder = OneHotEncoder::fit(&data, encoder_params).unwrap();
19
19
//! // Transform categorical to one-hot encoded (can transform similar)
20
20
//! let oh_data = encoder.transform(&data).unwrap();
0 commit comments