Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Nov 16, 2024
1 parent 45aaf9b commit f138d9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion river/datasets/synth/logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def __iter__(self):
X, Y = self._make_logical(n_tiles=self.n_tiles, shuffle=self.shuffle)

for xi, yi in itertools.zip_longest(X, Y if hasattr(Y, "__iter__") else []):
yield dict(zip(self.feature_names, xi.tolist())), dict(zip(self.target_names, yi.tolist()))
yield (
dict(zip(self.feature_names, xi.tolist())),
dict(zip(self.target_names, yi.tolist())),
)

def _make_logical(self, n_tiles: int = 1, shuffle: bool = True):
"""Make toy dataset"""
Expand Down
6 changes: 1 addition & 5 deletions river/linear_model/bayesian_lin_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,7 @@ def predict_one(self, x, with_dist=False):
"""

# Bishop equation 3.58
y_pred_mean = (
0.0
if not len(self._m)
else utils.math.dot(self._m, x).item()
)
y_pred_mean = 0.0 if not len(self._m) else utils.math.dot(self._m, x).item()
if not with_dist:
return y_pred_mean

Expand Down
4 changes: 3 additions & 1 deletion river/preprocessing/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ def learn_many(self, X: pd.DataFrame):

self.means[col] = (a * old_mean + b * new_mean).item()
if self.with_std:
self.vars[col] = (a * old_var + b * new_var + a * b * (old_mean - new_mean) ** 2).item()
self.vars[col] = (
a * old_var + b * new_var + a * b * (old_mean - new_mean) ** 2
).item()
self.counts[col] += new_count.item()

def transform_many(self, X: pd.DataFrame):
Expand Down

0 comments on commit f138d9c

Please sign in to comment.