hi,
when instantiating dummy classifier like so:
class_to_predict = ">50K"
and
dum_clf_over = DummyClassifier(
strategy = "constant",
constant = class_to_predict
)
the following error gets raised:
ValueError: The constant target value must be present in the training data. You provided constant=>50K. Possible values are: [’ <=50K’, ’ >50K’].
after calling
dum_clf_over.fit(X_train, y_train)
Any hints on what I’m getting wrong here?
Also, I wonder about the arguments you’ve passed in the solution when calculating accuracy:
score = high_revenue_clf.score(data_numeric_test, target_test)
I understand “.score” takes predictions (“y_pred”) and compares them to real values of labels (“y_test”) and am surprised to see that you’ve passed “X_test” and “y_test”.
Could u please clarify why you pass “data_numeric_test”, instead of some kind of “y_pred”.
In my understanding, the following code should work as well:
pred_clf = dum_clf_over.predict(X_test)
accuracy_score(y_true = target, y_pred = pred_clf)
But it seems “.score” saves “.predict()” under the hood?
Many thanks in advance!