erdogant / hgboost

hgboost is a python package for hyper-parameter optimization for xgboost, catboost or lightboost using cross-validation, and evaluating the results on an independent validation set. hgboost can be applied for classification and regression tasks.
http://erdogant.github.io/hgboost
Other
57 stars 17 forks source link

import error during import hgboost #4

Closed recherHE closed 3 years ago

recherHE commented 3 years ago

When I finished installation of hgboost and try to import hgboost,there is something wrong,could you please help me out? Details are as follows:

ImportError Traceback (most recent call last)

in ----> 1 from hgboost import hgboost C:\ProgramData\Anaconda3\lib\site-packages\hgboost\__init__.py in ----> 1 from hgboost.hgboost import hgboost 2 3 from hgboost.hgboost import ( 4 import_example, 5 ) C:\ProgramData\Anaconda3\lib\site-packages\hgboost\hgboost.py in 9 import classeval as cle 10 from df2onehot import df2onehot ---> 11 import treeplot as tree 12 import colourmap 13 C:\ProgramData\Anaconda3\lib\site-packages\treeplot\__init__.py in ----> 1 from treeplot.treeplot import ( 2 plot, 3 randomforest, 4 xgboost, 5 lgbm, C:\ProgramData\Anaconda3\lib\site-packages\treeplot\treeplot.py in 14 import numpy as np 15 from sklearn.tree import export_graphviz ---> 16 from sklearn.tree.export import export_text 17 from subprocess import call 18 import matplotlib.image as mpimg ImportError: cannot import name 'export_text' from 'sklearn.tree.export' thanks a lot!
erdogant commented 3 years ago

Can you try the Colab notebook to see whether it works? https://colab.research.google.com/github/erdogant/hgboost/blob/master/notebooks/hgboost_classification_examples.ipynb

recherHE commented 3 years ago

it works,made me confused?maybe it's requirement package version issues? When the following changes are made in the "treeplot\treeplot.py" file,,the problem was solved:

from sklearn.tree.export import export_text --> from sklearn.tree import export_text.

erdogant commented 3 years ago

Thank you for this suggestion! I fixed it in the treeplot library and it should work now.