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

x/netsaur/packages/utilities/src/mapper/mod.ts>DiscreteMapper

Powerful Powerful Machine Learning library with GPU, CPU and WASM backends
Latest
class DiscreteMapper
import { DiscreteMapper } from "https://deno.land/x/netsaur@0.4.2/packages/utilities/src/mapper/mod.ts";

Map discrete values into numbers

Constructors

new
DiscreteMapper(mapping?: Map<T, number>)

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(targets: T[]): number[]

Encode values into their respective mappings. Returns -1 in case of missing mapping.

untransform(data: number[]): T[]

Convert mapped numbers into actual values