Skip to content

Commit cb66537

Browse files
authored
Update how-to-log-mlflow-models.md
1 parent 5660065 commit cb66537

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

articles/machine-learning/how-to-log-mlflow-models.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ from mlflow.models import infer_signature
249249

250250
mlflow.xgboost.autolog(log_models=False)
251251

252-
encoder = OrdinalEncoder(handle_unknown='ignore')
253-
X_train['thal'] = enc.fit_transform(X_train['thal'])
254-
X_test['thal'] = enc.transform(X_test['thal'])
252+
encoder = OrdinalEncoder(handle_unknown='use_encoded_value', unknown_value=np.nan)
253+
X_train['thal'] = encoder.fit_transform(X_train['thal'].to_frame())
254+
X_test['thal'] = encoder.transform(X_test['thal'].to_frame())
255255

256256
model = XGBClassifier(use_label_encoder=False, eval_metric="logloss")
257257
model.fit(X_train, y_train, eval_set=[(X_test, y_test)], verbose=False)

0 commit comments

Comments
 (0)