Skip to main content

Machine Learning utilities for TypeScript

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
3 months ago (0.7.5)

Machine Learning utilities for TypeScript.

Examples

Example 1

const data = [
  "twinkle twinkle little star",
  "How I wonder what you are",
  "up above the world so high",
  "like a diamond in the sky",
];

// Clean the text
const cleaner = new TextCleaner({
  lowercase: true,
  stripHtml: true,
  stripNewlines: true,
  normalizeWhiteSpaces: true,
});
x = cleaner.clean(x);

// Tokenize the text
const tokenizer = new SplitTokenizer();
tokenizer.fit(x);
const x_tokens = tokenizer.transform(x);

// Vectorize the tokens
const vectorizer = new CountVectorizer(tokenizer.vocabulary.size);
const x_vec = vectorizer.transform(x_tokens, "f32");

// Apply Tf-Idf transformation
const transformer = new TfIdfTransformer();
console.log(transformer.fit(x_vec).transform(x_vec));
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @lala/appraisal

Import symbol

import * as mod from "@lala/appraisal";

Add Package

npx jsr add @lala/appraisal

Import symbol

import * as mod from "@lala/appraisal";

Add Package

yarn dlx jsr add @lala/appraisal

Import symbol

import * as mod from "@lala/appraisal";

Add Package

pnpm dlx jsr add @lala/appraisal

Import symbol

import * as mod from "@lala/appraisal";

Add Package

bunx jsr add @lala/appraisal

Import symbol

import * as mod from "@lala/appraisal";