Skip to content

Commit 360d3ad

Browse files
authored
Update how-to-batch-scoring-script.md
1 parent fcbaf3b commit 360d3ad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

articles/machine-learning/how-to-batch-scoring-script.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The scoring script must contain two methods:
3333

3434
#### The `init` method
3535

36-
Use the `init()` method for any costly or common preparation. For example, use it to load the model into a global object. This function will be called once at the beginning of the process. You model's files will be available in an environment variable called `AZUREML_MODEL_DIR`. Use this variable to locate the files associated with the model. Notice that some models may be contained in a folder (in the following example, the model has several files in a folder named `model`). See [how you can find out what's the folder used by your model](#using-models-that-are-folders).
36+
Use the `init()` method for any costly or common preparation. For example, use it to load the model into memory. This function will be called once at the beginning of the entire batch job. Your model's files will be available in a path determined by the environment variable `AZUREML_MODEL_DIR`. Notice that depending on how your model was registered, its files may be contained in a folder (in the following example, the model has several files in a folder named `model`). See [how you can find out what's the folder used by your model](#using-models-that-are-folders).
3737

3838
```python
3939
def init():
@@ -54,7 +54,10 @@ Notice that in this example we are placing the model in a global variable `model
5454
Use the `run(mini_batch: List[str]) -> Union[List[Any], pandas.DataFrame]` method to perform the scoring of each mini-batch generated by the batch deployment. Such method will be called once per each `mini_batch` generated for your input data. Batch deployments read data in batches accordingly to how the deployment is configured.
5555

5656
```python
57-
def run(mini_batch: List[str]) -> Union[List[Any], pandas.DataFrame]:
57+
import pandas as pd
58+
from typing import List, Any, Union
59+
60+
def run(mini_batch: List[str]) -> Union[List[Any], pd.DataFrame]:
5861
results = []
5962

6063
for file in mini_batch:

0 commit comments

Comments
 (0)