Icon

03_​Fraud_​Detection_​Row_​And_​Variable_​Input

Fraud Detection: Row and Variable Input

This workflow showcases how the Container Input (Row), Container Input (Variable) and Container Output (JSON) nodes can be used to create a REST API for a workflow that can then be deployed as inference workflow to KNIME Edge. The workflow can be called via REST and classifies a transaction as fraudulent or not fraudulent. In addition to the transaction data, the prediction threshold can be specified in the input.

First, the workflow applies some pre-processing by normalizing the data. Then, it reads in an already trained model and applies it to the input data. A custom prediction threshold is applied with a Rule Engine node to get the final prediction (true for fraud, false for not fraud). Last, the post-processing step brings the output in the correct shape for the response.

When deployed to KNIME Edge, a POST request with the following JSON body can be used for testing:

{
"row-input": {
"V1": -1.65977253845451,
"V2": 1.28590703928839,
"V3": -3.34963337176211,
"V4": 2.05070755935895,
"Amount": 5.49
},
"prediction-threshold": 0.3
}


If setting the prediction threshold to 0.3, the response will be:

{
"Prediction": true
}

If setting the prediction threshold to 0.4, the response will be:

{
"Prediction": false
}

Prediction/Inferencing REST API REST Response REST API for Fraud DetectionThis workflow showcases how the Container Input (Row), Container Input (Variable) andContainer Output (JSON) nodes can be used to create a REST API for a workflow thatcan then be deployed as inference workflow to KNIME Edge. The workflow can be calledvia REST and classifies a transaction as fraudulent or not fraudulent. In addition to thetransaction data, the prediction threshold can be specified in the input.See the workflow description for example requests and responses. Output predictionP(Class=1)>threshold => trueP(Class=1)<=threshold => falseRead RF ModelInput transaction dataInput prediction threshold ContainerOutput (Row) Random ForestPredictor Rule Engine Model Reader ContainerInput (Row) Container Input(Variable) Preprocessing Postprocessing Prediction/Inferencing REST API REST Response REST API for Fraud DetectionThis workflow showcases how the Container Input (Row), Container Input (Variable) andContainer Output (JSON) nodes can be used to create a REST API for a workflow thatcan then be deployed as inference workflow to KNIME Edge. The workflow can be calledvia REST and classifies a transaction as fraudulent or not fraudulent. In addition to thetransaction data, the prediction threshold can be specified in the input.See the workflow description for example requests and responses. Output predictionP(Class=1)>threshold => trueP(Class=1)<=threshold => falseRead RF ModelInput transaction dataInput prediction threshold ContainerOutput (Row) Random ForestPredictor Rule Engine Model Reader ContainerInput (Row) Container Input(Variable) Preprocessing Postprocessing

Nodes

Extensions

Links