Skip to main content

Create Predictions

Once model training is completed, PayrollDetect is ready to generate predictions.

Batch vs. Real-Time Predictions

Batch predictions: For processing larger datasets, create batch predictions via POST /create_prediction with the data you want predictions for. To get the results, you have to call the GET /results endpoint after the prediction job has finished.

Real-time predictions: For quick, real-time predictions on smaller datasets, execute the POST /real_time_prediction endpoint. This is ideal for individual or small batches of data where immediate results are needed. This endpoint does not require you to call the GET /results endpoint afterwards.

Create predictions

Data consistency

To correctly identify anomalies, it is crucial that data is submitted with consistent form across training (upload) and predicitons (e.g., consistent level of aggregation, similar SubTypes and handling of missing/null-values).

More on this and examples in Core Concepts.

To create predictions, follow these steps:

  1. Execute POST /create_prediction or POST /real_time_prediction for real-time predictions, with a list of Dataset IDs. A Job ID will be returned (results returned directly for real-time predictions)

For (batch) POST /create_prediction only:

  1. Use GET /status with the Job ID until a 200 status with "success" is returned, or use webhooks.
Create prediction schema
required
Array of objects (Prediction Dataset) non-empty

Prediction datasets for which predictions should be made.

object

Details for the webhook endpoint to call when a job finishes.

{
  • "datasets": [
    ],
  • "webhook": {}
}

Starting a prediction job via a Presigned-URL

This method allows initiating prediction jobs through a presigned-url, enabling larger payloads.

  1. Obtain the Presigned URL and Job ID: Make a GET request to the /presigned_url with the query string parameter type=prediction . You will receive a URL for the prediction-job and a related Job ID.
GET /presigned_url
curl -X GET "https://api.machine-learning-factory.stage.visma.com/pd/presigned_url?type=prediction" \
-H "Authorization: Bearer YOUR ACCESS TOKEN" \
-H "tenantId: YOUR_TENANT_ID"

Remove .stage from base url for production environment.

  1. Trigger the Prediction Job: Use the PUT request on the received URL, following the specified schema for predictions. This action will start the prediction job using the Job ID you received.

  2. Check the Job Status: Monitor the status of the job using GET /status with your Job ID.