sklearn 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. set -e
  3. root=$(cd $(dirname ${0})/..; pwd)
  4. third_party=${root}/third_party
  5. tools=${root}/tools
  6. identifier=scikit-learn
  7. virtualenv=${third_party}/virtualenv/${identifier}
  8. bold() {
  9. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  10. }
  11. git_sync() {
  12. mkdir -p "${third_party}"
  13. if [ -d "${third_party}/${1}" ]; then
  14. git -C "${third_party}/${1}" pull --quiet --prune
  15. else
  16. git -C "${third_party}" clone --quiet --recursive ${2} ${1}
  17. fi
  18. git -C "${third_party}/${1}" submodule sync --quiet
  19. git -C "${third_party}/${1}" submodule update --quiet --init --recursive
  20. }
  21. sync() {
  22. bold "sklearn sync"
  23. git_sync numpy https://github.com/numpy/numpy.git
  24. git_sync scikit-learn https://github.com/scikit-learn/scikit-learn.git
  25. git_sync lightgbm https://github.com/Microsoft/LightGBM.git
  26. git_sync xgboost https://github.com/dmlc/xgboost.git
  27. }
  28. install() {
  29. bold "sklearn install"
  30. # case "$(uname)" in
  31. # "Darwin")
  32. # brew list libomp > /dev/null 2>&1 || brew install libomp > /dev/null
  33. # export CC=/usr/bin/clang
  34. # export CXX=/usr/bin/clang++
  35. # export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
  36. # export CFLAGS="$CFLAGS -I/usr/local/opt/libomp/include"
  37. # export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include"
  38. # export LDFLAGS="$LDFLAGS -L/usr/local/opt/libomp/lib -lomp"
  39. # export DYLD_LIBRARY_PATH=/usr/local/opt/libomp/lib
  40. # ;;
  41. # esac
  42. [ -n "$(python3 -m pip list --format columns --disable-pip-version-check | grep -w virtualenv)" ] || python3 -m pip install --force-reinstall --user --quiet virtualenv
  43. [ -d "${virtualenv}" ] || virtualenv --quiet -p python3 ${virtualenv}
  44. source ${virtualenv}/bin/activate
  45. python3 -m pip install --quiet six cython pytest flake8 numpy scipy
  46. python3 -m pip install --quiet --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
  47. # python3 -m pip install --quiet ${third_party}/scikit-learn
  48. deactivate
  49. }
  50. metadata() {
  51. bold "sklearn metadata"
  52. source ${virtualenv}/bin/activate
  53. pushd ${tools} > /dev/null
  54. python3 sklearn-script.py
  55. popd > /dev/null
  56. deactivate
  57. }
  58. while [ "$#" != 0 ]; do
  59. command="$1" && shift
  60. case "${command}" in
  61. "sync") sync;;
  62. "install") install;;
  63. "metadata") metadata;;
  64. esac
  65. done