Question 21
Consider the following block of code for the binary classification dataset.
Shape of feature matrix is (10000,4) and labels (10000,) respectively.
keep following symbols in mind:
- >>>: Represents input code
- # : Represents comment in a code
- ... : Represents code continuation
- Without any symbols at the beginning of a line then it is output of just above input line of code.
>>> from sklearn.linear_model import LogisticRegression,SGDClassifier>>> from sklearn.naive_bayes import GaussianNB>>> from sklearn.ensemble import VotingClassifier
>>> clf1 = LogisticRegression(multi_class='multinomial', random_state=1)>>> clf2 = SGDClassifier(random_state=1)>>> clf3 = GaussianNB()
>>> eclf = VotingClassifier(estimators=[('lr', clf1),... ('sgd', clf2),... ('gnb', clf3)],... voting='soft')
>>> eclf.fit(X,y)
>>> eclf.named_estimators_['lr'].predict_proba(X[0:1])[0.4,0.6]>>> eclf.named_estimators_['sgd'].predict_proba(X[0:1])[0.25,0.75]>>> eclf.named_estimators_['gnb'].predict_proba(X[0:1])[0.9,0.1]what will be the predicted class for X[0:1] sample using the code given above
0
1
2
3