Skip to main content

doc License: GPL v3

Status

pytests push-pypi push-doc

maintained issues pr

Compatibilities

ubuntu windows unix

python

Contact

linkedin linkedin2 website mail

NMTF

Non-Negative Matrix and Tensor Factorizations

Developped in collaboration with Advestis (Github)

NMF Example

from adnmtf import NMF
import numpy as np

w = np.array([[1, 2],
              [3, 4],
              [5, 6],
              [7, 8],
              [9, 10],
              [11, 12]])

h = np.array([[0.1, 0.2, 0.3, 0.4, 0.5, 0.6],
              [0.9, 0.8, 0.7, 0.6, 0.5, 0.4]])
m0 = w.dot(h)
my_nmfmodel = NMF(n_components=2)
estimator_ = my_nmfmodel.fit_transform(m0)
estimator_ = my_nmfmodel.predict(estimator_)

In this example, the matrix to be factorized is generated by the dot product of:

W
1 2
3 4
5 6
7 8
9 10
11 12
and
H
0.1 0.2 0.3 0.4 0.5 0.6
0.9 0.8 0.7 0.6 0.4 0.4
  • NMF instantiates a NMF class with 2 components.
  • fit_transform calls the functions below in the given order:
    • nmtf_base module: non_negative_factorization, nmf_init, r_ntf_solve
    • nmtf_core module: ntf_solve, ntf_solve_simple, ntf_update
  • predict derives from fit_transform outputs ordered sample and feature indexes for future use in ordered heatmaps. predict calls nmf_predict and build_clusters in the nmtf_base module

NTF Example

from adnmtf import NTF
import pandas as pd

DATA_PATH = ...

df = pd.read_csv(DATA_PATH)
m0 = df.values
n_blocks = 5
my_ntfmodel = NTF(n_components=5)
estimator_ = my_ntfmodel.fit_transform(m0, n_blocks)
estimator_ = my_ntfmodel.predict(estimator_)

In this example, the tensor to be factorized is read in file data_ntf.csv. The tensor has 5 layers in the 3rd dimension and is formatted as a table with 5 blocks concatenated horizontally.

  • NTF instantiates a NTF class with 5 components.
  • fit_transform calls the functions below in the given order:
    • nmtf_base module: non_negative_tensor_factorization, ntf_init, r_ntf_solve
    • nmtf_core module: ntf_solve, ntf_solve_simple, ntf_update
  • predict derives from fit_transform outputs ordered sample and feature indexes for future use in ordered heatmaps. predict calls nmf_predict and build_clusters in the nmtf_base module

Articles

Peer-reviewed articles

Blog articles

Download files

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

Source Distribution

adnmtf-0.1.165.tar.gz (1.6 MB view details)

Uploaded Source

File details

Details for the file adnmtf-0.1.165.tar.gz.

File metadata

  • Download URL: adnmtf-0.1.165.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for adnmtf-0.1.165.tar.gz
Algorithm Hash digest
SHA256 167574a402c40c1398c6a0e0107b091921df7bfc42f887e15be2201e1cad0b48
MD5 191a907d8fbfd9e519efc649872301b7
BLAKE2b-256 05500d1fd126dc931b6a2e1e7c7f57e8d2906c1e2a91b0013742984dfd0b321d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.165 This release

1 file

0.1.164

1 file

0.1.159

1 file

0.1.157

1 file

0.1.155

1 file

0.1.151

1 file

0.1.147

1 file

0.1.144

1 file

0.1.139

1 file

0.1.136

1 file

0.1.135

1 file

0.1.130

1 file

0.1.129

1 file

0.1.127

1 file

0.1.119

1 file

0.1.117

1 file

0.1.116

1 file

0.1.115

1 file

0.1.112

1 file

0.1.109

1 file

0.1.108

1 file

0.1.107

1 file

0.1.106

1 file

0.1.105

1 file

0.1.104

1 file

0.1.103

1 file

0.1.100

1 file

0.1.99

1 file

0.1.97

1 file

0.1.87

1 file

0.1.85

1 file

0.1.72

1 file

0.1.71

1 file

Supported by

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