Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/vectorizer/src/encoding/categorical.ts>CategoricalEncoder

Machine Learning utilities for TypeScript
Latest
class CategoricalEncoder
import { CategoricalEncoder } from "https://deno.land/x/vectorizer@v0.7.5/src/encoding/categorical.ts";

Convert class labels into categorical variables (one-hot)

Constructors

new
CategoricalEncoder()

Properties

mapping: Map<T, number>

Map categories to indices

Methods

fit(targets: T[]): this

Construct a mapping from a given set of text.

getOg(data: number): T | undefined
transform<DT extends DataType>(targets: T[], dType: DT): Matrix<DT>

One-hot encoding of categorical values

untransform<DT extends DataType>(data: MatrixLike<DT>): T[]

Static Methods

fromSoftmax<DT extends DataType>(data: MatrixLike<DT>): Matrix<DT>

Convert softmax outputs into categorical outputs This method mutates the original matrix.