# Core Concepts

You do not need to be an expert in AI research to develop or deploy ML models. NatML focuses on making ML deployment as painless as possible for interactive media developers. Before jumping in, It is crucial to understand a few core concepts, and how they interact with one another:

## Models

An ML model is a 'black box' which consumes one or more input features and predicts one or more output features. For example, a vision classifier receives an image feature and produces a probability distribution feature, telling you how likely the image is one label or another.

{% hint style="info" %}
Under the hood, an ML model is a computation graph. This graph is what empowers ML models with the ability to learn and make predictions on new data.
{% endhint %}

{% hint style="success" %}
At NatML, we prefer to refer to ML models as **graphs**. It's pedantic, sure, but avoids any ambiguity.
{% endhint %}

### Edge Models

These are models that run predictions on the local device. They are exposed with the [`MLEdgeModel`](/unity/api/mlmodel/mledgemodel.md) class.

{% hint style="success" %}
NatML supports working with [CoreML](https://developer.apple.com/machine-learning/core-ml/) (`.mlmodel`), [ONNX](https://onnx.ai/) (`.onnx`), and [TensorFlow Lite](https://www.tensorflow.org/lite) (`.tflite`) edge graphs.
{% endhint %}

## Features

A feature is any data that can be consumed or produced by an [`MLModel`](/unity/api/mlmodel.md). For example, you will use a lot of image features when working with vision models. NatML has built-in support for common features that might be used with ML models, including `Texture2D` and `WebCamTexture` instances:

```csharp
// Some common features include:
float[] arrayFeature = ...;
Texture2D imageFeature = ...;
WebCamTexture webCamFeature = ...;
AudioClip audioFeature = ...;
```

Every [`MLFeature`](/unity/api/mlfeature.md) has a corresponding [`MLFeatureType`](/unity/api/mlfeaturetype.md). This type describes the feature and data that is contained within it. Similarly, every [`MLModel`](/unity/api/mlmodel.md) has a set of input and output feature types, describing what data the model can consume and produce, respectively.

## Predictors

Predictors are lightweight primitives that use one or more models to make predictions on features. They are self-contained units that know how to transform inputs into a format that a model expects. But more importantly, they are able to transform outputs of a model into a usable format. For example, you might have a predictor that uses the MobileNet ML model to classify images:

```csharp
// Create the MobileNet v2 predictor
var predictor = await MobileNetv2Predictor.Create(model);
```

Whereas a raw classification model outputs a probability distribution, the classification predictor can transform this distribution into a form which is much more usable by developers. It simply returns a class label (`string`) along with a classification score (`float`):

```csharp
var (label, confidence) = predictor.Predict(...);
Debug.Log($"Model predicted {label} with confidence {confidence}");
```

{% hint style="success" %}
You can create custom predictors for different models, share them on [NatML](https://hub.natml.ai)!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.natml.ai/unity/workflows/concepts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
