PTOCIInferenceSupervised Class Methods
In this section, the PTOCIInferenceSupervised class method is discussed.
Syntax
PredictRun(&rs, &modelname)
Description
The PredictRun method runs prediction endpoint using the collected data and model name. The method converts the rowset data to JSON format and passes it to OCI Data Science.
Instead of using rowset data, you can also use JSON object to provide data to the method. In this case, the syntax is as follows:
PredictRun(modelname, json object)
Parameters
Parameter |
Description |
---|---|
&rs |
Specify the rowset. |
&modelname |
Specify the name of the model as a String value. |
Returns
A String value, which is the prediction result from the OCI Data Science service.
Example
The following example uses a rowset to provide data:
import PTMLINFERENCE:PTOCIInferenceSupervised;
Local PTMLINFERENCE:PTOCIInferenceSupervised &oCIInf;
Local string &mdlname = "M1";
&oCIInf = create PTMLINFERENCE:PTOCIInferenceSupervised(&mdlname);
Local Rowset &rs = CreateRowset(Record.EMPLOYEE_TBL);
/* Fill the Rowset */
&oCIInf.PredictRun(&rs, &mdlname);
The following example uses a JSON object to provide data:
Local File &MYFILE;
Local array of string &MYARRAY;
Local string &TEXT;
&MYFILE = GetFile("ES_DUMP_DATA_02.json", "R");
&MYARRAY = CreateArrayRept("", 0);
While &MYFILE.ReadLine(&TEXT);
&MYARRAY.Push(&TEXT);
End-While;
&MYFILE.Close();
Local object &oci;
&oci = CreateObject("PSOCIDatascience");
Local string &resp = &oci.PredictRun("M1", &TEXT);
WinMessage(&resp);