필터 지우기
필터 지우기

Print parameters of classification model

조회 수: 1 (최근 30일)
Louis
Louis 2020년 3월 27일
편집: Louis 2020년 3월 27일
I have trained classification models for which I am writing a result-display function to print information about the trained models
Specifically, I would like to use the for loop to print every parameter name and value pairs
I would like to avoid hardcoding parameter name to do this as I will be displaying results of many different types of classifiers
Below is the simple test script to train a decision tree:
% load dataset
load ionosphere
% train model - decision tree
model = fitctree(X, Y, 'SplitCriterion', 'gdi', 'MaxNumSplits', 100, ...
'KFold', 5);
I know that model.PadelParameters.LearnerTemplates{1} contains the FitTemplate property with parameter names and corresponding values. Below outputs show the parameters for the model trained above:
>> model.ModelParameters.LearnerTemplates{1,1}
ans =
Fit template for classification Tree.
SplitCriterion: 'gdi'
MinParent: []
MinLeaf: []
MaxSplits: 100
NVarToSample: []
MergeLeaves: []
Prune: []
PruneCriterion: []
QEToler: []
NSurrogate: []
MaxCat: []
AlgCat: []
PredictorSelection: []
UseChisqTest: []
Stream: []
Reproducible: []
Version: 2
Method: 'Tree'
Type: 'classification'
I would like to create a loop using fprintf to print parameter names and corresponding values for the ones with values without hardcoding the fieldnames. I have tried fieldnames method to see if I could extract field names but it returns empty cell...
Desired output looks like the following for the above test example:
|=======================================================================|
| Learner | Hyperparameter: Value |
|=======================================================================|
| classification Tree | SplitCriterion: 'gdi' |
| | MaxSplits: 100 |
| | Version: 2 |
Is there a method I can use to accomplish this task?
Any help will be greated appreciated!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Classification Learner App에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by