本文整理匯總了Python中statsmodels.tsa.statespace.representation.Representation._initialize_representation方法的典型用法代碼示例。如果您正苦於以下問題:Python Representation._initialize_representation方法的具體用法?Python Representation._initialize_representation怎麽用?Python Representation._initialize_representation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類statsmodels.tsa.statespace.representation.Representation
的用法示例。
在下文中一共展示了Representation._initialize_representation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_representation
# 需要導入模塊: from statsmodels.tsa.statespace.representation import Representation [as 別名]
# 或者: from statsmodels.tsa.statespace.representation.Representation import _initialize_representation [as 別名]
def test_representation():
# Test an invalid number of states
def zero_kstates():
mod = Representation(1, 0)
assert_raises(ValueError, zero_kstates)
# Test an invalid endogenous array
def empty_endog():
endog = np.zeros((0,0))
mod = Representation(endog, k_states=2)
assert_raises(ValueError, empty_endog)
# Test a Fortran-ordered endogenous array (which will be assumed to be in
# wide format: k_endog x nobs)
nobs = 10
k_endog = 2
endog = np.asfortranarray(np.arange(nobs*k_endog).reshape(k_endog,nobs)*1.)
mod = Representation(endog, k_states=2)
assert_equal(mod.nobs, nobs)
assert_equal(mod.k_endog, k_endog)
# Test a C-ordered endogenous array (which will be assumed to be in
# tall format: nobs x k_endog)
nobs = 10
k_endog = 2
endog = np.arange(nobs*k_endog).reshape(nobs,k_endog)*1.
mod = Representation(endog, k_states=2)
assert_equal(mod.nobs, nobs)
assert_equal(mod.k_endog, k_endog)
# Test getting the statespace representation
assert_equal(mod._statespace, None)
mod._initialize_representation()
assert(mod._statespace is not None)
示例2: test_representation_pickle
# 需要導入模塊: from statsmodels.tsa.statespace.representation import Representation [as 別名]
# 或者: from statsmodels.tsa.statespace.representation.Representation import _initialize_representation [as 別名]
def test_representation_pickle():
nobs = 10
k_endog = 2
endog = np.asfortranarray(np.arange(nobs * k_endog).reshape(k_endog, nobs) * 1.)
mod = Representation(endog, k_states=2)
pkl_mod = cPickle.loads(cPickle.dumps(mod))
assert_equal(mod.nobs, pkl_mod.nobs)
assert_equal(mod.k_endog, pkl_mod.k_endog)
mod._initialize_representation()
pkl_mod._initialize_representation()
assert_equal(mod.design, pkl_mod.design)
assert_equal(mod.obs_intercept, pkl_mod.obs_intercept)
assert_equal(mod.initial_variance, pkl_mod.initial_variance)