parrotprediction / docker-course-xgboost Goto Github PK
View Code? Open in Web Editor NEWMaterials for an online-course - "Practical XGBoost in Python"
Home Page: http://education.parrotprediction.teachable.com/courses/practical-xgboost-in-python
Materials for an online-course - "Practical XGBoost in Python"
Home Page: http://education.parrotprediction.teachable.com/courses/practical-xgboost-in-python
Hello. I'm on Windows 7. There are my steps in Lesson "Getting rocket off the ground":
What should I do to fix problem?
subprocess.check_call(command)
processPng = subprocess.Popen(command,stdout=subprocess.PIPE,shell=True)
of course, you need install graphviz and add dot.exe to your system PATH before running above code
from IPython.display import Image
Image(filename=gbc_t1_png_file)
from PIL import Image
im = Image.open(your_path_to_png)
im.show()
from sklearn.metrics import accuracy_score, precision_score, recall_score
from xgboost.sklearn import XGBClassifier
from sklearn.utils import class_weight
......
#using skleran api for imbalanced data
class_weight = class_weight.compute_class_weight('balanced', np.unique(y_train), y_train)
weightbase = class_weight[0]
for index, w in np.ndenumerate(class_weight):
class_weight[index] = w/weightbase
params = {
'objective': 'binary:logistic',
'max_depth': 1,
'learning_rate': 1,
'n_estimators': 15
}
sample_weight=np.ones(y_train.shape);
for index, y in np.ndenumerate(y_train):
sample_weight[index] = class_weight[y]
bst = XGBClassifier(**params).fit(X_train, y_train, sample_weight=sample_weight)
y_pred = bst.predict(X_test)
predictions = [round(value) for value in y_pred]
print('sklearn-Accuracy: {0:.2f}'.format(accuracy_score(y_test, predictions)))
print('sklearn-Precision: {0:.2f}'.format(precision_score(y_test, predictions)))
print('sklearn-Recall: {0:.2f}'.format(recall_score(y_test, predictions)))
it seems to me sklearn not supporting those code using native/standard xgboost api.
I have encountered some small issues in trying to fire up the docker container from the GitHub repo. I am relatively new to docker, so I am suggesting that either some additional instruction could be added to the README or this issue can exist for other people like me who dont really know what they're doing.
On the most recent Docker for Windows (running on W10) I couldn't get docker-compose up
to work.
Alternatively I used docker build -t xgboost-course .
to get the docker image.
Docker build fails for me due to some proxy issues (it spits out 101 network unreachable
and failed to fetch ...
errors when trying to use apt-get
. To fix this - add a line to the Dockerfile to ensure docker has the right proxy settings:
USER root
ENV http_proxy http://hostname:port
ENV https_proxy http://hostname:port
# libav-tools for matplotlib anim
...
I believe the problems were because the proxy settings exposed to the docker containers did not have a leading http://
.
docker run -d -p 8888:8888 -v $PWD/notebooks:/home/joyvan/work xgboost-course
control the balance of positive and negative weights using set_pos_weight parameter,
should be
control the balance of positive and negative weights using scale_pos_weight parameter,
better to have dump_model first otherwise some people might confuse where those dump content come from
bst.dump_model('featmapDump.txt', with_stats=True);
While trying to run the '$ docker-compose up' command got this error:
In file './docker-compose.yml' service 'version' doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.
I followed the instructions but in the last step
docker-compose -v
It generates this error.
I am on windows 7 using Docker Toolbox. I search on google, I believe this problem is due to the 'docker-compose.yml', the volumes: - ./notebooks/:/notebooks.
I think this works on Mac or Linux but it just does not work on windows.
I‘ve already installed Jupyter and it creates a folder named "Jupyter". I could download the docker-course-xgboost folder and open all those jupyter notebooks, but when I try to check the version of the xgboost, then it says No module named xgboost. I believe this is due to the fact that the installation is not successful.
When I run the docker-compose -v for the first time, it does download a lot of stuff (and actually I couldn't find where does those stuff located)
Is there a way to solve it?
Im unable to import XG boost in the python notebook
import xgboost
OSError Traceback (most recent call last)
in ()
----> 1 import xgboost
~\Anaconda3\lib\site-packages\xgboost-0.6-py3.6.egg\xgboost_init_.py in ()
9 import os
10
---> 11 from .core import DMatrix, Booster
12 from .training import train, cv
13 from . import rabit # noqa
~\Anaconda3\lib\site-packages\xgboost-0.6-py3.6.egg\xgboost\core.py in ()
113
114 # load the XGBoost library globally
--> 115 _LIB = _load_lib()
116
117
~\Anaconda3\lib\site-packages\xgboost-0.6-py3.6.egg\xgboost\core.py in _load_lib()
107 if len(lib_path) == 0:
108 return None
--> 109 lib = ctypes.cdll.LoadLibrary(lib_path[0])
110 lib.XGBGetLastError.restype = ctypes.c_char_p
111 return lib
~\Anaconda3\lib\ctypes_init_.py in LoadLibrary(self, name)
424
425 def LoadLibrary(self, name):
--> 426 return self._dlltype(name)
427
428 cdll = LibraryLoader(CDLL)
~\Anaconda3\lib\ctypes_init_.py in init(self, name, mode, handle, use_errno, use_last_error)
346
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:
350 self._handle = handle
OSError: [WinError 126] The specified module could not be found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.