Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting zero score accuracy on test data #136

Open
jboverio opened this issue Nov 12, 2020 · 0 comments
Open

getting zero score accuracy on test data #136

jboverio opened this issue Nov 12, 2020 · 0 comments

Comments

@jboverio
Copy link

Hi.

I am playing with ml ensemble in Kaggle but I keep getting 0 score accuracy on submission. I can't figure out what is wrong!

from mlens.ensemble import BlendEnsemble
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC
seed=3
def build_ensemble(proba, **kwargs):
"""Return an ensemble."""
estimators = [
SVC(probability=proba),
CatBoostClassifier(iterations=300,
logging_level='Silent', learning_rate= 0.03, depth=5)]

ensemble = BlendEnsemble(**kwargs)
ensemble.add(estimators, proba=proba)   # Specify 'proba' here
ensemble.add_meta(LogisticRegression())

return ensemble

ensemble_false = build_ensemble(proba=False)
ensemble_false.fit(X_, Y)
#preds_false = ensemble_false.predict(X_)
#print("Accuracy:\n%r" % accuracy_score(preds_false, Y))

ensemble = build_ensemble(proba=True)
ensemble.fit(X_, Y)
#preds = ensemble.predict(X_)
#print("\nAccuracy:\n%r" % accuracy_score(preds, Y))

Xtest = pd.read_csv('../input/labdata-churn-challenge-2020/test.csv')

X_test_ = feat_engineering_types(Xtest)
X_test_2 = trata_na(X_test_)
X_test_3 = coloca_dummy(X_test_2)
predicted_prices_false = ensemble_false.predict(X_test_3)

my_submission_false = pd.DataFrame({'id': Xtest.id, 'Churn': predicted_prices_false})

my_submission_false.to_csv('submission.csv', index=False)
predicted_prices = ensemble.predict(X_test_3)

my_submission2 = pd.DataFrame({'id': Xtest.id, 'Churn': predicted_prices})

my_submission2.to_csv('submission2.csv', index=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant