mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-18 13:55:14 +02:00
replace collections iterable by typing iterable
This commit is contained in:
parent
a8638f7c5b
commit
ca4f2425bc
1 changed files with 4 additions and 6 deletions
|
|
@ -5,14 +5,12 @@
|
||||||
Main functionality for state-space inference.
|
Main functionality for state-space inference.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import collections # for cheking whether a variable is iterable
|
|
||||||
import types # for cheking whether a variable is a function
|
import types # for cheking whether a variable is a function
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy as sp
|
import scipy as sp
|
||||||
import scipy.linalg as linalg
|
import scipy.linalg as linalg
|
||||||
|
from typing import Iterable
|
||||||
import warnings
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from . import state_space_setup
|
from . import state_space_setup
|
||||||
|
|
@ -885,7 +883,7 @@ class DescreteStateSpace(object):
|
||||||
# P_init
|
# P_init
|
||||||
if P_init is None:
|
if P_init is None:
|
||||||
P_init = np.eye(state_dim)
|
P_init = np.eye(state_dim)
|
||||||
elif not isinstance(P_init, collections.Iterable): # scalar
|
elif not isinstance(P_init, Iterable): # scalar
|
||||||
P_init = P_init * np.eye(state_dim)
|
P_init = P_init * np.eye(state_dim)
|
||||||
|
|
||||||
if p_kalman_filter_type not in ("regular", "svd"):
|
if p_kalman_filter_type not in ("regular", "svd"):
|
||||||
|
|
@ -1094,7 +1092,7 @@ class DescreteStateSpace(object):
|
||||||
# P_init
|
# P_init
|
||||||
if P_init is None:
|
if P_init is None:
|
||||||
P_init = np.eye(p_state_dim)
|
P_init = np.eye(p_state_dim)
|
||||||
elif not isinstance(P_init, collections.Iterable): # scalar
|
elif not isinstance(P_init, Iterable): # scalar
|
||||||
P_init = P_init * np.eye(p_state_dim)
|
P_init = P_init * np.eye(p_state_dim)
|
||||||
|
|
||||||
if p_a is None:
|
if p_a is None:
|
||||||
|
|
@ -4078,7 +4076,7 @@ class ContDescrStateSpace(DescreteStateSpace):
|
||||||
# Dimensionality
|
# Dimensionality
|
||||||
n = F.shape[0]
|
n = F.shape[0]
|
||||||
|
|
||||||
if not isinstance(dt, collections.Iterable): # not iterable, scalar
|
if not isinstance(dt, Iterable): # not iterable, scalar
|
||||||
# import pdb; pdb.set_trace()
|
# import pdb; pdb.set_trace()
|
||||||
# The dynamical model
|
# The dynamical model
|
||||||
A = matrix_exponent(F * dt)
|
A = matrix_exponent(F * dt)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue