我有一個時間資料集(1000000x70),其中包含有關 20 個受試者活動的資訊。我需要對資料集應用二次采樣,因為它有超過一百萬行。如何從中理想地選擇一組對每個主題的觀察?稍后,我需要在其上應用 PCA 和 K-means。請幫助我完成要遵循的步驟。我在 MATLAB 作業。
uj5u.com熱心網友回復:
我不是很清楚你在找什么。如果您只想在 matlab 上對矩陣進行二次采樣,可以使用以下方法:
myData; % 70 x 1000000 data
nbDataPts = size(myData, 2); % Get the number of points in the data
subsampleRatio = 0.1; % Ratio of data you want to keep
nbSamples = round(subsampleRatio * nbDataPts); % How many points to keep
sampleIdx = round(linspace(1, nbDataPts, nbSamples)); % Evenly space indices of the points to keep
sampledData = myData(:, sampleIdx); % Sampling data
那么如果你想申請PCA和K意味著我建議你看看相關檔案:
- 主成分分析
- K 表示
嘗試使用它,如果出現特定問題,請打開一個新問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/489876.html
