How to evaluate a logistic regression classifier?
2 views (last 30 days)
Show older comments
Hi Smart Guys,
I wrote following codes to construct a logistic regression classifier. Essentially, it uses the Matlab GeneralizedLinearModel class.
load fisheriris;
features = meas(1:100,1:3);
featureSelcted = features(1:100,1:3);
numFeatures = 100;
%%Define ground truth
groundTruthGroup = species(1:100);
groundTruthLogicalLable = (1:numFeatures)'<50;
LOGClassifierObject = GeneralizedLinearModel.fit(featureSelcted, groundTruthLogicalLable, ...
'linear', 'Distribution', 'binomial', 'link', 'logit');
[LOGLabel, LOGScore] = predict(LOGClassifierObject, featureSelcted);
[FPR, TPR, Thr, AUC, OPTROCPT] = perfcurve(groundTruthGroup(:,1), LOGScore(:,1), 'setosa');
However, I'm stuck with the problem of evaluate this logistic regression based classifier. For example,
1. As it is not LOGClassifierObject is not an object of 'ClassificationDiscriminant', it has no function to get resubstitution error directly. 'classperf' function seems not applicable as well.
2. Also for a normal cross-validation, I haven't figured out how to do it. I am not sure how to connect 'crossval' function with the results of the object of GeneralizedLinearModel class, ie, LOGClassifierObject.
3. Or could anyone recommend a third party library coded in Matlab can perform the right task.
Any ideas please direct me. Thanks very much.
A.
0 Comments
Answers (0)
See Also
Categories
Find more on Classification Trees in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!