【问题标题】:How to apply tsne() to MATLAB tabular data?如何将 tsne() 应用于 MATLAB 表格数据?
【发布时间】:2019-04-28 08:20:52
【问题描述】:
我在 MATLAB 中有一个 33000 x 1975 的表,在我做任何进一步的分析之前显然需要降维。特征是 1975 列,行是数据的实例。我尝试在 MATLAB 表上使用 tsne() 函数,但似乎 tsne() 仅适用于数值数组。问题是有一种方法可以在我的 MATLAB 表上应用 tsne。该表由数字和字符串数据类型组成,因此 table2array() 在我的情况下不适用于将表转换为数字数组。
此外,从 MATHWORKS 文档看来,以应用到 fisheriris 数据集为例, tsne() 将特征列作为函数参数。所以,我需要将预测变量与共振分开,这应该不是问题。但是,最初,我如何进一步使用 tsne 似乎令人困惑。在这方面的任何建议都将受到高度赞赏。
【问题讨论】:
标签:
matlab
machine-learning
feature-extraction
feature-selection
【解决方案1】:
您或许可以使用table indexing using {} 来获取您想要的数据。这是一个改编自tsne reference page的简单示例:
load fisheriris
% Make a table where the first variable is the species name,
% and the other variables are the measurements
data = table(species, meas(:,1), meas(:,2), meas(:,3), meas(:,4))
% Use {} indexing on 'data' to extract a numeric matrix, then
% call 'tsne' on that
Y = tsne(data{:, 2:end});
% plot as per example.
gscatter(Y(:,1),Y(:,2),data.species)