Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: multioutput prediction with y preprocessing #19

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/helpers/predict_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def predict_onnx(model, dataset: JaqpotpyDataset, request):
# onnx_prediction is being reshaped to a 2D array to avoid errors
# when the model has only one dependent feature. In multi-output models,
# onnx_prediction is already a 2D array.
else:
onnx_prediction = onnx_prediction[0]

if request.model["extraConfig"]["preprocessors"]:
for i in reversed(range(len(request.model["extraConfig"]["preprocessors"]))):
Expand All @@ -28,9 +30,8 @@ def predict_onnx(model, dataset: JaqpotpyDataset, request):

if len(request.model["dependentFeatures"]) == 1:
onnx_prediction = onnx_prediction.flatten()
return onnx_prediction
else:
return onnx_prediction[0]

return onnx_prediction


def predict_proba_onnx(model, dataset: JaqpotpyDataset, request):
Expand Down
Loading