JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q51159F
  • License ISC

Package Exports

  • libsvm-wasm
  • libsvm-wasm/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (libsvm-wasm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

libsvm-wasm

Brief

This is a wasm export for libsvm It allows you to directly run & train svm model in js env without installing any non-js dependency.

Build

git submodule init
git submodule update
make

After this command, you will get the wasm in dist folder.

Usage

Note: No bundle support for now. You may want to build on yourself or use ts-node to write a ts script.

import {SVM} from './src/libsvm';

const svm = new SVM();
await svm.init()
const data = [[-1, -1], [1, 1], [2, 2], [-2, -2]]
const label = [-1, 1, 1, -1];

svm.feedSamples(data, label);
await svm.train();
svm.predict([3, 3]);

Roadmap

  • Building & Bundling & Packaging
  • Benchmark V.S. native
  • More API
  • SIMD operation to enhance performance
  • Store Model using native fs API