Skip to content

Latest commit

 

History

History
60 lines (50 loc) · 1.63 KB

File metadata and controls

60 lines (50 loc) · 1.63 KB
title Get a Single Prediction
openapi POST /api/projects/{projectName}/models/{modelName}/predict
sidebarTitle Get a Single Prediction
curl --request POST \
  --url http://127.0.0.1:47334/api/projects/mindsdb/models/home_rentals_model/predict \
  --header 'Content-Type: application/json' \
  --data '{
    "data": [
      {
        "sqft": "823",
        "location": "good",
        "neighborhood": "downtown",
        "days_on_market": "10"
      }
    ]
  }'
[
    {
        "__mindsdb_row_id": null,
        "days_on_market": null,
        "location": null,
        "neighborhood": null,
        "number_of_bathrooms": null,
        "number_of_rooms": null,
        "rental_price": 2847,
        "rental_price_anomaly": null,
        "rental_price_confidence": 0.99,
        "rental_price_explain": "{\"predicted_value\": 2847, \"confidence\": 0.99, \"anomaly\": null, \"truth\": null, \"confidence_lower_bound\": 2730, \"confidence_upper_bound\": 2964}",
        "rental_price_max": 2964,
        "rental_price_min": 2730,
        "rental_price_original": null,
        "select_data_query": null,
        "sqft": 823,
        "when_data": null
    }
]

The REST API endpoints can be used with MindsDB running locally at http://127.0.0.1:47334/api.

Note that data sent in the request is specific to the model. For instance, the home_rentals_model has been trained on data that includes details of rental properties, and we want to predict the rental_price value for a specific property that matches data passed in the request.