diff --git a/scikits/learn/utils/arffread.py b/scikits/learn/utils/arffread.py index 6842548489ab6e258c17178813e23dc66dd8a73a..8eebf4579e3695c42c562b16f352d6ba8ef8b64a 100644 --- a/scikits/learn/utils/arffread.py +++ b/scikits/learn/utils/arffread.py @@ -1 +1 @@ -raise ImportError("arff reader has been moved to scip.io: the function is called loadarff") +raise ImportError("arff reader has been moved to scip.io.arff: the function is called loadarff") diff --git a/scikits/learn/utils/src/test.py b/scikits/learn/utils/src/test.py index 2b118eb8827338d8d0c3daa191d022ff4024540f..8393da17c170c78960e37e351552681e27b7e1e8 100644 --- a/scikits/learn/utils/src/test.py +++ b/scikits/learn/utils/src/test.py @@ -4,7 +4,7 @@ import os import numpy as N -from scikits.learn.utils.arffread import read_arff +from scipy.io.arff import loadarff filename = '../arff.bak/data/pharynx.arff' @@ -40,7 +40,7 @@ for line in b.readlines(): else: haha.append(parse_numeric(line)) -data, meta = read_arff(filename) +data, meta = loadarff(filename) for i in meta: print i diff --git a/scikits/learn/utils/tests/__init__.py b/scikits/learn/utils/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/scikits/learn/utils/tests/test_preprocessing.py b/scikits/learn/utils/tests/test_preprocessing.py index eaecf3ce805f0050fe39d304303b4dc85d595fa2..b2dc9db048f466d67550b0c498f2af93e08755b3 100644 --- a/scikits/learn/utils/tests/test_preprocessing.py +++ b/scikits/learn/utils/tests/test_preprocessing.py @@ -1,15 +1,12 @@ from numpy.testing import * import numpy as N -set_package_path() -from utils.preprocessing import scale, Scaler, nanscale, NanScaler -restore_path() +from ..preprocessing import scale, Scaler, nanscale, NanScaler DEPS = N.finfo(N.float).eps -class test_scale(NumpyTestCase): +class test_scale: def __init__(self, *args, **kw): - NumpyTestCase.__init__(self, *args, **kw) N.random.seed(0) def test_simple(self): @@ -42,9 +39,8 @@ class test_scale(NumpyTestCase): assert N.all(at[N.isfinite(a)] <= 1. + DEPS) and \ N.all(at[N.isfinite(a)] >= 0. - DEPS) -class test_Scaler(NumpyTestCase): +class test_Scaler: def __init__(self, *args, **kw): - NumpyTestCase.__init__(self, *args, **kw) N.random.seed(0) def _generate_simple(self): @@ -58,18 +54,18 @@ class test_Scaler(NumpyTestCase): sc = Scaler(a, mode) # Test whether preprocess -> unprocess gives back the data - sc.preprocess(a) + sc.scale(a) if mode == 'sym': assert N.all(a <= 1. + DEPS) and N.all(a >= -1. - DEPS) elif mode == 'right': assert N.all(a <= 1. + DEPS) and N.all(a >= -0. - DEPS) else: raise ValueError("unexpected mode %s" % str(mode)) - sc.unprocess(a) + sc.unscale(a) assert_array_almost_equal(a, at) - sc.preprocess(b) - sc.unprocess(b) + sc.scale(b) + sc.unscale(b) assert_array_almost_equal(b, bt) def _nan_test(self, a, b, mode): @@ -79,7 +75,7 @@ class test_Scaler(NumpyTestCase): sc = NanScaler(a, mode) # Test whether preprocess -> unprocess gives back the data - sc.preprocess(at) + sc.scale(at) if mode == 'sym': assert N.all(at[N.isfinite(a)] <= 1. + DEPS) and \ N.all(at[N.isfinite(a)] >= -1. - DEPS) @@ -88,12 +84,12 @@ class test_Scaler(NumpyTestCase): N.all(at[N.isfinite(a)] >= 0. - DEPS) else: raise ValueError("unexpected mode %s" % str(mode)) - sc.unprocess(at) + sc.unscale(at) assert_array_almost_equal(a[N.isfinite(a)], at[N.isfinite(a)]) - sc.preprocess(b) - sc.unprocess(b) + sc.scale(b) + sc.unscale(b) assert_array_almost_equal(b, bt) def test_simple(self): @@ -124,6 +120,3 @@ class test_Scaler(NumpyTestCase): except ValueError: pass - -if __name__ == "__main__": - NumpyTest().run()