Skip to content

Commit

Permalink
FIX: if statement nesting + redundant docstring entry
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekWadinger committed Feb 14, 2024
1 parent 8a7628e commit 4059871
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions river/covariance/emp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SymmetricMatrix(abc.ABC):

@property
@abc.abstractmethod
def matrix(self):
def matrix(self) -> dict:
...

def __getitem__(self, key):
Expand Down Expand Up @@ -196,8 +196,6 @@ def _update_from_state(self, n: int, mean: dict, cov: float | dict):
A dictionary of variable means.
cov
A dictionary of covariance or variance values.
ddof
Degrees of freedom for covariance calculation. Defaults to 1.
Raises
----------
Expand Down Expand Up @@ -226,10 +224,9 @@ def _update_from_state(self, n: int, mean: dict, cov: float | dict):
except KeyError:
self._cov[i, i] = stats.Var(self.ddof)
if isinstance(cov, dict):
if isinstance(cov, dict):
cov_ = cov[i, i]
else:
cov_ = cov
cov_ = cov[i, i]
else:
cov_ = cov
self._cov[i, i] += stats.Var._from_state(n=n, m=mean[i], sig=cov_, ddof=self.ddof)

@classmethod
Expand Down

0 comments on commit 4059871

Please sign in to comment.