GsvdInitialization

Discovery of "missing" directions in nonnegative matrix factorization

https://github.com/holylab/gsvdinitialization.jl

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
    Organization holylab has institutional domain (holylab.wustl.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Discovery of "missing" directions in nonnegative matrix factorization

Basic Info
  • Host: GitHub
  • Owner: HolyLab
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Size: 201 KB
Statistics
  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • Open Issues: 2
  • Releases: 2
Created about 3 years ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

GsvdInitialization

CI codecov

This package implements the technique in the paper GSVD-NMF: Recovering Missing Features in Non-negative Matrix Factorization. It is used to recover Non-negative matrix factorization(NMF) components from an initial lower-rank factorization by exploiting the generalized singular value decomposition (GSVD) between existing NMF results and the SVD of X. This method allows the incremental expansion of the number of components, which can be convenient and effective for interactive analysis of large-scale data.

See also NMFMerge for the converse operation. Together, the two result in a substantial improvement in the quality and consistency of NMF factorization.


Demo:

To run this demo, NMF.jl and LinearAlgebra.jl are also required.

Install and load packages (type ] at the julia> prompt to enter pkg> mode): julia pkg> add GsvdInitialization; julia> using GsvdInitialization, NMF, LinearAlgebra;

Generating grouth truth with 10 features.

julia julia> include("demo/generate_ground_truth.jl") julia> W_GT, H_GT = generate_ground_truth(); julia> X = W_GT*H_GT;

Sample Figure

Running standard NMF(HALS) using NNDSVD as initialization on X. Here, we're taking a couple of precautions to try to ensure the best possible result from NMF: - we disable premature convergence by setting maxiter to something that is practically infinite - we use the full svd, rather than rsvd, for initializing NNDSVD, as svd gives higher-quality results than rsvd Despite these precautions, we'll see that the NMF result leaves much to be desired:

julia julia> result_hals = nnmf(X, 10; init=:nndsvd, alg = :cd, tol = 1e-4, maxiter=10^12, initdata = svd(X)); julia> sum(abs2, X-result_hals.W*result_hals.H)/sum(abs2, X) 0.0999994991270576 The result is given by

Sample Figure

This factorization is not perfect as two components are the same and two features share one component. Then, running GSVD-NMF on X (also using NNSVD as initialization) and computing the new reconstruction error:

julia Wgsvd, Hgsvd = gsvdnmf(X, 9=>10; alg = :cd, tol_final = 1e-4, tol_intermediate = 1e-2, maxiter = 10^12); julia> sum(abs2, X-Wgsvd*Hgsvd)/sum(abs2, X) 1.2322603074132593e-10 An imperfect factorization from nnmf alone was augmented by gsvdnmf to a perfect factorization. Here are the new components:

Sample Figure


Functions

W, H = gsvdnmf(X::AbstractMatrix, ncomponents::Pair{Int,Int}; tolfinal=1e-4, tolintermediate=1e-4, kwargs...)

Perform "GSVD-NMF" on the data matrix X.

Arguments:

  • X: non-negative data matrix

  • ncomponents: in the form of n1 => n2, augments from n1 components to n2components, where n1 is the number of components for initial NMF (under-complete NMF), and n2 is the number of components for final NMF.

Alternatively, ncomponents can be an integer denoting the number of components for final NMF. In this case, gsvdnmf defaults to augment components on initial NMF solution by 1.

Keyword arguments:

  • tol_final: The tolerence of final NMF, default:10^{-4}

  • tol_intermediate: The tolerence of initial NMF (under-complete NMF), default: tol_final

Other keyword arguments are passed to NMF.nnmf.


W, H = gsvdnmf(X::AbstractMatrix, W::AbstractMatrix, H::AbstractMatrix, f; n2 = size(first(f), 2), tol_nmf=1e-4, kwargs...)

Augment W and H to have n2 components, subsequently polished by NMF.

Arguments:

  • X: non-negative data matrix

  • W and H: initial NMF factorization

  • n2: the number of components in augmented factorization

  • f: SVD (or Truncated SVD) of X

Keyword arguments:

  • tol_nmf: the tolerance of NMF polishing step, default: 1e-4

Other keyword arguments are passed to NMF.nnmf.


Wadd, Hadd, S = gsvdrecover(X, W0, H0, kadd, f)

Augment components for W and H without polishing by NMF.

Outputs:

Wadd: augmented NMF solution

Hadd: augmented NMF solution

S: generalized singular values for the kadd augmented components

Arguments:

X: non-nagetive 2D data matrix

W0: NMF solution

H0: NMF solution

kadd: number of new components

f: SVD (or Truncated SVD) of X


Citation

Thanks for citing this work! See the "Cite this repository" link in the "About" bar for format options.

Owner

  • Name: Holy Lab
  • Login: HolyLab
  • Kind: organization
  • Email: holy@wustl.edu
  • Location: Washington University in St. Louis

None

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: 'GSVD-NMF: Recovering Missing Features in Non-negative Matrix Factorization'
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Youdong
    family-names: Guo
    orcid: 'https://orcid.org/0009-0007-7787-3722'
  - given-names: Timothy E.
    family-names: Holy
    orcid: 'https://orcid.org/0000-0002-2429-1071'
identifiers:
  - type: url
    value: 'https://arxiv.org/abs/2408.08260'
    description: The ArXiv deposit of the encompassing paper.
doi: 'https://doi.org/10.48550/arXiv.2408.08260'
repository-code: 'https://github.com/HolyLab/GsvdInitialization.jl'
abstract: >-
  Non-negative matrix factorization (NMF) is an important
  tool in signal processing and widely used to separate
  mixed sources into their components. However, NMF is
  NP-hard and thus may fail to discover the ideal
  factorization; moreover, the number of components may not
  be known in advance and thus features may be missed or
  incompletely separated. To recover missing components from
  under-complete NMF, we introduce GSVD-NMF, which proposes
  new components based on the generalized singular value
  decomposition (GSVD) between preliminary NMF results and
  the SVD of the original matrix. Simulation and
  experimental results demonstrate that GSVD-NMF often
  recovers missing features from under-complete NMF and
  helps NMF achieve better local optima.

GitHub Events

Total
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 2
  • Pull request review comment event: 2
  • Pull request review event: 1
  • Pull request event: 6
  • Create event: 3
Last Year
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 2
  • Pull request review comment event: 2
  • Pull request review event: 1
  • Pull request event: 6
  • Create event: 3

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 13
  • Average time to close issues: less than a minute
  • Average time to close pull requests: 3 days
  • Total issue authors: 1
  • Total pull request authors: 5
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.38
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 minutes
  • Issue authors: 0
  • Pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.2
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • JuliaTagBot (1)
Pull Request Authors
  • youdongguo (9)
  • timholy (4)
  • dependabot[bot] (2)
  • kdw503 (2)
  • github-actions[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (2)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 1 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
juliahub.com: GsvdInitialization

Discovery of "missing" directions in nonnegative matrix factorization

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1 Total
Rankings
Dependent repos count: 3.2%
Downloads: 3.3%
Average: 7.6%
Dependent packages count: 16.3%
Last synced: 7 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v4 composite
  • julia-actions/cache v2 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite