Skip to content

Commit

Permalink
Simplify chain operations (mlflow#9902)
Browse files Browse the repository at this point in the history
Signed-off-by: Rémy Léone <rleone@scaleway.com>
  • Loading branch information
remyleone authored Oct 12, 2023
1 parent 5652464 commit 1404fa6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mlflow/recipes/steps/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _get_split_df(input_df, hash_buckets, split_ratios):


def _parallelize(data, func, n_jobs=-1):
n_jobs = n_jobs if n_jobs > 0 and n_jobs <= _NUM_DEFAULT_CPUS else _NUM_DEFAULT_CPUS
n_jobs = n_jobs if 0 < n_jobs <= _NUM_DEFAULT_CPUS else _NUM_DEFAULT_CPUS
data_split = np.array_split(data, n_jobs)
pool = Pool(n_jobs)
data = pd.concat(pool.map(func, data_split))
Expand Down
2 changes: 1 addition & 1 deletion mlflow/recipes/steps/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _validate_and_apply_step_config(self):
if self.step_config["tuning_enabled"]:
if "sample_fraction" in self.step_config["tuning"]:
sample_fraction = float(self.step_config["tuning"]["sample_fraction"])
if sample_fraction > 0 and sample_fraction <= 1.0:
if 0 < sample_fraction <= 1.0:
self.step_config["sample_fraction"] = sample_fraction
else:
raise MlflowException(
Expand Down

0 comments on commit 1404fa6

Please sign in to comment.