diff --git a/README.md b/README.md index 9c75036f4..174da6967 100644 --- a/README.md +++ b/README.md @@ -148,5 +148,5 @@ See the code in `tests/test_holoclean.py` for a documented usage of HoloClean. In order to run the test script, run the following: ```bash $ cd tests -$ python test_holoclean.py +$ ./start_test.sh ``` diff --git a/set_env.sh b/set_env.sh new file mode 100644 index 000000000..f91180375 --- /dev/null +++ b/set_env.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +export HOLOCLEANHOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +echo "Holoclean home directory: $HOLOCLEANHOME" +export PYTHONPATH="$PYTHONPATH:$HOLOCLEANHOME" +export PATH="$PATH:$HOLOCLEANHOME" +echo $PATH +echo "Environment variables set!" diff --git a/tests/start_test.sh b/tests/start_test.sh index a4c566dd4..5713bd7c9 100755 --- a/tests/start_test.sh +++ b/tests/start_test.sh @@ -1,5 +1,5 @@ # Set & move to home directory -# source ../set_env.sh +source ../set_env.sh # Launch test. echo "Launching test..." diff --git a/tests/test_holoclean.py b/tests/test_holoclean.py index c2e0b450d..3707c121a 100644 --- a/tests/test_holoclean.py +++ b/tests/test_holoclean.py @@ -1,7 +1,3 @@ -import sys - -sys.path.insert(0, '..') - import holoclean from detect import NullDetector, ViolationDetector @@ -14,18 +10,6 @@ from repair.featurize import LangModelFeat -def get_tid(row): - return row['tid'] - 1 - - -def get_attr(row): - return row['attribute'].lower() - - -def get_value(row): - return row['correct_val'].lower() - - # 1. Setup a HoloClean session. hc = holoclean.HoloClean(pruning_topk=0.1, epochs=30, weight_decay=0.01, threads=20, batch_size=1, verbose=True, timeout=3*60000).session @@ -44,4 +28,13 @@ def get_value(row): hc.repair_errors(featurizers) # 5. Evaluate the correctness of the results. +def get_tid(row): + return row['tid'] - 1 + +def get_attr(row): + return row['attribute'].lower() + +def get_value(row): + return row['correct_val'].lower() + hc.evaluate('data', 'hospital_clean.csv', get_tid, get_attr, get_value)