-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Iron-Stark/logtest
Benchmark test file for Logistic Regression.
- Loading branch information
Showing
2 changed files
with
58 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
''' | ||
@file benchmark_logistic_regression.py | ||
Test for the Logistic Regression Classifier scripts. | ||
''' | ||
|
||
import unittest | ||
|
||
import os, sys, inspect | ||
|
||
# Import the util path, this method even works if the path contains | ||
# symlinks to modules. | ||
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join( | ||
os.path.split(inspect.getfile(inspect.currentframe()))[0], '../util'))) | ||
if cmd_subfolder not in sys.path: | ||
sys.path.insert(0, cmd_subfolder) | ||
|
||
from loader import * | ||
''' | ||
Test the Scikit Logistic Regression Classifier script. | ||
''' | ||
class LR_SCIKIT_TEST(unittest.TestCase): | ||
|
||
''' | ||
Test initialization. | ||
''' | ||
def setUp(self): | ||
self.dataset = ['datasets/iris_train.csv', 'datasets/iris_test.csv'] | ||
self.verbose = False | ||
self.timeout = 9000 | ||
|
||
module = Loader.ImportModuleFromPath("methods/scikit/logistic_regression.py") | ||
obj = getattr(module, "LogisticRegression") | ||
self.instance = obj(self.dataset, verbose=self.verbose, timeout=self.timeout) | ||
|
||
''' | ||
Test the constructor. | ||
''' | ||
def test_Constructor(self): | ||
self.assertEqual(self.instance.verbose, self.verbose) | ||
self.assertEqual(self.instance.timeout, self.timeout) | ||
self.assertEqual(self.instance.dataset, self.dataset) | ||
|
||
''' | ||
Test the 'RunMetrics' function. | ||
''' | ||
def test_RunMetrics(self): | ||
result = self.instance.RunMetrics("") | ||
self.assertTrue(result["Runtime"] > 0) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|
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