<s> import unittest <EOL> from nose . tools import ( assert_raises , assert_equals ) <EOL> import numpy <EOL> import sknn <EOL> from sknn . ae import AutoEncoder as AE , Layer as L <EOL> from sknn import mlp <EOL> @ unittest . skipIf ( sknn . backend . name != '<STR_LIT>' , '<STR_LIT>' ) <EOL> class TestAutoEncoder ( unittest . TestCase ) : <EOL> def test_LifeCycle ( self ) : <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , units = <NUM_LIT:8> ) ] ) <EOL> del ae <EOL> def test_FitData ( self ) : <EOL> X = numpy . zeros ( ( <NUM_LIT:8> , <NUM_LIT:4> ) ) <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , units = <NUM_LIT:8> ) ] , n_iter = <NUM_LIT:1> ) <EOL> ae . fit ( X ) <EOL> def test_FitVerbose ( self ) : <EOL> X = numpy . zeros ( ( <NUM_LIT:8> , <NUM_LIT:4> ) ) <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , units = <NUM_LIT:8> ) ] , n_iter = <NUM_LIT:1> , verbose = <NUM_LIT:1> ) <EOL> ae . fit ( X ) <EOL> def test_TransferSuccess ( self ) : <EOL> X = numpy . zeros ( ( <NUM_LIT:8> , <NUM_LIT:4> ) ) <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , units = <NUM_LIT:4> ) ] , n_iter = <NUM_LIT:1> ) <EOL> ae . fit ( X ) <EOL> nn = mlp . MultiLayerPerceptron ( <EOL> layers = [ mlp . Layer ( "<STR_LIT>" , units = <NUM_LIT:4> ) ] ) <EOL> ae . transfer ( nn ) <EOL> def test_TransferFailure ( self ) : <EOL> X = numpy . zeros ( ( <NUM_LIT:8> , <NUM_LIT:4> ) ) <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , units = <NUM_LIT:8> ) ] , n_iter = <NUM_LIT:1> ) <EOL> ae . fit ( X ) <EOL> nn = mlp . MultiLayerPerceptron ( <EOL> layers = [ mlp . Layer ( "<STR_LIT>" , units = <NUM_LIT:4> ) ] ) <EOL> assert_raises ( AssertionError , ae . transfer , nn ) <EOL> @ unittest . skipIf ( sknn . backend . name != '<STR_LIT>' , '<STR_LIT>' ) <EOL> class TestParameters ( unittest . TestCase ) : <EOL> def test_CostFunctions ( self ) : <EOL> X = numpy . zeros ( ( <NUM_LIT:8> , <NUM_LIT:12> ) ) <EOL> for t in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , units = <NUM_LIT:4> , cost = t ) ] , n_iter = <NUM_LIT:1> ) <EOL> y = ae . fit_transform ( X ) <EOL> assert_equals ( type ( y ) , numpy . ndarray ) <EOL> assert_equals ( y . shape , ( <NUM_LIT:8> , <NUM_LIT:4> ) ) <EOL> def test_LayerTypes ( self ) : <EOL> X = numpy . zeros ( ( <NUM_LIT:8> , <NUM_LIT:12> ) ) <EOL> for l in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> ae = AE ( layers = [ L ( "<STR_LIT>" , type = l , units = <NUM_LIT:4> ) ] ) <EOL> y = ae . fit_transform ( X ) <EOL> assert_equals ( type ( y ) , numpy . ndarray ) <EOL> assert_equals ( y . shape , ( <NUM_LIT:8> , <NUM_LIT:4> ) ) <EOL> def test_UnknownCostFunction ( self ) : <EOL> assert_raises ( NotImplementedError , L , "<STR_LIT>" , cost = "<STR_LIT>" ) <EOL> def test_UnknownType ( self ) : <EOL> assert_raises ( NotImplementedError , L , "<STR_LIT>" , type = "<STR_LIT>" ) <EOL> def test_UnknownActivation ( self ) : <EOL> assert_raises ( NotImplementedError , L , "<STR_LIT>" ) </s>
