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)
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.