Skip to content

Commit ec70b69

Browse files
authored
Update how-to-deploy-and-where.md
Adding instructions on NCD sklearn for predict_proba vs predict
1 parent d33f5c4 commit ec70b69

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

articles/machine-learning/how-to-deploy-and-where.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,24 @@ service_name = 'my-sklearn-service'
904904
service = Model.deploy(ws, service_name, [model])
905905
```
906906

907+
NOTE: Models which support predict_proba will use that method by default. To override this to use predict you can modify the POST header as below:
908+
```python
909+
import json
910+
911+
912+
input_payload = json.dumps({
913+
'data': [
914+
[ 0.03807591, 0.05068012, 0.06169621, 0.02187235, -0.0442235,
915+
-0.03482076, -0.04340085, -0.00259226, 0.01990842, -0.01764613]
916+
],
917+
'method': 'predict' # If you have a classification model, the default behavior is to run 'predict_proba'.
918+
})
919+
920+
output = service.run(input_payload)
921+
922+
print(output)
923+
```
924+
907925
NOTE: These dependencies are included in the prebuilt sklearn inference container:
908926

909927
```yaml

0 commit comments

Comments
 (0)