matrix-factorization

2.0.0 • Public • Published

Matrix Factorization JS

A matrix factorization implementation in Javascript. This is a Work in Progress. Use at your own risk.

Build Status codebeat badge Maintainability Coverage Status

forthebadge forthebadge forthebadge

To try an interactive example, clone and edit this Runkit Notebook.

Installing / Getting started

Install using npm:

npm install matrix-factorization

Import in code

// Node, ES5
var matrixFactorization = require('matrix-factorization')
 
// Node, ES6
const matrixFactorization = require('matrix-factorization')

Install using yarn:

yarn add matrix-factorization

Import in code

// Node, ES5
var matrixFactorization = require('matrix-factorization')
 
// Node, ES6
const matrixFactorization = require('matrix-factorization')

Install with minified library

Copy matrix-factorization.min.js from dist/matrix-factorization.min.js to a lib folder.

Import in code

<script src="lib/matrix-factorization.min.js"></script>

This will expose a matrixFactorization variable which you can access the functions from.

Include using CDN

<script src="https://cdn.jsdelivr.net/npm/matrix-factorization@1.1.2/index.min.js"></script>

This will expose a matrixFactorization variable which you can access the functions from.

Using a function in the library:

Just reference a function using the dot notation. For example, to use the sum function, you can do:

matrixFactorization.factorizeMatrix(targetMatrix, numberOfLatentFactors)

Example

var factors = factorizeMatrix(targetMatrix, numberOfLatentFactors)
var completeMatrix = matrixFactorization.dot(factors[0], matrixFactorization.transpose(factors[1]))

Roadmap

  1. Create demo app.
  2. Improve docs.

Notes

Implementation based on this article by @albertauyeung.

License

MIT

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i matrix-factorization

    Weekly Downloads

    9

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • johnpaulada