Why do I receive 'You must pass class labels as a vector.' error?

조회 수: 2 (최근 30일)
Daniil Podtesov
Daniil Podtesov 2022년 10월 15일
댓글: Hiro Yoshino 2022년 10월 15일
clear; clc;
X_train = readmatrix("x_train.csv",'NumHeaderLines',1);
X_test = readmatrix("x_test.csv",'NumHeaderLines',1);
y_train = readmatrix("y_train.csv",'NumHeaderLines',1);
y_test = readmatrix("y_test.csv",'NumHeaderLines',1);
model = fitcsvm(X_train, y_train, 'KernelFunction','rbf');
Here's my code. After trying to run I receive this error (error is in attached screenshot):

답변 (1개)

Hiro Yoshino
Hiro Yoshino 2022년 10월 15일
It said the y_train is not a vector.
The argument should be any on of: categorical array, string array, character array, logical array, numerical array, cell array.
You should make sure you give right data for x and y respectively.
  댓글 수: 4
Daniil Podtesov
Daniil Podtesov 2022년 10월 15일
I see, in Python Y was two cols (id, boolean), that's why I remained this column. Thank You, I'll try the solution

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by