Classificaiton Learner App: shortens variable names?

3 ビュー (過去 30 日間)
Sam Donche
Sam Donche 2020 年 9 月 9 日
回答済み: Vinai Datta Thatiparthi 2020 年 9 月 15 日
I'm using the Classification Learner App from MATLAB to examine features from medical images. The features are loaded into MATLAB from an excel file.
As you can see below these features can have pretty long names.
The Classification Learner App shortens these variable names to some variable name length limit without spaces. The variable name shown above gets shortened to:
'T1cetotalabnormalGLCMInformationalmeasureofcorrelation1d1mean'
After training a model with the App (e.g. trainedModel), this can be verified when using: trainedModel.RequiredVariables.
I want to validate the trainedModel with an external validation dataset. To this end I'm making a MATLAB table with rows and columns respectively equal to patient and feature (analog to the training data). The variable names need to be equal to the variable names of the trainedModel. However I don't know what method the Classification Learner App used to shorten the variables. Can somebody point this method out?
I know an easy way to get around this would be to rename the variables. However there are thousands of variables, so I would like to avoid this.
Thanks in advance
Sam

回答 (1 件)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi 2020 年 9 月 15 日
Hey Sam,
The variable name that can be seen in the snapshot you provided does not seem to be a valid variable name in MATLAB. The Classification Learner App probably makes use of functions like matlab.lang.makeValidName to modify any given name into a valid one - something that MATLAB can make sense out of.
As a workaround, you could extract the variable names from the table properties directly. This would preserve the names' consistency. Use:
myVarNames = tableFromExcel.Properties.VariableNames;
Hope this helps!

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by