How to construct a binary logistic classifier?

3 次查看(过去 30 天)
I have a matrix X containing features and a vector y containing the labels. How can I perform logistic regression and compute the accuracy of the regression as well as Type 1 and Type 2 errors? Furthermore, I want to have 5% of each category which are classified with the highest score.
X_train = [1 2 3; 4 5 6; 3 5 7];
y_train = [0 0 1];
X_test = [6 8 2; 6 3 4; 5 7 1];
y_test = [1 0 1];
[b,dev,stats] = glmfit(X_train, y_train,'binomial','logit');
But this does not work because of the dimension of y_train. And the evaluation of the classifier is missing as well. Can anybody help me please?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by