Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/retraigo/appraisal
Machine Learning utilities for TypeScript
https://github.com/retraigo/appraisal
encoding machine-learning nlp tf-idf typescript
Last synced: 2 months ago
JSON representation
Machine Learning utilities for TypeScript
- Host: GitHub
- URL: https://github.com/retraigo/appraisal
- Owner: retraigo
- License: mit
- Created: 2023-05-20T06:41:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-05T15:05:00.000Z (9 months ago)
- Last Synced: 2024-09-14T12:14:19.347Z (3 months ago)
- Topics: encoding, machine-learning, nlp, tf-idf, typescript
- Language: TypeScript
- Homepage:
- Size: 455 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - appraisal - Feature extraction and conversion. (Modules / Machine learning)
README
# Appraisal
- Machine Learning utilities for TypeScript.
## Modules
- [Text Vectorizer](/src/text)
- [Image](/src/image)
- [Metrics](/src/metrics)## Example: Text
```ts
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));```