> For the complete documentation index, see [llms.txt](https://jmu-isgroup.gitbook.io/anomalydetection.ml/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jmu-isgroup.gitbook.io/anomalydetection.ml/installation-and-use/3.-deployment-and-usage/3.1-inference.md).

# 3.1 Inference

Online-Inference via API

Inference on the ML models is possible via the `/predict` endpoint of the container. To use it, the ML models first need to be trained (see [2.1 Model Training](/anomalydetection.ml/installation-and-use/2.-installation-and-usage/2.1-model-training.md) for details ).&#x20;

The  `/predict` endpoint uses the same API definition as defined for the training data ( see `restdef.py`).

Given a single transaction as json input, the endpoint uses two ML models to detect anomalies in the given data. The prediction then is transformed into the result schema of the `/predict` endpoint.&#x20;

<pre class="language-python"><code class="lang-python"><strong>#response Model 
</strong>class Decision(BaseModel):
    transactionid: str
    prediction:  float
    probability: float
    confidence:  float
    prediction2:  float
    probability2: float
    confidence2:  float
</code></pre>
