Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

DimensionReducers

Guides

  • Dimension reduction functions

Symbols

  • BasisVectorInterpretation
  • FastICA
  • GDCLSGlobal
  • GDCLS
  • IndependentComponentAnalysis
  • LeftNormalizeMatrixProduct
  • NearestWords
  • NonNegativeMatrixFactorizationGlobal
  • NonNegativeMatrixFactorization
  • NormalizeMatrixProduct
  • RightNormalizeMatrixProduct
AntonAntonov`DimensionReducers`
NonNegativeMatrixFactorization
​
NonNegativeMatrixFactorization[mat,k]
finds non-negative matrix factors for the matrix mat using
k
dimensions.
​
Details and Options

Examples  
(6)
Basic Examples  
(1)
Create a random integer matrix:
In[1]:=
SeedRandom[7]​​mat=RandomInteger[10,{4,3}];​​MatrixForm[mat]
Out[1]=
RandomGeneratorState
Method: ExtendedCA
State hash: -1757226858037071779

Out[1]//MatrixForm=
4
7
4
10
8
8
5
3
4
5
4
5
Compute the NNMF factors:
In[2]:=
{W,H}=
NonNegativeMatrixFactorization
[mat,2];​​Row[{MatrixForm[W],MatrixForm[H]}]
Out[2]=
0.688539
0.0354316
0.625313
0.766099
0.196628
0.466821
0.310216
0.440358

5.42607
10.0437
5.45225
8.36432
2.19475
6.34806

Here is the matrix product of the obtained factors:
In[3]:=
MatrixForm[W.H]
Out[3]//MatrixForm=
4.03242
6.99325
3.97901
9.80089
7.96186
8.2726
4.97155
2.99943
4.03547
5.36655
4.0822
4.48679
Note that elementwise relative errors between the original matrix and reconstructed matrix are small:
In[4]:=
MatrixForm[Round[(W.H-mat)/mat,0.001]]
Out[4]//MatrixForm=
0.008
-0.001
-0.005
-0.02
-0.005
0.034
-0.006
0.
0.009
0.073
0.021
-0.103
Scope  
(1)

Options  
(2)

Applications  
(1)

Properties & Relations  
(1)

SeeAlso
SingularValueDecomposition
 
▪
IndependentComponentAnalysis
 
▪
DimensionReduction
 
▪
BasisVectorInterpretation
RelatedGuides
▪
Dimension reduction functions
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com