matlab - 如何将 tsne() 应用于 MATLAB 表格数据?
问题描述
我在 MATLAB 中有一个 33000 x 1975 的表,在我做任何进一步的分析之前显然需要降维。特征是 1975 列,行是数据的实例。我尝试在 MATLAB 表上使用 tsne() 函数,但似乎 tsne() 仅适用于数值数组。问题是有一种方法可以在我的 MATLAB 表上应用 tsne。该表由数字和字符串数据类型组成,因此 table2array() 在我的情况下不适用于将表转换为数字数组。此外,从 MATHWORKS 文档看来,以应用到 fisheriris 数据集为例, tsne() 将特征列作为函数参数。因此,我需要将预测变量与共振分开,这应该不是问题。但是,最初,我如何进一步使用 tsne 似乎令人困惑。在这方面的任何建议将不胜感激。
解决方案
您可能可以使用table
索引{}
来获取所需的数据。这是一个改编自tsne
参考页面的简单示例:
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)
推荐阅读
- graphql - 无法在阿波罗中使用“对象数组”类型的属性进行突变
- mysql - 保存集时违反Spring JPA唯一约束
- python - 有没有办法只在第一次调用函数时计算一些东西而不在 python3 中创建全局?
- javascript - 为什么 Chart.js forEach 未定义
- c++ - 是否需要删除包含对象的“对”?
- xamarin.forms - xamarin 表单:如何禁用选项卡按钮
- bluetooth-lowenergy - BLE 模块 CSR1010 断线问题
- python - ValueError:无法将字符串转换为浮点数:python中的'False'
- javascript - 获取样式特定节点的样式表标签
- sql-server - 阻止无法登录 SQL Server 的 IP