Classificaiton Learner App: shortens variable names?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Learner App 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!