当前位置:网站首页>NMF-matlab
NMF-matlab
2022-07-02 19:42:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
matlab Practice the program ( Nonnegative matrix decomposition )
The algorithm is Lee and Seung stay 1999 Years published in nature In the magazine . See the specific paper here :http://www.seas.upenn.edu/~ddlee/Papers/nmf.pdf.
It doesn't matter if you don't understand English , You can see this introduction in Chinese :http://wenku.baidu.com/view/94c8af0bf78a6529647d5331.html.
The principle of the above two articles has been very clear , I'm introducing it according to my own understanding .
Usually, matrix decomposition is as follows svd Or any other decomposition will decompose the matrix into positive and negative matrices , And his decomposition method completely decomposes the matrix into a matrix with only positive numbers , Because in the real world, such as images , Negative numbers are meaningless , So this decomposition method that only decomposes into positive matrix is very meaningful , Otherwise, it will not be sent in nature Such a cow B In my magazine .
Here is the formula of decomposition :
here r Is the rank of the decomposition matrix ,V Is an approximation of the original matrix ,W And H Is the decomposition of two matrices .
Here is W and H The way of seeking , It's an iterative algorithm , Initial W And H It's random :
About the code , I learned from this blog :http://fxy1211.blog.163.com/blog/static/68255322007826111015905/, Thank you so much for this blogger .
Here is the code :
clear all; close all; clc; V=double(imread('lena.jpg')); imshow(mat2gray(V)); [i u]=size(V); % Calculation V Specifications r=100; % Set the rank of the decomposition matrix W=rand(i,r); % initialization WH, It's a nonnegative number H=rand(r,u); maviter=100; % Maximum number of iterations for iter=1:maviter W=W.*((V./(W*H))*H'); % Note that the three formulas here correspond to those in the text
W=W./(ones(i,1)*sum(W)); H=H.*(W'*(V./(W*H)));
end img_V=W*H; figure; imshow(mat2gray(img_V));The following is the original image and the reconstructed effect , If the number of rank sum iterations is greater , Then the reconstructed graph is closer to the original graph :
Original picture
Reconstruction graph
Because this is based on my related direction. I happened to see this algorithm in the quotation of a paper , So I got a little understanding , There must be something wrong , be it so .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/148571.html Link to the original text :https://javaforall.cn
边栏推荐
- AcWing 1126. 最小花费 题解(最短路—dijkstra)
- Implementation of online shopping mall system based on SSM
- Py之interpret:interpret的简介、安装、案例应用之详细攻略
- AcWing 1134. 最短路计数 题解(最短路)
- Reading notes of code neatness
- Introduction to mongodb chapter 03 basic concepts of mongodb
- RPD product: super power squad nanny strategy
- Bubble sort array
- Windows2008R2 安装 PHP7.4.30 必须 LocalSystem 启动应用程序池 不然500错误 FastCGI 进程意外退出
- JS how to get integer
猜你喜欢

数据湖(十二):Spark3.1.2与Iceberg0.12.1整合

Introduction to program ape (XII) -- data storage

搭建主从模式集群redis

高并发下如何避免产生重复数据?

IDEA编辑器去掉sql语句背景颜色SQL语句警告No data sources are configured to run this SQL...和SQL Dialect is Not Config

How to avoid duplicate data in gaobingfa?

KS004 基于SSH通讯录系统设计与实现
Bubble sort array

450-深信服面经1

蓝牙芯片ble是什么,以及该如何选型,后续技术发展的路径是什么
随机推荐
良心总结!Jupyter Notebook 从小白到高手,保姆教程来了!
字典
mysql函数
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
AcWing 1126. 最小花费 题解(最短路—dijkstra)
How to avoid duplicate data in gaobingfa?
AcWing 1134. 最短路计数 题解(最短路)
AcWing 1137. Select the best line solution (the shortest circuit)
AcWing 383. 观光 题解(最短路)
Notes de lecture sur le code propre
AcWing 343. 排序 题解(floyd性质实现传递闭包)
KT148A语音芯片ic的开发常见问题以及描述
AcWing 1131. 拯救大兵瑞恩 题解(最短路)
《重构:改善既有代码的设计》读书笔记(上)
Usage of ieda refactor
AcWing 1137. 选择最佳线路 题解(最短路)
AcWing 1125. 牛的旅行 题解(最短路、直径)
zabbix5客户端安装和配置
函数高阶-柯里化实现
451 implementation of memcpy, memmove and memset