From e57aded7c217486ad6e49e4e7781897736c796db Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 11:35:57 -0400 Subject: [PATCH 01/18] Add documentation for 'make setup'. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index af181a5..e7c1a81 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Benchmarks are run with the `make` command. * `make memory` -- Get memory profiling information. * `make reports` -- Create the reports. * `make test` -- Test the configuration file. Check for correct syntax and then try to open files referred in the configuration file. +* `make setup` -- Download and set up all of the libraries to compare against. * `make scripts` -- Make additional scripts. From 6a1e7cce801801fc0926eb58a66456321e716b50 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:32:40 -0400 Subject: [PATCH 02/18] Use local installations of packages. Also remove some unnecessary previous variables. --- Makefile | 71 ++++++++++++++++++-------------------------------------- 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 3a5ca13..ff7776f 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,13 @@ +# These are the directories that contain everything we need after 'make setup' +# is completed. We assume that 'matlab' is available on the PATH. +export INCLUDEPATH := $(shell pwd)/libraries/include/ +export LIBPATH := $(shell pwd)/libraries/lib/ +export BINPATH := $(shell pwd)/libraries/bin/ +export JAVAPATH := $(shell pwd)/libraries/share/ +export DEBUGBINPATH := $(shell pwd)/libraries/debug/bin/ +export DEBUGINCLUDEPATH := $(shell pwd)/libraries/debug/include/ +export DEBUGLIBPATH := $(shell pwd)/libraries/debug/lib/ + # Locate the python bin. PYTHON_BIN := $(shell which python3.3) ifndef PYTHON_BIN @@ -38,52 +48,10 @@ COPY := False USER := "" PASSWORD := "" -################################################################################################ -# How to use: # -# Specify the environment variables in this file or set these variables from the command line. # -# All environment path variables should end with a slash. # -# Note that four settings need to be changed for this to work. # -# 1) SHOGUN_PATH # -# 2) PYTHONPATH # -# 3) WEKA_CLASSPATH # -# 4) MATLAB_BIN # -################################################################################################ - -# Set the environment variable for the mlpack executables. - -ifdef $(shell which mlpack_knn) - export MLPACK_BIN=$(shell dirname $(firstword $(shell which mlpack_knn)))/ -else - export MLPACK_BIN="" -endif - -# Set the environment variable for the mlpack executables. -export MLPACK_BIN_DEBUG=$(MLPACK_BIN) - -# Export the MLPACK_PATH environment variable. -export MLPACK_PATH=$(shell dirname $(MLPACK_BIN))/ +# Set the environment variable for the compiled mlpack executables. export MLPACK_BIN_SRC=methods/mlpack/src/build/ export MLPACK_BIN_DEBUG_SRC=methods/mlpack/src/build/ -# Set the environment variable for the matlab executable. -# You can use the following command to search the 'matlab' file everytime: -# export MATLAB_BIN=$(shell find / -name matlab -print 2>/dev/null -quit) -export MATLAB_BIN="" - -# Export the MATLABPATH environment variable. -export MATLABPATH=$(shell pwd)/methods/matlab/ - -# Export the WEKA_CLASSPATH environment variable. -# You can use the following command to search the 'weka.jar' file everytime: -# export WEKA_CLASSPATH=".:$(shell find / -name weka.jar -print 2>/dev/null -quit)" -export WEKA_CLASSPATH=".:/Users/marcus/Downloads/weka-3-6-11/weka.jar" - -# Export the SHOGUN_PATH environment variable. -export SHOGUN_PATH="" - -# Export the PYTHONPATH environment variable. -export PYTHONPATH="" - # Set the environment variable for the the ms_print executable. export MS_PRINT_BIN=$(shell which ms_print) @@ -92,12 +60,14 @@ export VALGRIND_BIN=$(shell which valgrind) # Export the path to the FLANN library. export FLANN_PATH=methods/flann/ - # Export the path to the ANN library. export ANN_PATH=methods/ann/ -# Export the path to the HLearn library. -export HLEARN_PATH="" +# Set LD_LIBRARY_PATH correctly. +export LD_LIBRARY_PATH=$(shell echo $(LIBPATH)) +# Set PYTHONPATH correctly. +PYVERSION=$(shell python3 -c 'import sys; print("python" + sys.version[0:3])') +export PYTHONPATH=$(shell pwd)/libraries/lib/$(shell echo $(PYVERSION))/dist-packages:$(shell pwd)/libraries/lib/$(shell echo $(PYVERSION))/site-packages # Color settings. NO_COLOR=\033[0m @@ -200,11 +170,14 @@ endif .scripts: # Compile the java files for the weka methods. - javac -cp $(shell echo $(WEKA_CLASSPATH)) -d methods/weka methods/weka/src/*.java + javac -cp $(shell echo $(JAVAPATH)/weka.jar) -d methods/weka methods/weka/src/*.java # Compile the ann scripts. - g++ -O0 -std=c++11 methods/ann/src/allknn.cpp -o methods/ann/allknn -I$(MLPACK_PATH)/include -I$(ANN_PATH)/include -L$(MLPACK_PATH)/lib -L$(ANN_PATH)/lib -lANN -lmlpack -lboost_program_options + g++ -O0 -std=c++11 methods/ann/src/allknn.cpp -o methods/ann/allknn -I$(INCLUDEPATH) -L$(LIBPATH) -lANN -lmlpack -lboost_program_options # Compile the FLANN scripts. - g++ -O0 -std=c++11 methods/flann/src/allknn.cpp -o methods/flann/allknn -I$(MLPACK_PATH)/include -I$(FLANN_PATH)/include -L$(MLPACK_PATH)/lib -L$(FLANN_PATH)/lib -lmlpack -lboost_program_options + g++ -O0 -std=c++11 methods/flann/src/allknn.cpp -o methods/flann/allknn -I$(INCLUDEPATH) -L$(LIBPATH) -lmlpack -lboost_program_options -llz4 + # Compile the mlpack scripts. (Can't do this until ANN is released or a + # git version of mlpack is used.) + #cd methods/mlpack/src/ && ./build_scripts.sh .setup: cd libraries/ && ./download_packages.sh && ./install_all.sh From 3915c2772be1860815103dbda322c39bb6a144a2 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:33:56 -0400 Subject: [PATCH 03/18] Update mlpack location. --- methods/mlpack/allkfn.py | 4 ++-- methods/mlpack/allknn.py | 4 ++-- methods/mlpack/allkrann.py | 4 ++-- methods/mlpack/decision_stump.py | 4 ++-- methods/mlpack/det.py | 4 ++-- methods/mlpack/emst.py | 4 ++-- methods/mlpack/fastmks.py | 4 ++-- methods/mlpack/hmm_generate.py | 4 ++-- methods/mlpack/hmm_loglik.py | 4 ++-- methods/mlpack/hmm_train.py | 4 ++-- methods/mlpack/hmm_viterbi.py | 4 ++-- methods/mlpack/ica.py | 4 ++-- methods/mlpack/kernel_pca.py | 4 ++-- methods/mlpack/kmeans.py | 4 ++-- methods/mlpack/lars.py | 4 ++-- methods/mlpack/linear_regression.py | 4 ++-- methods/mlpack/local_coordinate_coding.py | 4 ++-- methods/mlpack/logistic_regression.py | 4 ++-- methods/mlpack/lsh.py | 4 ++-- methods/mlpack/mlp_backward.py | 2 +- methods/mlpack/nbc.py | 4 ++-- methods/mlpack/nca.py | 4 ++-- methods/mlpack/nmf.py | 4 ++-- methods/mlpack/pca.py | 4 ++-- methods/mlpack/perceptron.py | 4 ++-- methods/mlpack/range_search.py | 4 ++-- methods/mlpack/sparse_coding.py | 4 ++-- 27 files changed, 53 insertions(+), 53 deletions(-) diff --git a/methods/mlpack/allkfn.py b/methods/mlpack/allkfn.py index 34991b3..566c161 100644 --- a/methods/mlpack/allkfn.py +++ b/methods/mlpack/allkfn.py @@ -43,8 +43,8 @@ class ALLKFN(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/allknn.py b/methods/mlpack/allknn.py index 35b6be0..9c3a7f4 100644 --- a/methods/mlpack/allknn.py +++ b/methods/mlpack/allknn.py @@ -43,8 +43,8 @@ class ALLKNN(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/allkrann.py b/methods/mlpack/allkrann.py index 39c1b60..0360116 100644 --- a/methods/mlpack/allkrann.py +++ b/methods/mlpack/allkrann.py @@ -43,8 +43,8 @@ class ALLKRANN(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/decision_stump.py b/methods/mlpack/decision_stump.py index 615c07d..76e3359 100644 --- a/methods/mlpack/decision_stump.py +++ b/methods/mlpack/decision_stump.py @@ -51,8 +51,8 @@ class DecisionStump(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/det.py b/methods/mlpack/det.py index 07a14d7..c7735c0 100644 --- a/methods/mlpack/det.py +++ b/methods/mlpack/det.py @@ -45,8 +45,8 @@ class DET(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/emst.py b/methods/mlpack/emst.py index 381ffc9..33b074c 100644 --- a/methods/mlpack/emst.py +++ b/methods/mlpack/emst.py @@ -43,8 +43,8 @@ class EMST(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/fastmks.py b/methods/mlpack/fastmks.py index baf070b..e393906 100644 --- a/methods/mlpack/fastmks.py +++ b/methods/mlpack/fastmks.py @@ -43,8 +43,8 @@ class FastMKS(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/hmm_generate.py b/methods/mlpack/hmm_generate.py index ccdef13..a95bcb0 100644 --- a/methods/mlpack/hmm_generate.py +++ b/methods/mlpack/hmm_generate.py @@ -43,8 +43,8 @@ class HMMGENERATE(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/hmm_loglik.py b/methods/mlpack/hmm_loglik.py index dda57b5..2832932 100644 --- a/methods/mlpack/hmm_loglik.py +++ b/methods/mlpack/hmm_loglik.py @@ -44,8 +44,8 @@ class HMMLOGLIK(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/hmm_train.py b/methods/mlpack/hmm_train.py index 5a80b36..9acc9a8 100644 --- a/methods/mlpack/hmm_train.py +++ b/methods/mlpack/hmm_train.py @@ -43,8 +43,8 @@ class HMMTRAIN(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/hmm_viterbi.py b/methods/mlpack/hmm_viterbi.py index fb8376d..0c3b1dd 100644 --- a/methods/mlpack/hmm_viterbi.py +++ b/methods/mlpack/hmm_viterbi.py @@ -45,8 +45,8 @@ class HMMVITERBI(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/ica.py b/methods/mlpack/ica.py index 955cf30..cb749f4 100644 --- a/methods/mlpack/ica.py +++ b/methods/mlpack/ica.py @@ -43,8 +43,8 @@ class ICA(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/kernel_pca.py b/methods/mlpack/kernel_pca.py index a1ac03a..927b652 100644 --- a/methods/mlpack/kernel_pca.py +++ b/methods/mlpack/kernel_pca.py @@ -43,8 +43,8 @@ class KPCA(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/kmeans.py b/methods/mlpack/kmeans.py index 2e8b95c..52438b8 100644 --- a/methods/mlpack/kmeans.py +++ b/methods/mlpack/kmeans.py @@ -43,8 +43,8 @@ class KMEANS(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/lars.py b/methods/mlpack/lars.py index a3a057c..3373399 100644 --- a/methods/mlpack/lars.py +++ b/methods/mlpack/lars.py @@ -43,8 +43,8 @@ class LARS(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/linear_regression.py b/methods/mlpack/linear_regression.py index 5a36b41..a53d4d6 100644 --- a/methods/mlpack/linear_regression.py +++ b/methods/mlpack/linear_regression.py @@ -50,8 +50,8 @@ class LinearRegression(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/local_coordinate_coding.py b/methods/mlpack/local_coordinate_coding.py index 1097614..a36403d 100644 --- a/methods/mlpack/local_coordinate_coding.py +++ b/methods/mlpack/local_coordinate_coding.py @@ -43,8 +43,8 @@ class LocalCoordinateCoding(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/logistic_regression.py b/methods/mlpack/logistic_regression.py index 9932f03..de02f9e 100644 --- a/methods/mlpack/logistic_regression.py +++ b/methods/mlpack/logistic_regression.py @@ -51,8 +51,8 @@ class LogisticRegression(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/lsh.py b/methods/mlpack/lsh.py index 2f1d293..8785ba4 100644 --- a/methods/mlpack/lsh.py +++ b/methods/mlpack/lsh.py @@ -44,8 +44,8 @@ class LSH(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/mlp_backward.py b/methods/mlpack/mlp_backward.py index 6726f6a..9c86742 100644 --- a/methods/mlpack/mlp_backward.py +++ b/methods/mlpack/mlp_backward.py @@ -80,7 +80,7 @@ def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN_SRC"], successful. ''' def RunMetrics(self, options): - Log.Info("Perform MLP Backard.", self.verbose) + Log.Info("Perform MLP Backward.", self.verbose) # Split the command using shell-like syntax. cmd = shlex.split(self.path + "mlp_backward -v " + options) diff --git a/methods/mlpack/nbc.py b/methods/mlpack/nbc.py index 1e6c91a..cc374fb 100644 --- a/methods/mlpack/nbc.py +++ b/methods/mlpack/nbc.py @@ -51,8 +51,8 @@ class NBC(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/nca.py b/methods/mlpack/nca.py index f84d8b1..867466e 100644 --- a/methods/mlpack/nca.py +++ b/methods/mlpack/nca.py @@ -43,8 +43,8 @@ class NCA(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/nmf.py b/methods/mlpack/nmf.py index 77e869e..8de22e5 100644 --- a/methods/mlpack/nmf.py +++ b/methods/mlpack/nmf.py @@ -43,8 +43,8 @@ class NMF(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/pca.py b/methods/mlpack/pca.py index 9358b75..4f61169 100644 --- a/methods/mlpack/pca.py +++ b/methods/mlpack/pca.py @@ -42,8 +42,8 @@ class PCA(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/perceptron.py b/methods/mlpack/perceptron.py index 4884e26..306cafe 100644 --- a/methods/mlpack/perceptron.py +++ b/methods/mlpack/perceptron.py @@ -51,8 +51,8 @@ class PERCEPTRON(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/range_search.py b/methods/mlpack/range_search.py index ffbd387..17225e5 100644 --- a/methods/mlpack/range_search.py +++ b/methods/mlpack/range_search.py @@ -43,8 +43,8 @@ class RANGESEARCH(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path diff --git a/methods/mlpack/sparse_coding.py b/methods/mlpack/sparse_coding.py index fca1168..86a7647 100644 --- a/methods/mlpack/sparse_coding.py +++ b/methods/mlpack/sparse_coding.py @@ -43,8 +43,8 @@ class SparseCoding(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["MLPACK_BIN"], - verbose=True, debug=os.environ["MLPACK_BIN_DEBUG"]): + def __init__(self, dataset, timeout=0, path=os.environ["BINPATH"], + verbose=True, debug=os.environ["DEBUGBINPATH"]): self.verbose = verbose self.dataset = dataset self.path = path From 59c29263b25dc382c93a3f14b44e20ee40bdb464 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:34:51 -0400 Subject: [PATCH 04/18] Fix config file. (Should these datasets have been removed?) --- config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config.yaml b/config.yaml index 38ef3f1..8d3377d 100644 --- a/config.yaml +++ b/config.yaml @@ -969,13 +969,13 @@ methods: ['datasets/scene_train.csv', 'datasets/scene_test.csv', 'datasets/scene_labels.csv'], ['datasets/webpage_train.csv', 'datasets/webpage_test.csv', 'datasets/webpage_labels.csv'], ['datasets/isolet_train.csv', 'datasets/isolet_test.csv', 'datasets/isolet_labels.csv'], - - ['datasets/mammography_train.csv', 'datasets/mammography_test.csv', 'datasets/mammography_labels.csv'], - - ['datasets/reuters_train.csv', 'datasets/reuters_test.csv', 'datasets/reuters_labels.csv'], - - ['datasets/abalone19_train.csv', 'datasets/abalone19_test.csv', 'datasets/abalone19_labels.csv'], - - ['datasets/sickEuthyroid_train.csv', 'datasets/sickEuthyroid_test.csv', 'datasets/sickEuthyroid_labels.csv'], - - ['datasets/abalone7_train.csv', 'datasets/abalone7_test.csv', 'datasets/abalone7_labels.csv'], - - ['datasets/satellite_train.csv', 'datasets/satellite_test.csv', 'datasets/satellite_labels.csv'], - - ['datasets/ecoli_train.csv', 'datasets/ecoli_test.csv', 'datasets/ecoli_labels.csv'] ] + ['datasets/mammography_train.csv', 'datasets/mammography_test.csv', 'datasets/mammography_labels.csv'], + ['datasets/reuters_train.csv', 'datasets/reuters_test.csv', 'datasets/reuters_labels.csv'], + ['datasets/abalone19_train.csv', 'datasets/abalone19_test.csv', 'datasets/abalone19_labels.csv'], + ['datasets/sickEuthyroid_train.csv', 'datasets/sickEuthyroid_test.csv', 'datasets/sickEuthyroid_labels.csv'], + ['datasets/abalone7_train.csv', 'datasets/abalone7_test.csv', 'datasets/abalone7_labels.csv'], + ['datasets/satellite_train.csv', 'datasets/satellite_test.csv', 'datasets/satellite_labels.csv'], + ['datasets/ecoli_train.csv', 'datasets/ecoli_test.csv', 'datasets/ecoli_labels.csv'] ] options: '-e 50 -c entropy -d 10 --min_samples_split 4 --min_samples_leaf 2 --n_jobs 2' SVM: run: ['metric'] From 220c405ca4018f8a80af9fd848a15ca0102cd9bc Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:35:14 -0400 Subject: [PATCH 05/18] For MATLAB we should check that it's on the PATH. --- libraries/matlab_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/matlab_install.sh b/libraries/matlab_install.sh index e33f880..b519d0d 100755 --- a/libraries/matlab_install.sh +++ b/libraries/matlab_install.sh @@ -1,7 +1,7 @@ #!/bin/bash # # This does not install MATLAB but instead simply checks for its presence. -if [ ! -f /opt/matlab/bin/matlab ]; +if [ ! -f `which matlab` ]; then echo "MATLAB not found!" exit 1 From 8ea39f832b0e388a00c4638f800f1cbda8ef3b5c Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:35:24 -0400 Subject: [PATCH 06/18] Install debug version also. --- libraries/mlpack_install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/mlpack_install.sh b/libraries/mlpack_install.sh index 6101da3..dfa1ae8 100755 --- a/libraries/mlpack_install.sh +++ b/libraries/mlpack_install.sh @@ -30,3 +30,10 @@ mkdir build/ cd build/ cmake -DCMAKE_INSTALL_PREFIX=../../ -DBUILD_TESTS=OFF ../ make install + +# Also install debug version. +cd .. +mkdir build-debug/ +cd build-debug/ +cmake -DDEBUG=ON -DCMAKE_INSTALL_PREFIX=../../debug/ -DBUILD_TEST=OFF ../ +make install From b80d0845db097ce95030a0f0dafb8b1b2fdd32a8 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:35:36 -0400 Subject: [PATCH 07/18] Install Python packages to appropriate directory. --- libraries/mlpy_install.sh | 2 +- libraries/scikit_install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/mlpy_install.sh b/libraries/mlpy_install.sh index 0dfdcce..3de1927 100755 --- a/libraries/mlpy_install.sh +++ b/libraries/mlpy_install.sh @@ -26,4 +26,4 @@ tar -xzpf mlpy*.tar.gz --strip-components=1 -C mlpy/ cd mlpy/ python3 setup.py build -python3 setup.py install --prefix=../../ -O2 +python3 setup.py install --prefix=../ -O2 diff --git a/libraries/scikit_install.sh b/libraries/scikit_install.sh index 48f3e90..20f32a2 100755 --- a/libraries/scikit_install.sh +++ b/libraries/scikit_install.sh @@ -26,4 +26,4 @@ tar -xzpf scikit*.tar.gz --strip-components=1 -C scikit/ cd scikit/ python3 setup.py build -python3 setup.py install --prefix=../../ -O2 +python3 setup.py install --prefix=../ -O2 From bb40ca33631381dd79e7dba61ba7a2c44bffeda9 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:35:55 -0400 Subject: [PATCH 08/18] Update Weka location. --- methods/weka/allknn.py | 2 +- methods/weka/kmeans.py | 2 +- methods/weka/linear_regression.py | 2 +- methods/weka/logistic_regression.py | 2 +- methods/weka/nbc.py | 2 +- methods/weka/pca.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/methods/weka/allknn.py b/methods/weka/allknn.py index dc1f43c..bf74f6a 100644 --- a/methods/weka/allknn.py +++ b/methods/weka/allknn.py @@ -37,7 +37,7 @@ class ALLKNN(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"], + def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"], verbose = True): self.verbose = verbose self.dataset = dataset diff --git a/methods/weka/kmeans.py b/methods/weka/kmeans.py index 0c43aed..201547c 100644 --- a/methods/weka/kmeans.py +++ b/methods/weka/kmeans.py @@ -37,7 +37,7 @@ class KMEANS(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"], + def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"], verbose=True): self.verbose = verbose self.dataset = dataset diff --git a/methods/weka/linear_regression.py b/methods/weka/linear_regression.py index d8f49af..e932fcc 100644 --- a/methods/weka/linear_regression.py +++ b/methods/weka/linear_regression.py @@ -45,7 +45,7 @@ class LinearRegression(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"], + def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"], verbose=True): self.verbose = verbose self.dataset = dataset diff --git a/methods/weka/logistic_regression.py b/methods/weka/logistic_regression.py index 8a46030..20e14a9 100644 --- a/methods/weka/logistic_regression.py +++ b/methods/weka/logistic_regression.py @@ -45,7 +45,7 @@ class LogisticRegression(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"], + def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"], verbose=True): self.verbose = verbose self.dataset = dataset diff --git a/methods/weka/nbc.py b/methods/weka/nbc.py index ceff4d2..b93d9f6 100644 --- a/methods/weka/nbc.py +++ b/methods/weka/nbc.py @@ -46,7 +46,7 @@ class NBC(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"], + def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"], verbose=True): self.verbose = verbose self.dataset = dataset diff --git a/methods/weka/pca.py b/methods/weka/pca.py index 383110f..2554525 100644 --- a/methods/weka/pca.py +++ b/methods/weka/pca.py @@ -37,7 +37,7 @@ class PCA(object): @param path - Path to the mlpack executable. @param verbose - Display informational messages. ''' - def __init__(self, dataset, timeout=0, path=os.environ["WEKA_CLASSPATH"], + def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"], verbose=True): self.verbose = verbose self.dataset = dataset From c6191f8b11f20465fe7459b991cd39926eed2f39 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:37:11 -0400 Subject: [PATCH 09/18] Fix path of Python install. --- libraries/annoy_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/annoy_install.sh b/libraries/annoy_install.sh index 115c190..a0614fe 100644 --- a/libraries/annoy_install.sh +++ b/libraries/annoy_install.sh @@ -26,4 +26,4 @@ tar -xzpf annoy*.tar.gz --strip-components=1 -C annoy/ cd annoy/ python3 setup.py build -python3 setup.py install --prefix=../../ -O2 +python3 setup.py install --prefix=../ -O2 From a1d80e08a0f01123cbb3471d677057acb49d5f25 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 10 Apr 2017 15:42:33 -0400 Subject: [PATCH 10/18] Fix install path and get around setuptools warning. --- libraries/annoy_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 libraries/annoy_install.sh diff --git a/libraries/annoy_install.sh b/libraries/annoy_install.sh old mode 100644 new mode 100755 index a0614fe..63c24e3 --- a/libraries/annoy_install.sh +++ b/libraries/annoy_install.sh @@ -26,4 +26,5 @@ tar -xzpf annoy*.tar.gz --strip-components=1 -C annoy/ cd annoy/ python3 setup.py build -python3 setup.py install --prefix=../ -O2 +PYVER=`python3 -c 'import sys; print("python" + sys.version[0:3])'`; +PYTHONPATH=../lib/$PYVER/site-packages/ python3 setup.py install --prefix=../ -O2 From 85b0e57b3fd90b7999a133401a2daf5089ae12d8 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 11 Apr 2017 10:45:59 -0400 Subject: [PATCH 11/18] Fix naming conflicts and force names to .tar.gz. --- libraries/ann_install.sh | 14 ++++---------- libraries/annoy_install.sh | 14 ++++---------- libraries/flann_install.sh | 14 ++++---------- libraries/hlearn_install.sh | 26 +++++++------------------- libraries/mlpack_install.sh | 14 ++++---------- libraries/mlpy_install.sh | 14 ++++---------- libraries/scikit_install.sh | 14 ++++---------- libraries/shogun_install.sh | 14 ++++---------- libraries/weka_install.sh | 14 ++++---------- 9 files changed, 39 insertions(+), 99 deletions(-) diff --git a/libraries/ann_install.sh b/libraries/ann_install.sh index 14f2e24..5595b64 100755 --- a/libraries/ann_install.sh +++ b/libraries/ann_install.sh @@ -5,25 +5,19 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One ann*.tar.gz file should be located in this directory containing the +# One ann.tar.gz file should be located in this directory containing the # source code of the desired mlpack version. -tars=`ls ann*.tar.gz | wc -l`; +tars=`ls ann.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No ann source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one ann source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source ann.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf ann/ mkdir ann/ -tar -xzpf ann*.tar.gz --strip-components=1 -C ann/ +tar -xzpf ann.tar.gz --strip-components=1 -C ann/ cd ann/ make linux-g++ diff --git a/libraries/annoy_install.sh b/libraries/annoy_install.sh index 63c24e3..626eb93 100755 --- a/libraries/annoy_install.sh +++ b/libraries/annoy_install.sh @@ -5,24 +5,18 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One annoy*.tar.gz file should be located in this directory. -tars=`ls annoy*.tar.gz | wc -l`; +# One annoy.tar.gz file should be located in this directory. +tars=`ls annoy.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No annoy source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one annoy source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source annoy.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf annoy/ mkdir annoy/ -tar -xzpf annoy*.tar.gz --strip-components=1 -C annoy/ +tar -xzpf annoy.tar.gz --strip-components=1 -C annoy/ cd annoy/ python3 setup.py build diff --git a/libraries/flann_install.sh b/libraries/flann_install.sh index 4cb017c..ebd8499 100755 --- a/libraries/flann_install.sh +++ b/libraries/flann_install.sh @@ -5,25 +5,19 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One flann*.tar.gz file should be located in this directory containing the +# One flann.tar.gz file should be located in this directory containing the # source code of the desired mlpack version. -tars=`ls flann*.tar.gz | wc -l`; +tars=`ls flann.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No flann source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one flann source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source flann.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf flann/ mkdir flann/ -tar -xzpf flann*.tar.gz --strip-components=1 -C flann/ +tar -xzpf flann.tar.gz --strip-components=1 -C flann/ cd flann/ mkdir build/ diff --git a/libraries/hlearn_install.sh b/libraries/hlearn_install.sh index c905092..b579d18 100755 --- a/libraries/hlearn_install.sh +++ b/libraries/hlearn_install.sh @@ -5,43 +5,31 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One HLearn*.tar.gz file should be located in this directory. Also since +# One HLearn.tar.gz file should be located in this directory. Also since # HLearn depends on subhask, a subhask*.tar.gz file should also be located in # this directory. -tars=`ls HLearn*.tar.gz | wc -l`; +tars=`ls HLearn.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No HLearn source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one HLearn source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source HLearn.tar.gz found in libraries/!" exit 1 fi -subhasktars=`ls subhask*.tar.gz | wc -l`; +subhasktars=`ls subhask.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No subhask source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one subhask source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source subhask.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf hlearn/ mkdir hlearn/ -tar -xzpf HLearn*.tar.gz --strip-components=1 -C hlearn/ +tar -xzpf HLearn.tar.gz --strip-components=1 -C hlearn/ rm -rf subhask/ mkdir subhask/ -tar -xvzpf subhask*.tar.gz --strip-components=1 -C subhask/ +tar -xvzpf subhask.tar.gz --strip-components=1 -C subhask/ cd hlearn/ cabal sandbox init diff --git a/libraries/mlpack_install.sh b/libraries/mlpack_install.sh index dfa1ae8..0fa38dc 100755 --- a/libraries/mlpack_install.sh +++ b/libraries/mlpack_install.sh @@ -5,25 +5,19 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One mlpack*.tar.gz file should be located in this directory containing the +# One mlpack.tar.gz file should be located in this directory containing the # source code of the desired mlpack version. -tars=`ls mlpack*.tar.gz | wc -l`; +tars=`ls mlpack.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No mlpack source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one mlpack source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source mlpack.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf mlpack/ mkdir mlpack/ -tar -xzpf mlpack*.tar.gz --strip-components=1 -C mlpack/ +tar -xzpf mlpack.tar.gz --strip-components=1 -C mlpack/ cd mlpack/ mkdir build/ diff --git a/libraries/mlpy_install.sh b/libraries/mlpy_install.sh index 3de1927..fae4c06 100755 --- a/libraries/mlpy_install.sh +++ b/libraries/mlpy_install.sh @@ -5,24 +5,18 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One mlpy*.tar.gz file should be located in this directory. -tars=`ls mlpy*.tar.gz | wc -l`; +# One mlpy.tar.gz file should be located in this directory. +tars=`ls mlpy.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No mlpy source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one mlpy source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source mlpy.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf mlpy/ mkdir mlpy/ -tar -xzpf mlpy*.tar.gz --strip-components=1 -C mlpy/ +tar -xzpf mlpy.tar.gz --strip-components=1 -C mlpy/ cd mlpy/ python3 setup.py build diff --git a/libraries/scikit_install.sh b/libraries/scikit_install.sh index 20f32a2..903af98 100755 --- a/libraries/scikit_install.sh +++ b/libraries/scikit_install.sh @@ -5,24 +5,18 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One scikit*.tar.gz file should be located in this directory. -tars=`ls scikit*.tar.gz | wc -l`; +# One scikit.tar.gz file should be located in this directory. +tars=`ls scikit.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No scikit source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one scikit source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source scikit.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf scikit/ mkdir scikit/ -tar -xzpf scikit*.tar.gz --strip-components=1 -C scikit/ +tar -xzpf scikit.tar.gz --strip-components=1 -C scikit/ cd scikit/ python3 setup.py build diff --git a/libraries/shogun_install.sh b/libraries/shogun_install.sh index 649ef4e..67e0eba 100755 --- a/libraries/shogun_install.sh +++ b/libraries/shogun_install.sh @@ -5,24 +5,18 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One shogun*.tar.gz file should be located in this directory. -tars=`ls shogun*.tar.gz | wc -l`; +# One shogun.tar.gz file should be located in this directory. +tars=`ls shogun.tar.gz | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No shogun source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one shogun source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source shogun.tar.gz found in libraries/!" exit 1 fi # Remove any old directory. rm -rf shogun/ mkdir shogun/ -tar -xzpf shogun*.tar.gz --strip-components=1 -C shogun/ +tar -xzpf shogun.tar.gz --strip-components=1 -C shogun/ cd shogun/ mkdir build/ diff --git a/libraries/weka_install.sh b/libraries/weka_install.sh index 3e5c986..e112ff9 100755 --- a/libraries/weka_install.sh +++ b/libraries/weka_install.sh @@ -5,23 +5,17 @@ # Include files will be installed to ../include/. # Library files will be installed to ../lib/. # -# One weka*.tar.gz file should be located in this directory. -tars=`ls scikit*.tar.gz | wc -l`; +# One weka.zip file should be located in this directory. +tars=`ls weka.zip | wc -l`; if [ "$tars" -eq "0" ]; then - echo "No weka source .tar.gz found in libraries/!" - exit 1 -fi -if [ "$tars" -ne "1" ]; -then - echo "More than one weka source .tar.gz found." - echo "Ensure only one is present in libraries/!" + echo "No source weka.zip found in libraries/!" exit 1 fi # Remove any old directory. rm -rf weka/ -unzip weka*.zip +unzip weka.zip mv weka-[0-9]-[0-9]-[0-9]/ weka/ cd weka/ From bff5a5515f30d6b8cbe37b4130ed6615c9498594 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 11 Apr 2017 10:46:31 -0400 Subject: [PATCH 12/18] Preserve existing PYTHONPATH. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ff7776f..28eca4e 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ export ANN_PATH=methods/ann/ export LD_LIBRARY_PATH=$(shell echo $(LIBPATH)) # Set PYTHONPATH correctly. PYVERSION=$(shell python3 -c 'import sys; print("python" + sys.version[0:3])') -export PYTHONPATH=$(shell pwd)/libraries/lib/$(shell echo $(PYVERSION))/dist-packages:$(shell pwd)/libraries/lib/$(shell echo $(PYVERSION))/site-packages +export PYTHONPATH=$(shell printenv PYTHONPATH):$(shell pwd)/libraries/lib/$(shell echo $(PYVERSION))/dist-packages:$(shell pwd)/libraries/lib/$(shell echo $(PYVERSION))/site-packages # Color settings. NO_COLOR=\033[0m From 0334f9628d464c36ffa251c61581601b0f3fa32f Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 20 Apr 2017 16:03:34 -0400 Subject: [PATCH 13/18] Better handling of JAVAPATH with Weka jar. --- methods/weka/allknn.py | 7 ++++--- methods/weka/kmeans.py | 2 +- methods/weka/linear_regression.py | 6 +++--- methods/weka/logistic_regression.py | 6 +++--- methods/weka/nbc.py | 5 +++-- methods/weka/pca.py | 4 ++-- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/methods/weka/allknn.py b/methods/weka/allknn.py index bf74f6a..0b19c21 100644 --- a/methods/weka/allknn.py +++ b/methods/weka/allknn.py @@ -58,13 +58,14 @@ def RunMetrics(self, options): # If the dataset contains two files then the second file is the query file. # In this case we add this to the command line. if len(self.dataset) == 2: - inputCmd = "-r " + self.dataset[0] + " -q " + self.dataset[1] + " " + options + inputCmd = "-r " + self.dataset[0] + " -q " + self.dataset[1] + " " + + options else: inputCmd = "-r " + self.dataset + " " + options # Split the command using shell-like syntax. - cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + - " AllKnn " + inputCmd + " " + options) + cmd = shlex.split("java -classpath " + self.path + "/weka.jar" + + ":methods/weka" + " AllKnn " + inputCmd + " " + options) # Run command with the nessecary arguments and return its output as a byte # string. We have untrusted input so we disable all shell based features. diff --git a/methods/weka/kmeans.py b/methods/weka/kmeans.py index 201547c..b9302ed 100644 --- a/methods/weka/kmeans.py +++ b/methods/weka/kmeans.py @@ -56,7 +56,7 @@ def RunMetrics(self, options): Log.Info("Perform K-Means.", self.verbose) # Split the command using shell-like syntax. - cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + + cmd = shlex.split("java -classpath " + self.path + "/weka.jar:methods/weka" + " KMeans -i " + self.dataset[0] + " " + options) # Run command with the nessecary arguments and return its output as a byte diff --git a/methods/weka/linear_regression.py b/methods/weka/linear_regression.py index e932fcc..0e3118e 100644 --- a/methods/weka/linear_regression.py +++ b/methods/weka/linear_regression.py @@ -79,9 +79,9 @@ def RunMetrics(self, options): # If the dataset contains two files then the second file is the responses # file. In this case we add this to the command line. if len(self.dataset) >= 2: - cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + - " LinearRegression -i " + self.dataset[0] + " -t " + self.dataset[1] - + " " + options) + cmd = shlex.split("java -classpath " + self.path + "/weka.jar" + + ":methods/weka" + " LinearRegression -i " + self.dataset[0] + " -t " + + self.dataset[1] + " " + options) else: cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + " LinearRegression -i " + self.dataset[0] + " " + options) diff --git a/methods/weka/logistic_regression.py b/methods/weka/logistic_regression.py index 20e14a9..c9eb824 100644 --- a/methods/weka/logistic_regression.py +++ b/methods/weka/logistic_regression.py @@ -79,9 +79,9 @@ def RunMetrics(self, options): # If the dataset contains two files then the second file is the responses # file. In this case we add this to the command line. if len(self.dataset) >= 2: - cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + - " LogisticRegression -i " + self.dataset[0] + " -t " + self.dataset[1] - + " " + options) + cmd = shlex.split("java -classpath " + self.path + "/weka.jar" + + ":methods/weka LogisticRegression -i " + self.dataset[0] + " -t " + + self.dataset[1] + " " + options) else: cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + " LogisticRegression -i " + self.dataset[0] + " " + options) diff --git a/methods/weka/nbc.py b/methods/weka/nbc.py index b93d9f6..05b6a6b 100644 --- a/methods/weka/nbc.py +++ b/methods/weka/nbc.py @@ -69,8 +69,9 @@ def RunMetrics(self, options): return -1 # Split the command using shell-like syntax. - cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + - " NBC -t " + self.dataset[0] + " -T " + self.dataset[1] + " " + options) + cmd = shlex.split("java -classpath " + self.path + "/weka.jar" + + ":methods/weka" + " NBC -t " + self.dataset[0] + " -T " + + self.dataset[1] + " " + options) # Run command with the nessecary arguments and return its output as a byte # string. We have untrusted input so we disable all shell based features. diff --git a/methods/weka/pca.py b/methods/weka/pca.py index 2554525..fd935e4 100644 --- a/methods/weka/pca.py +++ b/methods/weka/pca.py @@ -56,8 +56,8 @@ def RunMetrics(self, options): Log.Info("Perform PCA.", self.verbose) # Split the command using shell-like syntax. - cmd = shlex.split("java -classpath " + self.path + ":methods/weka" + - " PCA -i " + self.dataset + " " + options) + cmd = shlex.split("java -classpath " + self.path + "/weka.jar" + + ":methods/weka" + " PCA -i " + self.dataset + " " + options) # Run command with the nessecary arguments and return its output as a byte # string. We have untrusted input so we disable all shell based features. From f67b78f473f0c7c11a8bf410e808f6899e7fadce Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 20 Apr 2017 17:20:53 -0400 Subject: [PATCH 14/18] Use -fPIC for compilation. --- libraries/ann_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ann_install.sh b/libraries/ann_install.sh index 5595b64..7efd68e 100755 --- a/libraries/ann_install.sh +++ b/libraries/ann_install.sh @@ -20,7 +20,7 @@ mkdir ann/ tar -xzpf ann.tar.gz --strip-components=1 -C ann/ cd ann/ -make linux-g++ +CXXFLAGS=-fPIC make linux-g++ cp -r include/* ../include/ cp -r bin/* ../bin/ cp -r lib/* ../lib/ From 59d05dec89755e2b3afc29ca263759be5a8b1ef3 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 11 May 2017 15:48:07 -0400 Subject: [PATCH 15/18] Remove HLearn install and configuration; doesn't work with ghc 8. --- config.yaml | 22 --------------- libraries/hlearn_install.sh | 53 ++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/config.yaml b/config.yaml index f0dfde2..87beffe 100644 --- a/config.yaml +++ b/config.yaml @@ -1967,28 +1967,6 @@ methods: 'datasets/Twitter.csv', 'datasets/tinyImages100k.csv'] options: '-k 3 -s 42 -e 0.25' --- -# HLearn: Homomorphic machine learning -library: hlearn -methods: - ALLKNN: - run: ['metric'] - script: methods/hlearn/allknn.py - format: [csv, txt] - datasets: - - files: ['datasets/wine.csv', 'datasets/cloud.csv', - 'datasets/wine_qual.csv', 'datasets/isolet.csv', - 'datasets/corel-histogram.csv', 'datasets/covtype.csv', - 'datasets/1000000-10-randu.csv', 'datasets/mnist_all.csv', - 'datasets/Twitter.csv', 'datasets/tinyImages100k.csv'] - options: '-k 3' - - - files: ['datasets/wine.csv', 'datasets/cloud.csv', - 'datasets/wine_qual.csv', 'datasets/isolet.csv', - 'datasets/corel-histogram.csv', 'datasets/covtype.csv', - 'datasets/1000000-10-randu.csv', 'datasets/mnist_all.csv', - 'datasets/Twitter.csv', 'datasets/tinyImages100k.csv'] - options: '-k 4' ---- # MRPT: fast nearest neighbor search with random projection library: mrpt methods: diff --git a/libraries/hlearn_install.sh b/libraries/hlearn_install.sh index b579d18..4b70a69 100755 --- a/libraries/hlearn_install.sh +++ b/libraries/hlearn_install.sh @@ -8,33 +8,36 @@ # One HLearn.tar.gz file should be located in this directory. Also since # HLearn depends on subhask, a subhask*.tar.gz file should also be located in # this directory. -tars=`ls HLearn.tar.gz | wc -l`; -if [ "$tars" -eq "0" ]; -then - echo "No source HLearn.tar.gz found in libraries/!" - exit 1 -fi +# +# HLearn doesn't work with ghc 8, so this installation is commented out. + +#tars=`ls HLearn.tar.gz | wc -l`; +#if [ "$tars" -eq "0" ]; +#then +# echo "No source HLearn.tar.gz found in libraries/!" +# exit 1 +#fi -subhasktars=`ls subhask.tar.gz | wc -l`; -if [ "$tars" -eq "0" ]; -then - echo "No source subhask.tar.gz found in libraries/!" - exit 1 -fi +#subhasktars=`ls subhask.tar.gz | wc -l`; +#if [ "$tars" -eq "0" ]; +#then +# echo "No source subhask.tar.gz found in libraries/!" +# exit 1 +#fi # Remove any old directory. -rm -rf hlearn/ -mkdir hlearn/ -tar -xzpf HLearn.tar.gz --strip-components=1 -C hlearn/ +#rm -rf hlearn/ +#mkdir hlearn/ +#tar -xzpf HLearn.tar.gz --strip-components=1 -C hlearn/ -rm -rf subhask/ -mkdir subhask/ -tar -xvzpf subhask.tar.gz --strip-components=1 -C subhask/ +#rm -rf subhask/ +#mkdir subhask/ +#tar -xvzpf subhask.tar.gz --strip-components=1 -C subhask/ -cd hlearn/ -cabal sandbox init -cabal sandbox add-source ../subhask -cabal update -cabal install --only-dependencies --force-reinstalls -cabal build -cabal install +#cd hlearn/ +#cabal sandbox init +#cabal sandbox add-source ../subhask +#cabal update +#cabal install --only-dependencies --force-reinstalls +#cabal build +#cabal install From 86d9ab3866f9665bf53bc0760edbb673674bf520 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 12 May 2017 10:23:30 -0400 Subject: [PATCH 16/18] Work around 2.2.0 and 2.2.1 bug. --- libraries/mlpack_install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/mlpack_install.sh b/libraries/mlpack_install.sh index 0fa38dc..4ab3e80 100755 --- a/libraries/mlpack_install.sh +++ b/libraries/mlpack_install.sh @@ -31,3 +31,13 @@ mkdir build-debug/ cd build-debug/ cmake -DDEBUG=ON -DCMAKE_INSTALL_PREFIX=../../debug/ -DBUILD_TEST=OFF ../ make install + +# Work around bug in 2.2.0 and 2.2.1. +cd ../../bin/ +ln -s mlpack_knn mlpack_allknn +ln -s mlpack_kfn mlpack_allkfn +ln -s mlpack_krann mlpack_allkrann +cd ../debug/bin/ +ln -s mlpack_knn mlpack_allknn +ln -s mlpack_kfn mlpack_allkfn +ln -s mlpack_krann mlpack_allkrann From 9b7b7b9c7144f5a45a0034e67f7760a644c70bc3 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 12 May 2017 11:00:05 -0400 Subject: [PATCH 17/18] Fix line wrap. --- methods/weka/allknn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/methods/weka/allknn.py b/methods/weka/allknn.py index 0b19c21..d377a54 100644 --- a/methods/weka/allknn.py +++ b/methods/weka/allknn.py @@ -58,7 +58,7 @@ def RunMetrics(self, options): # If the dataset contains two files then the second file is the query file. # In this case we add this to the command line. if len(self.dataset) == 2: - inputCmd = "-r " + self.dataset[0] + " -q " + self.dataset[1] + " " + + inputCmd = "-r " + self.dataset[0] + " -q " + self.dataset[1] + " " + \ options else: inputCmd = "-r " + self.dataset + " " + options From 8c6cde9e03d03572e5b3d0a1d9a918dd693a0cb8 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 12 May 2017 11:00:40 -0400 Subject: [PATCH 18/18] Don't change directory when loading module. --- util/loader.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/util/loader.py b/util/loader.py index 7d3c80a..0305512 100644 --- a/util/loader.py +++ b/util/loader.py @@ -21,12 +21,6 @@ class Loader(object): ''' @staticmethod def ImportModuleFromPath(path): - if hasattr(os, "getcwdu"): - # Returns a unicode object represantation. - realPath = os.path.realpath(os.getcwdu()) - else: - realPath = os.path.realpath(os.path.curdir) - destinationPath = os.path.dirname(path) if destinationPath == "": @@ -40,16 +34,14 @@ def ImportModuleFromPath(path): else: modName = scriptName - os.chdir(destinationPath) fileHandle = None try: - tup = imp.find_module(modName, ['.']) + tup = imp.find_module(modName, [destinationPath]) module = imp.load_module(modName, *tup) fileHandle = tup[0] finally: - os.chdir(realPath) if fileHandle is not None: fileHandle.close() # Return the name of the module. - return module \ No newline at end of file + return module