Use this stored procedure to apply a KNN model to generate classification predictions or
regression predictions for a data set.
Authorization
The privileges held by the authorization ID of the statement must include the IDAX_USER role.
Additionally, you must be the owner of the model or have the authority to alter it.
Syntax
IDAX.PREDICT_KNN(in parameter_string varchar(32672))
Parameter descriptions
- parameter_string
- Mandatory one-string parameter that contains pairs of
<parameter>=<value> entries that are separated by a comma.
- Data type: VARCHAR(32672)
- The following list shows the parameter values:
-
- model
- Mandatory.
- The name of the KNN model that is to be applied.
- Data type: VARCHAR(64)
- intable
- Mandatory.
- The name of the input table.
- Data type: VARCHAR(128)
- outtable
- Mandatory.
- The name of the output table where the predicted values for the records of the input table are
stored.
- Data type: VARCHAR(128)
- id
- Optional.
- The column of the input table that identifies a unique record.
- Default: The name of the id column that is used to build the model.
- Data type: VARCHAR(128)
- target
- Optional.
- The column of the input table that represents the prediction target.
- The specified target column is not used for prediction.
- Default: The name of the target column that is used to build the model.
- Data type: VARCHAR(128)
- distance
- Optional.
- The distance that is to be used for calculating the nearest neighbors.
- Allowed values are "euclidean", "canberra", "manhattan", and "maximum".
- Default: 'euclidean'
- Data type: VARCHAR(16)
- k
- Optional.
- The number of the nearest neighbors that are to be considered.
- Default: 3
- Range: >=1
- Data type: INTEGER
- stand
- Optional.
- A flag that indicates to standardize the continuous input columns of the input table and of the
model table.
- Different scales of the continuous input columns are ignored so that columns with bigger values
are no longer disadvantaged.
- Default: true
- Data type: BOOLEAN
- fast
- Optional.
- A flag that indicates whether the faster approximate calculation method is to be used instead of
the exact method.
- Default: true
- Data type: BOOLEAN
- weights
- Optional.
- A table that contains class weights for the model table.
- Class weights are ignored if the target column of the model is of type "continuous".
- If you do not specify this parameter, all the weights are assumed to be equal to 1.
- The weight table contains the following columns:
- A WEIGHT column that contains numeric positive weights
- A CLASS column that contains values of the target column of the model
- Data type: VARCHAR(128)
Returned information
The number of input sequences for which a prediction is made as result set.
Example
CALL IDAX.PREDICT_KNN('model=customer_censor_mdl, intable=customer_churn, outtable=customer_censor_score');