deepbox/preprocess
Encoders & Vectorizers
Categorical encoders and text vectorizers for tabular and text preprocessing pipelines.
Categorical
Text
LabelBinarizer
Binarize labels in a one-vs-all fashion.
LabelEncoder
Encode target labels with value between 0 and n_classes-1.
MultiLabelBinarizer
Transform multi-label classification data to binary format.
OneHotEncoder
Encode categorical features as one-hot numeric array.
OrdinalEncoder
Encode categorical features as integer array.
TargetEncoder
Target-based encoding for categorical features.
CountVectorizer
Convert a collection of text documents to a matrix of token counts.
HashingVectorizer
Convert text documents to a fixed-size feature matrix using the hashing trick.
TfidfVectorizer
Convert a collection of text documents to a TF-IDF feature matrix.
preprocess-encoders.ts
import { CountVectorizer, OneHotEncoder, OrdinalEncoder, TfidfVectorizer,} from "deepbox/preprocess";const oneHot = new OneHotEncoder();console.log(oneHot.fitTransform([["cat"], ["dog"], ["cat"]]).toString());const ordinal = new OrdinalEncoder();console.log(ordinal.fitTransform([["low"], ["medium"], ["high"]]).toString());const tfidf = new TfidfVectorizer();console.log(tfidf.fitTransformText(["deepbox docs", "deepbox ml"]).toString());console.log(new CountVectorizer().fitTransformText(["a b", "a a"]).toString());