Skip to content

Commit e64b486

Browse files
authored
Fix Best Practices not shown (#1483)
* Simplify automl.fit calls in Best Practices Removed 'retrain_full' and 'eval_method' parameters from automl.fit calls. * Fix best practices not shown
1 parent a74354f commit e64b486

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

website/docs/Best-Practices.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
````markdown
21
# Best Practices
32

43
This page collects practical guidance for using FLAML effectively across common tasks.
@@ -16,7 +15,10 @@ from flaml.automl.task.factory import task_factory
1615

1716
automl = AutoML()
1817
print("Built-in sklearn metrics:", sorted(automl.supported_metrics[0]))
19-
print("classification estimators:", sorted(task_factory("classification").estimators.keys()))
18+
print(
19+
"classification estimators:",
20+
sorted(task_factory("classification").estimators.keys()),
21+
)
2022
```
2123

2224
## Classification
@@ -86,7 +88,7 @@ X_train, X_test, y_train, y_test = train_test_split(
8688
automl = AutoML()
8789
mlflow.set_experiment("flaml")
8890
with mlflow.start_run(run_name="flaml_run") as run:
89-
automl.fit(X_train, y_train, task="classification", time_budget=3, retrain_full=False, eval_method="holdout")
91+
automl.fit(X_train, y_train, task="classification", time_budget=3)
9092

9193
run_id = run.info.run_id
9294

@@ -95,11 +97,11 @@ automl2 = mlflow.sklearn.load_model(f"runs:/{run_id}/model")
9597
assert np.array_equal(automl2.predict(X_test), automl.predict(X_test))
9698
```
9799

98-
### Option 2: Pickle the full `AutoML` instance (convenient / Fabric)
100+
### Option 2: Pickle the full `AutoML` instance (convenient)
99101

100102
Pickling stores the *entire* `AutoML` instance (not just the best estimator). This is useful when you prefer not to rely on MLflow or when you want to reuse additional attributes of the AutoML object without retraining.
101103

102-
In Microsoft Fabric scenarios, this is particularly important for re-plotting visualization figures without requiring model retraining.
104+
In Microsoft Fabric scenarios, additional attributes is particularly important for re-plotting visualization figures without requiring model retraining.
103105

104106
```python
105107
import mlflow
@@ -117,7 +119,7 @@ X_train, X_test, y_train, y_test = train_test_split(
117119
automl = AutoML()
118120
mlflow.set_experiment("flaml")
119121
with mlflow.start_run(run_name="flaml_run") as run:
120-
automl.fit(X_train, y_train, task="classification", time_budget=3, retrain_full=False, eval_method="holdout")
122+
automl.fit(X_train, y_train, task="classification", time_budget=3)
121123

122124
automl.pickle("automl.pkl")
123125
automl2 = AutoML.load_pickle("automl.pkl")
@@ -128,5 +130,3 @@ assert automl.mlflow_integration.infos == automl2.mlflow_integration.infos
128130
```
129131

130132
See also: [Task-Oriented AutoML](Use-Cases/Task-Oriented-AutoML) and [FAQ](FAQ).
131-
132-
````

website/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'Installation',
1616
{'Use Cases': [{type: 'autogenerated', dirName: 'Use-Cases'}]},
1717
{'Examples': [{type: 'autogenerated', dirName: 'Examples'}]},
18+
'Best-Practices',
1819
'Contribute',
1920
'Research',
2021
],

0 commit comments

Comments
 (0)