npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@saltcorn/smartcore-js

v0.2.20

Published

Template project for writing node package with napi-rs

Downloads

67

Readme

SmartCore-JS Documentation

Welcome to the comprehensive documentation for SmartCore-JS, a powerful machine learning library for Node.js that brings the performance of Rust's SmartCore to the JavaScript ecosystem.

Table of Contents

Getting Started

User Guide

API Reference

Examples

Tutorials

What is SmartCore-JS?

SmartCore-JS is a Node.js machine learning library that provides:

  • High Performance: Built on top of Rust's SmartCore using NAPI-RS for native performance
  • Scikit-learn Compatible API: Familiar interface for data scientists and ML engineers
  • TypeScript Support: Full type definitions for better developer experience
  • Comprehensive Algorithms: Wide range of supervised and unsupervised learning algorithms
  • DataFrame Support: Flexible data handling with built-in DataFrame functionality
  • Pipeline System: Chain transformers and estimators for efficient workflows

Key Features

🚀 Performance

Native Rust implementation ensures fast computation for large datasets.

🔧 Easy to Use

Scikit-learn inspired API makes it simple to get started:

import { linearModel, dataset } from '@saltcorn/smartcore-js'

const { LinearRegression } = linearModel
const { loadIris } = dataset

// Load data
const [x, y] = loadIris({ returnXY: true })

// Create and train model
const model = new LinearRegression()
model.fit(x, y)

// Make predictions
const predictions = model.predict(x)

🎯 Comprehensive

Wide range of algorithms covering:

  • Regression: Linear, Ridge, Lasso, ElasticNet, SVR, Decision Trees, Random Forests
  • Classification: Logistic Regression, SVC, Decision Trees, Random Forests, Naive Bayes, KNN
  • Clustering: K-Means, DBSCAN
  • Dimensionality Reduction: PCA, SVD
  • Preprocessing: StandardScaler, OneHotEncoder

🔄 Pipelines

Chain multiple operations together:

import { pipeline, preprocessing, linearModel } from '@saltcorn/smartcore-js'

const pipe = pipeline.makePipeline([new preprocessing.StandardScaler(), new linearModel.LogisticRegression()])

pipe.fit(x, y)
const predictions = pipe.predict(x)

💾 Model Persistence

Save and load trained models:

// Save model
const serialized = model.serialize()

// Load model
const loadedModel = LinearRegression.deserialize(serialized)

Installation

npm install @saltcorn/smartcore-js

Or with yarn:

yarn add @saltcorn/smartcore-js

Quick Example

Here's a complete example of training a Random Forest Classifier:

import { ensemble, dataset, modelSelection, metrics } from '@saltcorn/smartcore-js'

// Load dataset
const [x, y] = dataset.loadIris({ returnXY: true })

// Split into train and test sets
const [xTrain, xTest, yTrain, yTest] = modelSelection.trainTestSplit(x, y, { testSize: 0.3, randomState: 42 })

// Create and train model
const model = new ensemble.RandomForestClassifier({
  nTrees: 100,
  maxDepth: 10,
})
model.fit(xTrain, yTrain)

// Make predictions
const predictions = model.predict(xTest)

// Evaluate
const accuracy = metrics.accuracyScore(yTest, predictions)
console.log(`Accuracy: ${accuracy}`)

System Requirements

  • Node.js: >= 10.0.0
  • Supported Platforms:
    • Windows (x64, ia32, arm64)
    • macOS (x64, arm64/Apple Silicon)
    • Linux (x64, arm64, armv7, musl)
    • FreeBSD (x64)
    • Android (arm64, armv7)
    • WebAssembly (wasm32-wasip1-threads)

Contributing

SmartCore-JS is an open-source project. Contributions are welcome!

License

This project is licensed under the MIT License.

Support

Next Steps

  1. Get Started with Installation →
  2. Learn Core Concepts →
  3. Explore Examples →

Built with ❤️ using Rust's SmartCore and NAPI-RS