-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathsklearn
More file actions
executable file
·69 lines (60 loc) · 1.79 KB
/
sklearn
File metadata and controls
executable file
·69 lines (60 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
env_dir=./third_party/env/scikit-learn
src_dir=./third_party/source/scikit-learn
case "${OSTYPE}" in
msys*|cygwin*|mingw*) python="winpty python";;
*) python="python";;
esac
venv() {
env_dir=${env_dir}
[ -d "${env_dir}" ] || ${python} -m venv ${env_dir}
case "${OSTYPE}" in
msys*|cygwin*|mingw*) source ${env_dir}/Scripts/activate;;
*) source ${env_dir}/bin/activate;;
esac
${python} -m pip install --quiet --upgrade pip setuptools wheel
}
clean() {
echo "sklearn clean"
rm -rf "${env_dir}"
rm -rf "${src_dir}"
}
sync() {
echo "sklearn sync"
if [ ! -d "${src_dir}" ]; then
git clone --quiet --depth=1 --branch main --single-branch https://github.com/scikit-learn/scikit-learn.git "${src_dir}"
else
git -C "${src_dir}" fetch --quiet --depth=1 origin main
git -C "${src_dir}" reset --quiet --hard FETCH_HEAD
git -C "${src_dir}" gc --quiet --prune=all
fi
}
install() {
echo "sklearn install"
venv
${python} -m pip install --quiet scipy
${python} -m pip install --quiet scikit-learn --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple
deactivate
}
metadata() {
echo "sklearn metadata"
[[ $(grep -U $'\x0D' ./source/sklearn-metadata.json) ]] && crlf=1
venv
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
${python} ./tools/sklearn_script.py
deactivate
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/sklearn-metadata.json ./source/sklearn-metadata.json
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"install") install;;
"metadata") metadata;;
esac
done