openml-labs/gama

cannot import name 'Gama Classifier'

DexiongYung opened this issue · 2 comments

I tried running

from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import log_loss, accuracy_score
from gama import GamaClassifier

if __name__ == "__main__":
    X, y = load_breast_cancer(return_X_y=True)
    X_train, X_test, y_train, y_test = train_test_split(
        X, y, stratify=y, random_state=0
    )

    automl = GamaClassifier(max_total_time=180, store="nothing", n_jobs=1)
    print("Starting `fit` which will take roughly 3 minutes.")
    automl.fit(X_train, y_train)

    label_predictions = automl.predict(X_test)
    probability_predictions = automl.predict_proba(X_test)

    print("accuracy:", accuracy_score(y_test, label_predictions))
    print("log loss:", log_loss(y_test, probability_predictions))

from https://pgijsbers.github.io/gama/master/user_guide/index.html#examples and I get "ImportError: cannot import name 'GamaClassifier'." I've tried this on both a Linux and Windows and get the same error. Here is my pip freeze output for both OSs

appdirs==1.4.4
attrs==20.3.0
black==19.10b0
category-encoders==2.2.2
click==7.1.2
Cython==0.29.21
gama==20.2.2
joblib==1.0.0
liac-arff==2.5.0
numpy==1.19.4
pandas==1.0.5
pathspec==0.8.1
patsy==0.5.1
pkg-resources==0.0.0
psutil==5.8.0
python-dateutil==2.8.1
pytz==2020.5
regex==2020.11.13
scikit-learn==0.24.0
scipy==1.5.4
six==1.15.0
statsmodels==0.12.1
stopit==1.1.2
threadpoolctl==2.1.0
toml==0.10.2
typed-ast==1.4.1

Hi! Sorry for the slow reply.
This puzzles me, because it does look like the gama module is found.
I tried a fresh install and it installed the same packages and the import worked (for me), so I don't have much to go by.

Can you post the full error? What's your Python version?

Closing this issue because it's stale and I could not reproduce it. If you find it happens again, feel free to open the issue again and provide more information that might make it possible for me to reproduce the error.