ym_result()

Read(42) Label: prediction,

Description:

Generate the prediction result according to a model object and the data for prediction.

Syntax:

ym_result(pd,data,resultFile)

Note:

The function performs prediction according to model object pd and necessary data data, returns the prediction result as a table sequence, and generates result file resultFile. Similar to data for model building, the data for prediction can come from a database, a table sequence, a CSV file, etc. If the prediction data is a file, it can be located by an absolute path or a relative path; by default the latter is relative to [sAppHome]/store/data_pd.

The result file resultFile can be in an absolute path or a relative path; by default the latter is relative to [sAppHome]/store/result

Wont’ generate a result file when parameter resultFile is absent.

Parameters:

pd

A PD mode object

data

Data for prediction

resultFile

The prediction result file; can be absent

Options:

@s

When the prediction data contains target variables, it enables the function check the model performance according to the prediction result and returns a series of information, such Gini inex, AUC index and KS index

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("train.csv")

 

3

=ym_model(A1,A2)

Load data for model building

4

=ym_target(A3, "Survived")

Set a target variable

5

=ym_setparam(A3,"modelFieldNames":["PassengerId","Survived","Pclass","Name","Sex","Age","SibSp"])

Set model parameters

6

=ym_build_model(A3,"tra.pcf")

Perform model building, generate a model file and retun a model object

7

=ym_result(A6,"train_t.csv","ret.txt")

Perform model building based on A6’s model object and the prediction data file train_t.csv and generate a prediction result file ret.txt which is stored in [sAppHome]/store/result

8

>ym_close(A1)

Close Python service

 

 

A

 

1

=ym_env()

Start Python service

2

=ym_predict("ttnkh.pcf")

Generate a model object based on mode file ttnkh.pcf

3

=ym_result@s(A2,"train_2.csv")

Perform prediction based on the model object and the prediction data; with @ s option, the function returns model performance data, as shown below:

As parameter resultFile is absent, the function won’t generates a prediction result file

4

>ym_close(A1)

Close Python service