ym_predict()

Read(601) Label: scoring, model object,

Description:

Perform data scoring.

Syntax:

ym_predict(pd,data)

Note:

The external library function (See External Library Guide) performs data scoring based on model object pd. Parameter data is the to-be-scored data, which can be stored in a table sequence, a cursor, a CSV file or an mtx file. When data’s value is a file, the file’s path can be absolute or relative; it is [sAppHome]/store/predict if relative. If data’s value is a CSV file, the content must be comma-separated structured data.

Return a table sequence of scoring results when the data to be scored is a single record or concurrent records;

Return scoring result object when the data to be scored contains multiple records or it is a file.

Parameter:

pd

A model object

data

To-be-scored data

Option:

@m

The function @m(pd,data;duration) performs data scoring with a parallel processing. Parameter duration defines a time period (Unit: millisecond) during which the data is to be scored

Return value:

A scoring result object/table sequence

Example:

 

A

 

1

=ym_env()

Start Python service

2

=ym_load_pcf("model.pcf")

Generate a model object based on mode file model.pcf

3

=ym_predict(A2,"train_2.csv")

Score data in train_2.csv according to A2’s model object and return the scoring result object

4

>ym_close(A1)

Release resources

 

 

A

B

 

1

=file("D:/train_t.csv").import@tcq()

 

Get the data file to be scored

2

=ym_env()

 

Start the Python service

3

=ym_load_pcf("model.pcf")

 

Generate a model object from an existing model file model.pcf

4

fork A1

=ym_predict@m(A3,A4;100)

Use @m option to perform the scoring with concurrent processing and return scoring result table sequence

5

>ym_close(A2)

 

Release resources