-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update sklearn auto-backend using register.dat to override sklearn classes with our own.
- Loading branch information
1 parent
3c128f2
commit 5b489a2
Showing
56 changed files
with
243 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,3 +81,6 @@ widgetsnbextension==2.0.0 | |
XlsxWriter==0.9.8 | ||
cmake==0.8.0 | ||
feather-format==0.4.0 | ||
Cython==0.25.2 | ||
|
||
|
Submodule scikit-learn
added at
d8c363
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# apply sklearn | ||
rm -rf sklearn | ||
cd scikit-learn | ||
pip install dist/h2o4gpu-0.20.dev0-cp36-cp36m-linux_x86_64.whl --upgrade --target ../sklearn/ | ||
cd ../ | ||
|
||
# link-up recursively | ||
bash ./scripts/importsklearn.sh | ||
|
||
# handle base __init__.py file appending | ||
rm -rf src/interface_py/h2o4gpu/__init__.py | ||
cat sklearn/h2o4gpu/__init__.py | sed 's/__version__.*//g' >> src/interface_py/h2o4gpu/__init__.py.2 | ||
|
||
cat src/interface_py/h2o4gpu/__init__.base.py src/interface_py/h2o4gpu/__init__.py.2 > src/interface_py/h2o4gpu/__init__.py | ||
rm -rf src/interface_py/h2o4gpu/__init__.py.2 | ||
|
||
# register | ||
bash ./scripts/post_apply_sklearn.sh |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
cd src/interface_py/h2o4gpu | ||
|
||
# PATHS | ||
sklearnpaths=`find ../../../sklearn/h2o4gpu -type d | tail -n +2 | grep -v pycache | awk '{ print length($0) " " $0; }' | sort -n | cut -d ' ' -f 2-` | ||
|
||
for fil in $sklearnpaths | ||
do | ||
|
||
file=`basename $fil` | ||
path=`dirname $fil | sed 's/\.\.\/\.\.\/\.\.\/sklearn\/h2o4gpu//g' | sed 's/^\///g' | sed 's/^/\.\//g'` | ||
newfile=${path}/$file | ||
echo $fil `dirname $fil` $file $path $newfile | ||
|
||
echo "mkdir: " $newfile | ||
mkdir -p $newfile | ||
#rm -rf $newfile | ||
|
||
done | ||
|
||
if [ 1 -eq 1 ] | ||
then | ||
# FILES | ||
sklearnfiles=`find ../../../sklearn/h2o4gpu -type f | grep -v pycache` | ||
|
||
for fil in $sklearnfiles | ||
do | ||
|
||
file=`basename $fil` | ||
path=`dirname $fil | sed 's/\.\.\/\.\.\/\.\.\/sklearn\/h2o4gpu//g' | sed 's/^\///g' | sed 's/^/\.\//g'` | ||
newfile=${path}/$file | ||
|
||
echo $fil "->" $newfile | ||
|
||
#rm -rf $path | ||
#git rm -rf $newfile | ||
ln -sfr $fil $newfile | ||
|
||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
cd src/interface_py/h2o4gpu/ | ||
# now register any override of existing classes | ||
# e.g. from grep -R 'from \.' * |grep KMeans | ||
infile="register.clean.dat" | ||
grep -v "#" register.dat > $infile | ||
|
||
#IFS=' ' | ||
while read skfile initfile classorig classnew command | ||
do | ||
|
||
#classorig=`sed -e 's/\"//g' <<< $classorig` | ||
|
||
#temp=${classnew%\"} | ||
#temp=${temp#\"} | ||
#classnew=`echo $temp` | ||
|
||
echo $skfile | ||
echo $initfile | ||
echo $classorig | ||
echo $classnew | ||
echo $command | ||
|
||
if [ 1 -eq 1 ] | ||
then | ||
# rename class | ||
echo "1" | ||
sed -i "s/class $classorig(/class $classnew(/g" $skfile | ||
echo "2" | ||
sed -i "s/($classorig)/($classnew)/g" $skfile | ||
echo "3" | ||
sed -i "s/sklearn_sklearn/sklearn/g" $skfile | ||
echo "4" | ||
sed -i "s/\ $classorig\([^[a-z]\)/ $classnew\1/g" $skfile | ||
echo "5" | ||
sed -i "s/sklearn_sklearn/sklearn/g" $skfile | ||
|
||
# rename class in init file | ||
#sed -i "s/\([^[a-z]\)$classorig\([^[a-z]\)/\1$classnew\2/g" $initfile | ||
echo "6" | ||
sed -i "s/\ $classorig\([^[a-z]\)/ $classnew\1/g" $initfile | ||
echo "7" | ||
sed -i "s/sklearn_sklearn/sklearn/g" $initfile | ||
|
||
# append our class | ||
echo "" >> $skfile | ||
command=`sed -e 's/^"//' -e 's/"$//' <<< "$command"` | ||
echo "$command" >> $initfile | ||
fi | ||
|
||
done < $infile | ||
|
||
rm -rf $infile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
cd scikit-learn | ||
rm -rf build dist | ||
|
||
########## DIRECTORIES | ||
paths=`find -type d | grep -v pycache | awk '{ print length($0) " " $0; }' | sort -n | cut -d ' ' -f 2-` | ||
|
||
for fil in $paths | ||
do | ||
echo $fil | ||
if [[ "$fil" == *".git"* ]] | ||
then | ||
echo "avoid .git" | ||
else | ||
newpath=`echo $fil | sed 's/sklearn/h2o4gpu/g' | sed 's/scikit-learn/h2o4gpu/g'` | ||
echo $fil "->" $newpath | ||
mv $fil $newpath | ||
fi | ||
done | ||
|
||
########## FILES | ||
#files=`find -type f | grep -v pycache` | ||
files=`find -type f | grep -v pycache | awk '{ print length($0) " " $0; }' | sort -n | cut -d ' ' -f 2-` | ||
|
||
for fil in $files | ||
do | ||
echo $fil | ||
if [[ "$fil" == *".git"* ]] | ||
then | ||
echo "avoid .git" | ||
else | ||
sed -i 's/sklearn/h2o4gpu/g' $fil | ||
sed -i 's/scikit-learn/h2o4gpu/g' $fil | ||
fi | ||
done | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
__version__ = "0.0.4" | ||
|
||
|
||
from h2o4gpu.types import FunctionVector | ||
from h2o4gpu.solvers.pogs import Pogs | ||
from h2o4gpu.solvers.elastic_net import GLM | ||
from h2o4gpu.solvers.logistic import LogisticRegression | ||
from h2o4gpu.solvers.lasso import Lasso | ||
from h2o4gpu.solvers.ridge import Ridge | ||
from h2o4gpu.solvers.kmeans import KMeans | ||
from h2o4gpu.util import typechecks | ||
from h2o4gpu.util import compatibility | ||
from h2o4gpu import h2o4gpu_exceptions | ||
from h2o4gpu.util import metrics | ||
from h2o4gpu.util import import_data |
Oops, something went wrong.