Python Forum
Applying Multi-Class Classification instead of binary classification
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Applying Multi-Class Classification instead of binary classification
#1
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

def set_weights(intercept, coef, classes, model=linear_model.SGDClassifier()):
    model.intercept_ = intercept
    model.coef_ = coef
    model.classes_ = classes
    return model
def 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 model
Please let me know how to make it work for multi-class ?
Reply
#2
Any suggestion ???
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to plot confusion matrix of multiclass classification Vaishali 0 1,361 Feb-10-2022, 02:34 PM
Last Post: Vaishali
  gspread - applying ValueRenderOption to a range of cells dwassner 0 1,703 Jan-12-2022, 03:05 PM
Last Post: dwassner
  [split] Kera Getting errors when following code example Image classification from scratch hobbyist 3 4,647 Apr-13-2021, 01:26 PM
Last Post: amirian
  Applying function mapypy 1 2,275 Mar-11-2021, 09:49 PM
Last Post: nilamo
  Multi-class iterator Pedroski55 2 2,392 Jan-02-2021, 12:29 AM
Last Post: Pedroski55
  Applying Moving Averages formula to a number lynnette1983 1 2,044 Sep-29-2020, 10:21 AM
Last Post: scidam
  Hi, I need help with defining user's input and applying it to code. jlmorenoc 2 2,295 Jun-24-2020, 02:10 PM
Last Post: pyzyx3qwerty
  Help with applying this instrument monitoring code to multiple inputs. Kid_Meier 1 2,102 Mar-04-2020, 12:01 PM
Last Post: Kid_Meier
  hex file to binary or pcap to binary baran01 1 5,706 Dec-11-2019, 10:19 PM
Last Post: Larz60+
  applying and(&) ,or(|) in conditions does not result output correctly as expected Smiling29 4 2,669 Oct-21-2019, 01:39 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020