Sep-16-2020, 08:30 AM
I working on machine learning classification problem for logistic regression with 2 classes (walking and sitting).
I am trying to change it to Multi-Class Classification with six activities (classes) (walking, walkingupstairs, walkingdownstairs, sitting, standing, lying) instead of binary classification.
the ML model is defined in the following two classes
I am trying to change it to Multi-Class Classification with six activities (classes) (walking, walkingupstairs, walkingdownstairs, sitting, standing, lying) instead of binary classification.
the ML model is defined in the following two classes
def set_weights(intercept, coef, classes, model=linear_model.SGDClassifier()):
model.intercept_ = intercept
model.coef_ = coef
model.classes_ = classes
return modeldef train_model(intercept_init, coef_init, X, y, epochs, lr, batch_size=None, randomise=True):
if batch_size is None or batch_size <= 0:
batch_size = X.shape[0]
classes = np.unique(y)
model = linear_model.SGDClassifier(loss='log', learning_rate='constant', eta0=lr, verbose=0)
set_weights(intercept_init, coef_init, classes, model)
batch_train(model, X, y, classes, epochs, batch_size, randomise)
return modelPlease let me know how to make it work for multi-class ?
