How Can I Perform Loop By Checking Values of Matrix

1 回表示 (過去 30 日間)
crixus
crixus 2015 年 3 月 7 日
編集済み: crixus 2015 年 3 月 8 日
Hi all, I am wondering how should i go about to do a loop by checking values in a matrix, removing them until all the unwanted columns are removed ?
Example i have a matrix of 1 x 24 named as importance, 4 of them is smaller than 0.2, i would like to remove them and based on the remainder, run through my code again and once the one matrix of 1 x 20 is calculated, check if it's lesser than 0.2 and repeat the process.
my own code for now is
variableimpt = modelTB_ShaftPower.OOBPermutedVarDeltaError
numlabels = 1:24
variableimpt = vertcat(variableimpt,numlabels)
realvariableimpt = variableimpt(1,:) < 0.2; % for which rows is smaller than 0.2
variableimpt(:,realvariableimpt) = []
columnsneeded = variableimpt (2,:)
Xtrain = Xtrain(:,columnsneeded)
Xtest = Xtest(:,columnsneeded)
modelTB_ShaftPower = TreeBagger(100,Xtrain,Ytrain(:,1),'method','regression','oobvarimp','on')
[yfitTB_ShaftPower,~] = predict(modelTB_ShaftPower,Xtest)
  2 件のコメント
Geoff Hayes
Geoff Hayes 2015 年 3 月 7 日
Crixus - what is the remainder in your above code? What is the new set of data that you would want to check for values smaller than 0.2?
crixus
crixus 2015 年 3 月 8 日
編集済み: crixus 2015 年 3 月 8 日
my remainder here represent the first round after the few columns that have their variable importance of less than 0.2 remove. Anyway, i got this problem solved, thanks for your reply

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by