Giter VIP home page Giter VIP logo

docker-course-xgboost's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-course-xgboost's Issues

First lesson. Cant do "docker-compose up"

Hello. I'm on Windows 7. There are my steps in Lesson "Getting rocket off the ground":

  1. I did "git clone https://github.com/ParrotPrediction/docker-course-xgboost" in git bash terminal
  2. Setup docker
  3. $ cd docker-course-xgboost
  4. $ docker -v
    Docker version 1.13.1, build 092cba3
  5. $ docker-compose -v
    docker-compose version 1.11.1, build 7afaa436
  6. $ docker-compose up
    Traceback (most recent call last):
    File "docker-compose", line 3, in
    ............................
    File "site-packages\docker\transport\npipeconn.py", line 31, in connect
    File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
    File "site-packages\docker\transport\npipesocket.py", line 50, in connect
    pywintypes.error: (2, 'WaitNamedPipe', '\xcd\xe5 \xf3\xe4\xe0\xe5\xf2\xf1\xff \xed\xe0\xe9\xf2\xe8 \xf3\xea\xe0\xe7\xe0\xed\xed\xfb\xe9 \xf4\xe0\xe9\xeb.')
    Failed to execute script docker-compose

What should I do to fix problem?

windows subprocess image

  • Instead of
    subprocess.check_call(command)
    Use following line instead
    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

  • And for display image from command line program, instead of
    from IPython.display import Image
    Image(filename=gbc_t1_png_file)
    you need to install pillow (a fork of Python Image Library-PIL) and use following lines instead:
    from PIL import Image
    im = Image.open(your_path_to_png)
    im.show()

using sklearn api for imbalanced data

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)))


Docker behind Firewall / Build container on Docker for Windows

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.

  1. 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.

  2. 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://.

  1. When docker builds successfully you cant then start the container in daemon mode through
    docker run -d -p 8888:8888 -v $PWD/notebooks:/home/joyvan/work xgboost-course

a typo in imbalanced data ipython notebook

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,

dump_model before get_dump

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);

docker-compose up

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.

Cannot create container for service jupyter: invalid bind mount spec

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?

Unable to import XG boost

Im unable to import XG boost in the python notebook
import xgboost

Error in Notebook:

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
capture

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.