v1.0.1
Machine Learning Module for Single Layer Perceptron ML models, written in Rust for Typescript.
Attributes
Includes Deno configuration
Repository
Current version released
2 years ago
Dependencies
La Classy
Single Layer Perceptron (SLP) library for Deno.
This library is written TypeScript and Rust and it uses FFI.
Why Classy?
- It’s fast.
- It gives you some freedom to experiment with different combinations of loss functions, activation functions, etc.
- It’s easy to use.
Features
- Optimization Algorithms:
- Gradient Descent
- Stochastic Average Gradients
- Ordinary Least Squares
- Optimizers for updating weights:
- RMSProp
- ADAM
- Schedulers for learning rate:
- One-cycle Scheduler
- Decay
- Regularization
- Activation Functions:
- Linear (regression, SVM, etc.)
- Sigmoid (logistic regression)
- Softmax (multinomial logistic regression)
- Tanh (it’s just there)
- Loss Functions:
- Mean Squared Error (regression)
- Mean Absolute Error (regression)
- Cross-Entropy (multinomial classification)
- Binary Cross-Entropy / Logistic Loss (binary classification)
- Hinge Loss (binary classification, SVM)
Quick Example
Regression
import { OLSSolver } from "https://deno.land/x/classylala/mod.ts";
const x = [100, 23, 53, 56, 12, 98, 75];
const y = x.map((a) => [a * 6 + 13, a * 4 + 2]);
const solver = new OLSSolver();
solver.train(
{ data: Float64Array.from(x), shape: [x.length, 1] },
{ data: Float64Array.from(y.flat()), shape: [y.length, 2] },
{ silent: false, fit_intercept: true }
);
const res = solver.predict({
data: Float64Array.from(x),
shape: [x.length, 1],
});
for (const pred of res.rows()) {
console.log(pred);
}There are other examples in /examples
Documentation
Maintainers
Pranev (retraigo)
Check out deno-ml for examples!
Discord: Kuro’s Chaos Abyss Graveyard