中值绝对偏差 --> 导出到表以进一步进行 tSNE各位,
我目前正在从事一个使用 57 个样本和 >800 000 个变量的项目(见附图)。 现在我想通过仅使用具有最高中值绝对偏差 (MAD) 的变量来减少变量。 目标是使用 PC Analysis 进一步处理数据,然后使用 t-SNE(我正在使用不错的 JMP 插件)。
到目前为止,我一直在努力识别具有最高 MAD 的变量,并将这些变量直接导出到数据表中。
在此先感谢,最好的问候
拍
回复:中值绝对偏差 --> 导出到表以进一步进行 tSNE多谢@txnelson和@ian_jmp原则上你的建议奏效了。 不幸的是,我使用了一个较慢的工作站进行测试,因此我无法处理所有变量,必须在更快的系统上进行检查。 一切顺利,帕特
回复:中值绝对偏差 --> 导出到表以进一步进行 tSNE我最初将“中位数”误读为“平均值”并写下了以下内容:在我的 Mac 上需要几秒钟,但几乎所有这些都用于制作示例表:
NamesDefaultToHere(1);
// Make a table with 'nc' columns and 'nr' rows to use . . .
nc = 1000;
nr = 57;
dt = NewTable("MAD Example");
for(c=1, c<=nc, c++,
dt << NewColumn("Col "||Char(c), Numeric, Continuous, Formula(RandomNormal(0, 1)));
);
dt << addRows(nr);
dt << runFormulas;
// Start Here: Calculate MAD for each column . . .
dt = CurrentDataTable();
mat = dt << getAsMatrix;
// (1): Get the mean of each column in a row vector
mean = VMean(mat);
// (2): 'Explode' this to make a matrix congruant with 'mat'
meanMat = Repeat(mean, nr);
// (3): Get the Absolute deviations
AD = Abs(mat - meanMat);
// (4): Get the MAD
MAD = VMean(AD);
// Find the column numbers of the 'nc2' columns that have the biggest MAD values
nc2 = Round(nc/10, 0);
rankMAD = Rank(MAD);
topRandMAD = rankMAD[(nc-nc2)+1::nc];
// Make a second table
dt2 = NewTable("Top "||Char(nc2)||" Largest MAD Values from "||(dt << getName),
NewColumn("Column Number", Numeric, Nominal, Values(topRandMAD)),
NewColumn("MAD", Numeric, Continuous, Values(MAD[topRandMAD]))
);
此外@txnelson方法,我注意到 Distribution 平台会给出中位数绝对偏差。 虽然有 800,000 列,但我可能希望他的方法更快。
回复:中值绝对偏差 --> 导出到表以进一步进行 tSNE这是一个更完整的示例,您可以通过更改对“dt”数据表的引用以及要删除的输出表中的列(即样本 ID)来直接使用
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
dt << select where(row()==1);
dtMAD = dt << Subset(
Selected Rows( 0 ),
Rows( [1] ),
Selected columns only( 0 )
);
dtMAD << delete columns({"Lot_id","wafer","Wafer id in lot ID","site"});
For( i = 1, i <= N Cols( dtMAD ), i++,
theMatrix = Column( dt, Column( dtMAD, i ) << get name ) << get as matrix;
Column( dtMAD, i )[1] = Quantile( .5, Abs( theMatrix - Quantile( .5, theMatrix ) ) );
);回复:中值绝对偏差 --> 导出到表以进一步进行 tSNE下面是一个生成 MAD 的简单示例。我建议你把它变成一个函数,然后用一行创建一个新的数据表,你的 >800000 列。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
theMatrix = Column( dt, "height" ) << get as matrix;
MAD = Quantile( .5, Abs( theMatrix - Quantile( .5, theMatrix ) ) );