필터 지우기
필터 지우기

I am using machine learning classfier to predict my test accuracy. The classfier uses hold out to take data in random. How to I get the train accuracy using the code?

조회 수: 3 (최근 30일)
%% -------------- Building Classifier ----------------------------
classification_model=fitcnb(data,'class_labels~PC1+PC2');
%% -------------- Test and Train sets ----------------------------
cv=cvpartition(classification_model.NumObservations,'HoldOut', 0.3);
cross_validated_model=crossval(classification_model,'cvpartition',cv);
%% -------------- Making Predictions for Test sets ---------------
predictions=predict(cross_validated_model.Trained{1},data(test(cv),1:end-1));
%% -------------- Analyzing the predictions ---------------------
results=confusionmat(cross_validated_model.Y(test(cv)),predictions)

답변 (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