cancel
Showing results for 
Search instead for 
Did you mean: 

Python Batch Scoring, output one column and prediction

mserrette
Blue LED

Python Batch Scoring, output one column and prediction

We have large csv files, in the old batch scoring code there was a "Keep Columns" and in the UI there is a "Specific Features" field but I can't seem to find how to only output specific columns and the prediction.

 

The code below scores perfectly fine but it outputs a massive file with all the features I fed into it plus a prediction score. I only want 1 column and prediction score in the output file.

 

The closest thing I've found is columnNamesRemapping but the example isn't clear https://docs.datarobot.com/en/docs/predictions/batch/batch-prediction-api/output-format.html#column-...

 

Any help would be great.

 

 

 

import datarobot as dr

dr.Client(
endpoint="https://app.datarobot.com/api/v2",
token="tokenxx",
)

deployment_id = "deploymentidfkdsjfdksjfsd"
input_file = "input.csv"
output_file = "predicted.csv"

job = dr.BatchPredictionJob.score_to_file(
deployment_id,
input_file,
output_file,
passthrough_columns_set="all"
)

print("started scoring...", job)
job.wait_for_completion()

 

 

 

 

 

Labels (2)
0 Kudos
2 Replies
mserrette
Blue LED

Found the answer

 

passthrough_columns_set="all"

 

passthrough_colums_set=['column1', 'column2'] will preserve only the columns you want.

 

The documentation does not make that clear that it does what specific features does in the UI or what "Keep Columns" did in the old batch file. https://docs.datarobot.com/en/docs/predictions/batch/batch-prediction-api/output-format.html#passthr...

Linda
Community Manager
Community Manager

Welcome to the DataRobot Community @mserrette. Seems you were able to get to solve your own question in the end. If you have feedack to make it easier to find that information in the docs, please let us know. We want to make it effortless for everyone to get all the answers they need to help themselves. 

Looking forward to your feedback!

Linda

0 Kudos