在matlab中规范化mat文件 [英] normalize mat file in matlab

查看:102
本文介绍了在matlab中规范化mat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Mat文件,其结构如下:

I have a mat file with a structure that looks like this:

如何规范化数据并将其另存为.dat文件(ascii)

How do I normalize the data and save it as a .dat file (ascii)

推荐答案

我假设您要标准化每一列.

I assume that you want to normalize each column.

有两种标准化的方法:

(1)最小设置为0,最大设置为1

(1) Set minimum to 0 and maximum to 1

dataset = bsxfun(@minus,dataset,min(dataset));
dataset = bsxfun(@rdivide,dataset,max(dataset));

(2)将平均值设置为零,标准偏差设置为1(如果没有统计工具箱,请分别使用meanstd分别进行减法和除法运算).

(2) Set average to zero, standard deviation to 1 (if you don't have the Statistics Toolbox, use mean and std to subtract and divide, respectively, as above).

dataset = zscore(dataset); 

编辑

为什么有人曾经使用选项2进行规范化?

在计算不同数据点之间的差异(差异)时,您可能希望平均权衡不同的尺寸.由于方差较大的维将主导相异性度量,因此您可以将方差归一化为一个.

When you calculate the difference (dissimilarity) between different data points, you may want to weigh the different dimensions equally. Since dimensions with large variance will dominate the dissimilarity measure, you normalize the variance to one.

这篇关于在matlab中规范化mat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆