Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netsaur/packages/utilities/src/encoding/mod.ts>CategoricalEncoder

Powerful machine learning, accelerated by WebGPU
Go to Latest
class CategoricalEncoder
import { CategoricalEncoder } from "https://deno.land/x/netsaur@0.4.0-patch/packages/utilities/src/encoding/mod.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.