You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i am getting confuse, when i try to make multiclass classification using exercise two. How to make multiclass classification using binary classifier. Can i just add class, and feature_matrix in this code ?
def train_classifier(feature_matrix_0, feature_matrix_1, algorithm='SVM'):
"""Train a binary classifier.
Train a binary classifier. First perform Z-score normalization, then
fit
Args:
feature_matrix_0 (numpy.ndarray): array of shape (n_samples,
n_features) with examples for Class 0
feature_matrix_0 (numpy.ndarray): array of shape (n_samples,
n_features) with examples for Class 1
alg (str): Type of classifer to use. Currently only SVM is
supported.
Returns:
(sklearn object): trained classifier (scikit object)
(numpy.ndarray): normalization mean
(numpy.ndarray): normalization standard deviation
"""
# Create vector Y (class labels)
class0 = np.zeros((feature_matrix_0.shape[0], 1))
class1 = np.ones((feature_matrix_1.shape[0], 1))
# Concatenate feature matrices and their respective labels
y = np.concatenate((class0, class1), axis=0)
features_all = np.concatenate((feature_matrix_0, feature_matrix_1),
axis=0)
The text was updated successfully, but these errors were encountered:
Hi, i am getting confuse, when i try to make multiclass classification using exercise two. How to make multiclass classification using binary classifier. Can i just add class, and feature_matrix in this code ?
def train_classifier(feature_matrix_0, feature_matrix_1, algorithm='SVM'):
"""Train a binary classifier.
The text was updated successfully, but these errors were encountered: