Skip to content

A programming framework for agentic AI

add periods

Chi Wang03bc62363f31
diff --git a/flaml/data.py b/flaml/data.py
index 2f6f7866c..d420917ed 100644
--- a/flaml/data.py
+++ b/flaml/data.py
@@ -205,7 +205,7 @@ def concat(X1, X2):
class DataTransformer:
- """Transform input training data"""
+ """Transform input training data."""
def fit_transform(self, X, y, task):
"""Fit transformer and process the input training data according to the task type.
diff --git a/flaml/onlineml/autovw.py b/flaml/onlineml/autovw.py
index 6ac7e1716..d82ba555a 100644
--- a/flaml/onlineml/autovw.py
+++ b/flaml/onlineml/autovw.py
@@ -169,7 +169,7 @@ class AutoVW:
self._trial_runner.step(data_sample, (self._y_predict, self._best_trial))
def _select_best_trial(self):
- """Select a best trial from the running trials accoring to the _model_select_policy"""
+ """Select a best trial from the running trials accoring to the _model_select_policy."""
best_score = (
float("+inf") if self._model_selection_mode == "min" else float("-inf")
)
diff --git a/flaml/onlineml/trial.py b/flaml/onlineml/trial.py
index 5a3371a66..f61c0286d 100644
--- a/flaml/onlineml/trial.py
+++ b/flaml/onlineml/trial.py
@@ -4,7 +4,7 @@ import time
import math
import copy
import collections
-from typing import Optional
+from typing import Optional, Union
from sklearn.metrics import mean_squared_error, mean_absolute_error
from flaml.tune import Trial
@@ -113,7 +113,7 @@ class OnlineResult:
def _update_loss_cb(
self, bound_of_range, data_dim, bound_name="sample_complexity_bound"
):
- """Calculate bound coef"""
+ """Calculate bound coef."""
if bound_name == "sample_complexity_bound":
# set the coefficient in the loss bound
if "mae" in self.result_type_name:
@@ -313,7 +313,6 @@ class VowpalWabbitTrial(BaseOnlineTrial):
is_checked_under_current_champion (bool): indicates whether this trials has
been paused under the current champion.
trial_id (str): id of the trial (if None, it will be generated in the constructor).
-
"""
try:
from vowpalwabbit import pyvw
@@ -345,7 +344,7 @@ class VowpalWabbitTrial(BaseOnlineTrial):
@staticmethod
def _config_to_id(config):
- """Generate an id for the provided config"""
+ """Generate an id for the provided config."""
# sort config keys
sorted_k_list = sorted(list(config.keys()))
config_id_full = ""
@@ -439,7 +438,7 @@ class VowpalWabbitTrial(BaseOnlineTrial):
return loss_func([y_true], [y_pred])
def _update_y_range(self, y):
- """Maintain running observed minimum and maximum target value"""
+ """Maintain running observed minimum and maximum target value."""
if self._y_min_observed is None or y < self._y_min_observed:
self._y_min_observed = y
if self._y_max_observed is None or y > self._y_max_observed:
@@ -447,9 +446,9 @@ class VowpalWabbitTrial(BaseOnlineTrial):
@staticmethod
def _get_dim_from_ns(
- namespace_feature_dim: dict, namespace_interactions: [set, list]
+ namespace_feature_dim: dict, namespace_interactions: Union[set, list]
):
- """Get the dimensionality of the corresponding feature of input namespace set"""
+ """Get the dimensionality of the corresponding feature of input namespace set."""
total_dim = sum(namespace_feature_dim.values())
if namespace_interactions:
for f in namespace_interactions:
diff --git a/flaml/scheduler/online_scheduler.py b/flaml/scheduler/online_scheduler.py
index a413ea0a8..1fe8ae829 100644
--- a/flaml/scheduler/online_scheduler.py
+++ b/flaml/scheduler/online_scheduler.py
@@ -89,7 +89,7 @@ class OnlineSuccessiveDoublingScheduler(OnlineScheduler):
class ChaChaScheduler(OnlineSuccessiveDoublingScheduler):
- """Keep the top performing learners running
+ """Keep the top performing learners running.
Methods:
* on_trial_result(trial_runner, trial, result):