Skip to main content

MF Algorithms contains various matrix factorization methods utilizing different iterative update rules.

Project description

MF Algorithms

PyPI Version Supported Python Versions

MF Algorithms contains various matrix factorization methods utilizing different iterative update rules.


Installation

To install MF Algorithms, run this command in your terminal:

$ pip install -U mf-algorithms

This is the preferred method to install MF Algorithms, as it will always install the most recent stable release.

If you don't have pip installed, these installation instructions can guide you through the process.

Usage

First import functions from the package. scipy.sparse is also useful for creating toy sparse matrices to test the algorithms, thought we will manually generate factor matrices and multiply them to guarantee its rank.

>>> import numpy as np
>>> from mf_algorithms import functions

Matrix Factorization

>>> dim1 = 1000
>>> dim2 = 1000
>>> k = 50
>>> factors = np.random.choice(4, size=(dim1,k), p=np.array([0.97, 0.01, 0.01, 0.01]))
>>> weights = np.random.choice(2, size=(k, dim2), p=np.array([0.999, 0.001]))
>>> mat = factors @ weights
>>> A, S, error = functions.mf(data = mat, k = 50, s1 = 1, s2 = 1, niter = 100, siter = 1, update = 'als', errseq = False)

Citing

If you use our work in an academic setting, please cite our paper:

Development

See CONTRIBUTING.md for information related to developing the code.

Suggested Git Branch Strategy

  1. master is for the most up-to-date development, very rarely should you directly commit to this branch. Your day-to-day work should exist on branches separate from master. It is recommended to commit to development branches and make pull requests to master.4. It is recommended to use "Squash and Merge" commits when committing PR's. It makes each set of changes to master atomic and as a side effect naturally encourages small well defined PR's.

Additional Optional Setup Steps:

  • Create an initial release to test.PyPI and PyPI.

    • Follow This PyPA tutorial, starting from the "Generating distribution archives" section.
  • Create a blank github repository (without a README or .gitignore) and push the code to it.

  • Delete these setup instructions from README.md when you are finished with them.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mf_algorithms-0.2.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

mf_algorithms-0.2.2-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mf_algorithms-0.2.2.tar.gz.

File metadata

  • Download URL: mf_algorithms-0.2.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for mf_algorithms-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6bdc051a9b1583dbc1f5c69cc5d5cddead52460ceb4c8f2c3839ed0f0bfdeb2b
MD5 11fae44cf3a114e9ed8e9b1b3a69ca12
BLAKE2b-256 47b16572c121807b8e3dfbef39dba31fe78d95ad8dd67bbda093bbac0c829a81

See more details on using hashes here.

File details

Details for the file mf_algorithms-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: mf_algorithms-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for mf_algorithms-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6efbd67371aebcf3432496899f1b02fd3ff9690bd486a459f74f3943aa3e1e20
MD5 f1cec1bd6edfe22a1ad794931d62b1b6
BLAKE2b-256 028834d4c27322ca11f707f9af9a84b6aa26f1d9eaf039dca635bed7f501ba1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page