当前位置:网站首页>NMF-matlab
NMF-matlab
2022-07-02 18:38:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
matlab练习程序(非负矩阵分解)
这个算法是Lee和Seung在1999年发表在nature杂志上的。具体论文看这里:http://www.seas.upenn.edu/~ddlee/Papers/nmf.pdf。
看不懂英文没关系,可以看这个中文的介绍:http://wenku.baidu.com/view/94c8af0bf78a6529647d5331.html。
原理上面两篇文章已经很清楚了,我在按自己的理解介绍一下吧。
通常矩阵分解如svd或其他什么的分解都会把矩阵分解为有正有负的矩阵,而他的这种分解方法就把矩阵完全分解成只有正数的矩阵,因为现实世界中如图像,负数是没什么意义的,所以这种只分解为正数矩阵的分解方法就很有意义了,要不也不会发在nature这样牛B的杂志上。
这里是分解的公式:
这里r是分解矩阵的秩,V是原矩阵的一个近似,W与H就是分解而成的两个矩阵。
下面是W和H的求法,是一个迭代算法,初始的W与H是随机的就行了:
关于代码,我借鉴了这个博客的:http://fxy1211.blog.163.com/blog/static/68255322007826111015905/,真是太感谢这位博主了。
下面是代码:
clear all; close all; clc; V=double(imread('lena.jpg')); imshow(mat2gray(V)); [i u]=size(V); %计算V的规格 r=100; %设置分解矩阵的秩 W=rand(i,r); %初始化WH,为非负数 H=rand(r,u); maviter=100; %最大迭代次数 for iter=1:maviter W=W.*((V./(W*H))*H'); %注意这里的三个公式和文中的是对应的
W=W./(ones(i,1)*sum(W)); H=H.*(W'*(V./(W*H)));
end img_V=W*H; figure; imshow(mat2gray(img_V));下面是原图和重构后的效果,如果秩和迭代次数越大,那么重构后的图越接近原图:
原图
重构图
因为这个是看自己相关方向论文偶然在一篇论文的引用中看到了这个算法,所以就稍微了解了一下,肯定有不妥的地方,就这样吧。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/148571.html原文链接:https://javaforall.cn
边栏推荐
- PHP parser badminton reservation applet development requires online system
- Golang concurrent programming goroutine, channel, sync
- Advanced performance test series "24. Execute SQL script through JDBC"
- Golang并发编程——goroutine、channel、sync
- 移动机器人路径规划:人工势场法[通俗易懂]
- 《代碼整潔之道》讀書筆記
- Implementation of 452 strcpy, strcat, StrCmp, strstr, strchr
- MySQL高级(进阶)SQL语句
- 多态的理解以及作用
- Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
猜你喜欢

Machine learning notes - time series prediction research: monthly sales of French champagne

Registration opportunity of autowiredannotationbeanpostprocessor under annotation development mode

Markdown basic grammar

机器学习笔记 - 时间序列预测研究:法国香槟的月销量

AcWing 342. 道路与航线 题解 (最短路、拓扑排序)

Data dimensionality reduction factor analysis

嵌入式(PLD) 系列,EPF10K50RC240-3N 可编程逻辑器件

PHP parser badminton reservation applet development requires online system

zabbix5客户端安装和配置

Detailed tutorial on installing stand-alone redis
随机推荐
4274. Suffix expression - binary expression tree
注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
Mobile robot path planning: artificial potential field method [easy to understand]
思考变量引起的巨大变化
移动机器人路径规划:人工势场法[通俗易懂]
According to the atlas of data security products and services issued by the China Academy of information technology, meichuang technology has achieved full coverage of four major sectors
MySQL高级(进阶)SQL语句
Py之interpret:interpret的简介、安装、案例应用之详细攻略
IEDA refactor的用法
《代码整洁之道》读书笔记
In pytorch function__ call__ And forward functions
MySQL
AcWing 1137. Select the best line solution (the shortest circuit)
潇洒郎:彻底解决Markdown图片问题——无需上传图片——无需网络——转发给他人图片无缺失
AcWing 1127. 香甜的黄油 题解(最短路—spfa)
Develop fixed asset management system, what voice is used to develop fixed asset management system
NPOI导出Excel2007
电脑使用哪个录制视频软件比较好
Codeforces Round #802 (Div. 2) 纯补题
虚拟机初始化脚本, 虚拟机相互免秘钥