当前位置:网站首页>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
边栏推荐
- 全志A33使用主线U-Boot
- Chapter 7 - class foundation
- 电脑使用哪个录制视频软件比较好
- LeetCode 0871.最低加油次数 - 类似于POJ2431丛林探险
- 字典
- Gmapping code analysis [easy to understand]
- 数据降维——因子分析
- Gamefi链游系统开发(NFT链游开发功能)丨NFT链游系统开发(Gamefi链游开发源码)
- Tutorial (5.0) 10 Troubleshooting * fortiedr * Fortinet network security expert NSE 5
- PHP asymmetric encryption method private key and public key encryption and decryption method
猜你喜欢

AcWing 342. Road and route problem solving (shortest path, topological sorting)

zabbix5客户端安装和配置

Chic Lang: completely solve the problem of markdown pictures - no need to upload pictures - no need to network - there is no lack of pictures forwarded to others

Registration opportunity of autowiredannotationbeanpostprocessor in XML development mode

线程应用实例

Markdown basic grammar

SQLite 3.39.0 发布,支持右外连接和全外连接

End-to-End Object Detection with Transformers(DETR)论文阅读与理解

PHP-Parser羽毛球预约小程序开发require线上系统

数据降维——主成分分析
随机推荐
SIFT特征点提取「建议收藏」
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
2022.7.1-----leetcode. two hundred and forty-one
AcWing 1137. Select the best line solution (the shortest circuit)
AcWing 1137. 选择最佳线路 题解(最短路)
Use cheat engine to modify money, life and stars in Kingdom rush
以太网PHY层芯片LAN8720A简介
Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
Emmet基础语法
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
安装单机redis详细教程
MySQL高级(进阶)SQL语句
MySQL table historical data cleaning summary
数据湖(十二):Spark3.1.2与Iceberg0.12.1整合
机器学习笔记 - 时间序列预测研究:法国香槟的月销量
程序猿入门攻略(十二)——数据的存储
mybatiesHelperPro工具必须的可以生成到对应项目文件夹下
2022 compilation principle final examination recall Edition
横向越权与纵向越权[通俗易懂]
【ERP软件】ERP体系二次开发有哪些危险?