claudevdm commented on code in PR #41393:
URL: https://github.com/apache/beam/pull/41393#discussion_r4667617768


##########
sdks/python/apache_beam/ml/inference/sklearn_inference.py:
##########
@@ -209,9 +209,10 @@ def _default_pandas_inference_fn(
     model: BaseEstimator,
     batch: Sequence[pandas.DataFrame],
     inference_args: Optional[dict[str, Any]] = None) -> Any:
+  inference_args = {} if not inference_args else inference_args
   # vectorize data for better performance
   vectorized_batch = pandas.concat(batch, axis=0)
-  predictions = model.predict(vectorized_batch)
+  predictions = model.predict(vectorized_batch, **inference_args)

Review Comment:
   What should happen if someone passes `inference_args={'return_std': True}`? 
Now that the args reach `predict`, it returns two arrays, `(means, stds)`, 
instead of one prediction per row. With 2 rows I get `[0.4, 0.8]` for row 0 
(both means) and `[0.00027, 0.00028]` for row 1 (both stds), with no error, 
where master gives `0.4` and `0.8`. Would raising a clear error for a tuple 
work here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to