From e365d94081b40aa801aeacc1f2981a31c9f215f4 Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Sun, 17 May 2015 17:26:41 +0200 Subject: [PATCH] Fix for corrputor AI exceptions, tests that actually run fit(). --- sknn/ae.py | 2 +- sknn/tests/test_ae.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sknn/ae.py b/sknn/ae.py index 1c16e57..3298cde 100644 --- a/sknn/ae.py +++ b/sknn/ae.py @@ -25,7 +25,7 @@ def __init__(self, units=None, cost='msre', tied_weights=False, - corruption_level=None): + corruption_level=0.5): assert warning is None, \ "Specify layer parameters as keyword arguments, not positional arguments." diff --git a/sknn/tests/test_ae.py b/sknn/tests/test_ae.py index 0c7f44b..dd5fd80 100644 --- a/sknn/tests/test_ae.py +++ b/sknn/tests/test_ae.py @@ -21,12 +21,16 @@ def test_FitData(self): class TestParameters(unittest.TestCase): def test_CostFunctions(self): + X = numpy.zeros((8,4)) for t in ['msre', 'mbce']: - AE(layers=[L("Sigmoid", units=8, cost=t)]) + ae = AE(layers=[L("Sigmoid", units=8, cost=t)], n_iter=1) + ae.fit(X) def test_LayerTypes(self): + X = numpy.zeros((8,4)) for l in ['autoencoder', 'denoising']: - AE(layers=[L("Sigmoid", type=l, units=8)]) + ae = AE(layers=[L("Sigmoid", type=l, units=8)]) + ae.fit(X) def test_UnknownCostFunction(self): assert_raises(NotImplementedError, L, "Sigmoid", cost="unknown")