加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

大数据处理之道 (MATLAB 篇)

发布时间:2020-12-14 02:53:13 所属栏目:大数据 来源:网络整理
导读:一:起因 (1)最近一直在处理大数据,从MB ---- GB的变化,是一次质的飞跃,相应的工具也在变 从widows到linux,从单机单核 到 hadoop多节点的计算 (2)问题来了,面对海量的数据,如何从中挖掘实用的信息或者发现潜在的现象,可视化工具可能是必不可少的

一:起因

(1)最近一直在处理大数据,从MB ----> GB的变化,是一次质的飞跃,相应的工具也在变 从widows到linux,从单机单核 到 hadoop多节点的计算

(2)问题来了,面对海量的数据,如何从中挖掘实用的信息或者发现潜在的现象,可视化工具可能是必不可少的 ;

(3)可视化工具可以说百度一大篇,可是作为研究者的我们,程序猿的我们可能更希望能够抽象出一种数学模型,对现实的现象进行非常好的描述和刻画

(4)Python(数据清洗和处理) + MATLAB(模型分析) 或 c++/java/hadoop(数据清洗和处理) + MATLAB(模型分析

(5)先前的一篇博文可以参考?? c++ fstream + string 处理大数据

二:MATLAB 学习

(1)伽马分布(gamfit)

clc
clear all
close all
dataall = load('G:zyp_thanksmetro_test1-07529_2.csv');
data = dataall(:,3);%指定列

[y,x]=hist(data,6);%creates a histogram bar plot of data,sorts data into the number of bins specified by nbins
%return the categorical levels correponding to each count in N
subplot(2,2,1)
bar(x,y,'FaceColor','r','EdgeColor','w');box off

cxd1=gamfit(data);% returns the maximum likehood estimates(MLEs) for the parameters of the gamma distribution given the data in vector data.
% 伽玛分布中的参数α,称为形状参数,β称为尺度参数。
a = cxd1(1);
b = cxd1(2);
cxd2=gamcdf(data,cxd1(1),cxd1(2));%return the gamma cdf(分布函数) at each of the values in x using the corresponding shape parameters a and scale parameter
%cxd2 = gampdf(data,cxd1(2));%%return the gamma pdf(密度函数) at each of the values in x using the corresponding shape parameters a and scale parameter
H=kstest(data,[data,cxd2]);
subplot(2,2);
plot(data,cxd2);


(2)MATALAB 下 .m 文件的命名

% 错误提示:

%Attempt to execute SCRIPT *** as a function???? 在运行MATLAB程序的时候,出现如题的报错。

% 原因:
% 在系统中,现有的.m文件有的与***函数重名,所以matlab编译器不知道在遇到***的时候到底该执行哪一个函数。
% 例如:我编写了一个.m文件,命名为:fft2.m.用于实现通过频域分析提取图像的纹理特征。
% 当命令执行到X=fft2(ImageM)这句话的时候,不知道fft2是指系统函数还是自定义的纹理特征提取函数。

% 解决:
% 把自定义的函数名改成其他名字。如上例中的fft2改为ffttexture.m?

(3)pdf 和 cdf函数的说明、

Probability density function(PDF) 概率密度函数;?

cumulative distribution function ; CDF 是累积分布函数

(4)正态分布(normpdf normcdf)

clc
clear all
close all
dataall = load('G:zyp_thanksmetro_test1-07529_2.csv');
data = dataall(:,3);%指定列
[mu,sigma]=normfit(data);%estimate of the mean and standard deviation in data
[y,sorts data into the number of bins specified by nbins
%return the categorical levels correponding to each count in N
bar(x,'w');box off
xlim([mu-3*sigma,mu+3*sigma]) % sets the axis limits in the current axes to the specified values
a2=axes;
% computes the pdf at each of the values in X using the normal distribution
% with mean and standard deviation sigma.
ezplot(@(x)normpdf(x,mu,sigma),[mu-3*sigma,mu+3*sigma])
set(a2,'box','off','yaxislocation','right','color','none')
title '频数直方图与正态分布密度函数(拟合)'


(5) quantile - quantile plot (Q-Q plot)

clc
clear all
close all
dataall = load('G:zyp_thanksmetro_test1-07529_2.csv');
data = dataall(:,3);%指定列
qqplot(data);
% displays a quantile-quantile plot of the sample quantiles of X versus
% theoretical from a normal distribution. if the distribution of X is
% normal,the plot will be close to linear.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读