- win+dows

Latest

вторник, 12 декабря 2017 г.

Installing windows


5 Comments 0


Re: 2014 2nd Edition.


0 Comments 0


Creating User Define.


4 Comments 0


Client Connectivity .


0 Comments 0


Installing XGBoost For Anaconda on Windows


XGBoost is a recent implementation of Boosted Trees. It is a machine learning algorithm that yields great results on recent Kagg le c ompe titi on s. I decided to install it on my computers to give it a try. Installation on OSX was straightforward using these instructions (as a matter of fact, reality is a bit more complex, see the update at the bottom of this post). Installation on Windows was not as straightforward. I am sharing what worked for me in case it might help others. I describe how to install for the Anaconda Python distribution, but it might work as-is for other Python distributions.


In order to install and use XGBoost with Python you need three software on your windows machine:


I assume you have Anaconda up and running. I am using Anaconda for Python 3.5.


Git installation is quite easy. There are several options, one is to use Git for Windows. Just download and save the installer file on your disk, then launch it by double clicking it. You may need to authorize this operation. Then follow the installer instructions.


Once the installation has completed look for a program called Git Bash in your start menu. Launch it. It starts a terminal running the Bash shell. This is different from the regular Windows terminal, but it is more handy for what we need to do. First, go to the directory where you want to save XGBoost code by typing the cd command in the bash terminal. I used the following.


$ cd /c/U sers /IBM _ADM IN/c ode /


Then download XGBoost by typing the following commands.


Next step is to build XGBoost on your machine, i.e. compile the code we just downloaded. For this we need a full fledged 64 bits compiler provided with MinGW-W64. I downloaded the installer from this link. Save the file on your disk, then launch it by double clicking it. You may need to authorize this operation. Then click next on the first screen:



Then select the x86_64 item in the architecture menu. Do not modify the other settings.



Then click Next and follow the instructions. On my machine, it installed the compiler in the C:\Program File s\mi ngw- w64\ x86_ 64-5 .3.0 -pos ix-s eh-r t_v4 -rev 0 directory. The make command and the runtime libraries are in this directory (look for the directory that contains mingw32-make ):


C:\Program File s\mi ngw- w64\ x86_ 64-5 .3.0 -pos ix-s eh-r t_v4 -rev 0\mi ngw6 4\bi n


Use these instructions, depending on your Windows version, to add the above to the Path system variable.


Then close the Git Bash terminal, and launch it again. This will take into account the new Path variable. To check you are fine, type the following


It should return something like:


/c/Program File s/mi ngw- w64/ x86_ 64-5 .3.0 -pos ix-s eh-r t_v4 -rev 0/mi ngw6 4/bi n/mi ngw3 2-ma k e


To make our life easier, let us alias it as follows:


We can now build XGBoost. We first go back to the directory where we downloaded it:


$ cd /c/U sers /IBM _ADM IN/c ode/ xgbo os t


The command given in the instructions does not work as I write this blog entry. Until this is fixed, we need to compile each sub module explicitly with the following commands. Wait until each make command is completed before typing the next command.


$ make lib/ libr abit _emp ty.a -j4


$ cp make/mingw64.mk config.mk


Once the last command completes the build is done.


We can now install the Python module. What follows depends on the Python distribution you are using. For Anaconda, I will simply use the Anaconda prompt, and type the following in it (after the prompt, in my case [Anaconda3] C:\U sers \IBM _ADM IN > ):


[Anaconda3] C:\U sers \IBM _ADM IN>c d code \xgb oost \pyt hon- pack ag e


The point is to move to the python-package directory of XGBoost. Then type:


[Anaconda3] C:\U sers \IBM _ADM IN\c ode\ xgbo ost\ pyth on-p acka ge>p ytho n setup.py install


We are almost done. Let's launch a notebook to test XGBoost. Importing it directly causes an error. In order to avoid it we must add the path to the g++ runtime libraries to the os environment path variable with:


We can then import xgboost and run a small example.


Update on April, 15, 2016. The OSX installation is a bit more complex that I wrote here if we want to be able to use XGBoost in a multi-threaded mode. I provide instructions for it in Inst alli ng X GBoo st o n Ma c OS X

Комментариев нет:

Отправить комментарий