Catalog PyPI
PACKAGE EXPLORERView in registry

adnmtf

PyPI

Non-negative Matrix and Tensor Factorization

Versions collected1
Direct dependencies0From release 0.1.165
Last observed20 Oct, 19:43 UTC

README

Version 0.1.165 documentation

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
12
34
56
78
910
1112
and
H
0.10.20.30.40.50.6
0.90.80.70.60.40.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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.16529 Apr 20240

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
advestis/adnmtf

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:43 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:625387e3eaefbde7c89efb19b18c67a9e636a113fa492b2f5f910aad15821b66