Out project for this week was to work on an old kaggle competition (https://www.kaggle.com/c/predict-west-nile-virus). XGBoost has been used by many of the winners in past kaggle competitions, so we had high hopes that it would improve our results. While it didn’t improve our results I certainly learned a lot in the process.

The best article I’ve found for downloading XGBoost for Mac was through the IBM website (ironic, no?). Even this article had a lot of places for troubleshooting, so I wanted to walk through where I encountered errors, but this is definitely a good place to start. If the IBM article works for you, no need to read on, but if it doesn’t I hope I can answer some of your questions.

In your terminal, install homebrew if you haven’t already. “ /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ” If you encounter errors in this step, you should refer to this website “https://computers.tutsplus.com/tutorials/homebrew-demystified-os-xs-ultimate-package-manager--mac-44884”. Also in the terminal, you should “brew install gcc — without-multilib”, the without multilib should help with multi-threading errors that we may encounter later. This may take some time, but if this doesn’t work try “sudo apt-get install gcc

sudo apt-get install g++” cd into wherever you want your directory to be, I simply put mine at my root directory, but make sure that this is not within another directory! (we don’t need any pregnant repos) Clone the repository wherever you want your directory to be using this line “git clone — recursive https://github.com/dmlc/xgboost” cd into your new directory called xgboost “cd xgboost” Open the make/config.mk. If you have your computer formatted correctly, simply typing “open make/config.mk” may work. If not you can use the GUI to open it in your favorite text editor, or another command. Uncomment these two lines of code : “export CC = gcc

export CXX = g++”. Depending on which version of gcc you installed, you may need to change them to “export CC = gcc-6

export CXX = g++-6”. Make sure you save this and then move on to the next step. cd into xgboost (if you’re not already there), and then “cp make/config.mk .

make -j4 Final step : “cd python-package; sudo python setup.py install”

To check and see if this has succeded, you can either open a jupyter notebook or type “pip freeze” in your terminal and ensure that xgboost is there with a version. If you would like to use this in a jupyter notebook, you should open a new terminal window, and start a new kernel. You can check and see if this process has succeeded by “import xgboost”, as long as this doesn’t throw an error you should be able to use it.

If these steps are not working, try “brew install gcc5” and then change step 6 to “export CC = gcc-5

export CXX = g++-5”

If the final step isn’t working, substitute it with these three: “sudo ./build.sh

cd python-package

sudo /home/username/anaconda/bin/python setup.py install”

The frustrating answer is that if this doesn’t work, uninstall and try again altering the steps slightly and try to follow the IBM article precisely.