<s> """<STR_LIT>""" <EOL> from __future__ import division , absolute_import , print_function <EOL> import numpy as np <EOL> from statsmodels . tsa . statespace . kalman_filter import ( <EOL> FILTER_CONVENTIONAL , <EOL> INVERT_UNIVARIATE , <EOL> SOLVE_LU , <EOL> INVERT_LU , <EOL> SOLVE_CHOLESKY , <EOL> INVERT_CHOLESKY , <EOL> STABILITY_FORCE_SYMMETRY , <EOL> MEMORY_STORE_ALL , <EOL> MEMORY_NO_FORECAST , <EOL> MEMORY_NO_PREDICTED , <EOL> MEMORY_NO_FILTERED , <EOL> MEMORY_NO_LIKELIHOOD , <EOL> MEMORY_CONSERVE <EOL> ) <EOL> from statsmodels . tsa . statespace . kalman_smoother import ( <EOL> KalmanSmoother , <EOL> SMOOTHER_STATE , <EOL> SMOOTHER_STATE_COV , <EOL> SMOOTHER_DISTURBANCE , <EOL> SMOOTHER_DISTURBANCE_COV , <EOL> SMOOTHER_ALL <EOL> ) <EOL> from numpy . testing import assert_equal <EOL> class Options ( object ) : <EOL> @ classmethod <EOL> def setup_class ( cls , * args , ** kwargs ) : <EOL> endog = np . arange ( <NUM_LIT:10> ) <EOL> k_states = <NUM_LIT:1> <EOL> cls . model = KalmanSmoother ( k_endog = <NUM_LIT:1> , k_states = k_states , * args , <EOL> ** kwargs ) <EOL> cls . model . bind ( endog ) <EOL> class TestOptions ( Options ) : <EOL> def test_filter_methods ( self ) : <EOL> model = self . model <EOL> model . filter_method = <NUM_LIT:0> <EOL> model . filter_conventional = True <EOL> assert_equal ( model . filter_method , FILTER_CONVENTIONAL ) <EOL> model . filter_conventional = False <EOL> assert_equal ( model . filter_method , <NUM_LIT:0> ) <EOL> model . set_filter_method ( FILTER_CONVENTIONAL ) <EOL> assert_equal ( model . filter_method , FILTER_CONVENTIONAL ) <EOL> model . set_filter_method ( filter_conventional = True ) <EOL> assert_equal ( model . filter_method , FILTER_CONVENTIONAL ) <EOL> def test_inversion_methods ( self ) : <EOL> model = self . model <EOL> model . inversion_method = <NUM_LIT:0> <EOL> model . invert_univariate = True <EOL> assert_equal ( model . inversion_method , INVERT_UNIVARIATE ) <EOL> model . invert_cholesky = True <EOL> assert_equal ( model . inversion_method , INVERT_UNIVARIATE | INVERT_CHOLESKY ) <EOL> model . invert_univariate = False <EOL> assert_equal ( model . inversion_method , INVERT_CHOLESKY ) <EOL> model . set_inversion_method ( INVERT_LU ) <EOL> assert_equal ( model . inversion_method , INVERT_LU ) <EOL> model . set_inversion_method ( invert_cholesky = True , invert_univariate = True , invert_lu = False ) <EOL> assert_equal ( model . inversion_method , INVERT_UNIVARIATE | INVERT_CHOLESKY ) <EOL> model . inversion_method = <NUM_LIT:0> <EOL> for name in model . inversion_methods : <EOL> setattr ( model , name , True ) <EOL> assert_equal ( <EOL> model . inversion_method , <EOL> INVERT_UNIVARIATE | SOLVE_LU | INVERT_LU | SOLVE_CHOLESKY | <EOL> INVERT_CHOLESKY <EOL> ) <EOL> for name in model . inversion_methods : <EOL> setattr ( model , name , False ) <EOL> assert_equal ( model . inversion_method , <NUM_LIT:0> ) <EOL> def test_stability_methods ( self ) : <EOL> model = self . model <EOL> model . stability_method = <NUM_LIT:0> <EOL> model . stability_force_symmetry = True <EOL> assert_equal ( model . stability_method , STABILITY_FORCE_SYMMETRY ) <EOL> model . stability_force_symmetry = False <EOL> assert_equal ( model . stability_method , <NUM_LIT:0> ) <EOL> model . stability_method = <NUM_LIT:0> <EOL> model . set_stability_method ( STABILITY_FORCE_SYMMETRY ) <EOL> assert_equal ( model . stability_method , STABILITY_FORCE_SYMMETRY ) <EOL> model . stability_method = <NUM_LIT:0> <EOL> model . set_stability_method ( stability_method = True ) <EOL> assert_equal ( model . stability_method , STABILITY_FORCE_SYMMETRY ) <EOL> model . stability_method = <NUM_LIT:0> <EOL> model . set_stability_method ( stability_force_symmetry = True ) <EOL> assert_equal ( model . stability_method , STABILITY_FORCE_SYMMETRY ) <EOL> def test_conserve_memory ( self ) : <EOL> model = self . model <EOL> model . conserve_memory = MEMORY_STORE_ALL <EOL> model . memory_no_forecast = True <EOL> assert_equal ( model . conserve_memory , MEMORY_NO_FORECAST ) <EOL> model . memory_no_filtered = True <EOL> assert_equal ( model . conserve_memory , MEMORY_NO_FORECAST | MEMORY_NO_FILTERED ) <EOL> model . memory_no_forecast = False <EOL> assert_equal ( model . conserve_memory , MEMORY_NO_FILTERED ) <EOL> model . set_conserve_memory ( MEMORY_NO_PREDICTED ) <EOL> assert_equal ( model . conserve_memory , MEMORY_NO_PREDICTED ) <EOL> model . set_conserve_memory ( memory_no_filtered = True , memory_no_predicted = False ) <EOL> assert_equal ( model . conserve_memory , MEMORY_NO_FILTERED ) <EOL> model . conserve_memory = <NUM_LIT:0> <EOL> for name in model . memory_options : <EOL> if name == '<STR_LIT>' : <EOL> continue <EOL> setattr ( model , name , True ) <EOL> assert_equal ( <EOL> model . conserve_memory , <EOL> MEMORY_NO_FORECAST | MEMORY_NO_PREDICTED | MEMORY_NO_FILTERED | <EOL> MEMORY_NO_LIKELIHOOD <EOL> ) <EOL> assert_equal ( model . conserve_memory , MEMORY_CONSERVE ) <EOL> for name in model . memory_options : <EOL> if name == '<STR_LIT>' : <EOL> continue <EOL> setattr ( model , name , False ) <EOL> assert_equal ( model . conserve_memory , <NUM_LIT:0> ) <EOL> def test_smoother_outputs ( self ) : <EOL> model = self . model <EOL> model . smoother_output = <NUM_LIT:0> <EOL> model . smoother_state = True <EOL> assert_equal ( model . smoother_output , SMOOTHER_STATE ) <EOL> model . smoother_disturbance = True <EOL> assert_equal ( model . smoother_output , SMOOTHER_STATE | SMOOTHER_DISTURBANCE ) <EOL> model . smoother_state = False <EOL> assert_equal ( model . smoother_output , SMOOTHER_DISTURBANCE ) <EOL> model . set_smoother_output ( SMOOTHER_DISTURBANCE_COV ) <EOL> assert_equal ( model . smoother_output , SMOOTHER_DISTURBANCE_COV ) <EOL> model . set_smoother_output ( smoother_disturbance = True , smoother_disturbance_cov = False ) <EOL> assert_equal ( model . smoother_output , SMOOTHER_DISTURBANCE ) <EOL> model . smoother_output = <NUM_LIT:0> <EOL> for name in model . smoother_outputs : <EOL> if name == '<STR_LIT>' : <EOL> continue <EOL> setattr ( model , name , True ) <EOL> assert_equal ( <EOL> model . smoother_output , <EOL> SMOOTHER_STATE | SMOOTHER_STATE_COV | SMOOTHER_DISTURBANCE | <EOL> SMOOTHER_DISTURBANCE_COV <EOL> ) <EOL> assert_equal ( model . smoother_output , SMOOTHER_ALL ) <EOL> for name in model . smoother_outputs : <EOL> if name == '<STR_LIT>' : <EOL> continue <EOL> setattr ( model , name , False ) <EOL> assert_equal ( model . smoother_output , <NUM_LIT:0> ) </s>
