> For the complete documentation index, see [llms.txt](https://docs.natml.ai/js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.natml.ai/js/api/mlmodel.md).

# MLModel

abstract class MLModel

The `MLModel` class abstracts a self-contained machine learning model, containing a computation graph for making predictions along with feature type information and metadata.

{% hint style="info" %}
Models are created from [`MLModelData`](/js/api/mlmodeldata.md) instances.
{% endhint %}

NatML offers two types of models depending on where predictions are made:

* [`MLHubModel`](/js/api/mlmodel/mlhubmodel.md) which performs predictions in the Hub cloud.
* [`MLEdgeModel`](/js/api/mlmodel/mledgemodel.md) which performs predictions locally.

{% hint style="info" %}
Currently, the Node SDK only supports Hub models.
{% endhint %}

## Inspecting Feature Types

Models provide information about their expected input and output feature types. This type information is crucial for writing some model predictors.

### Input Features

```csharp
/**
 * Model input feature types.
 */
inputs: MLFeatureType[];
```

The model provides its expected input feature types. Typically, a predictor will handle any necessary conversions of your input feature so that it matches the type that the model expects.

{% hint style="info" %}
The `inputs` are reported in the same order that they are expected by the model when making predictions.
{% endhint %}

{% hint style="warning" %}
[`MLHubModel`](/js/api/mlmodel/mlhubmodel.md) instances do not report any `inputs`.
{% endhint %}

### Output Features

```csharp
/**
 * Model output feature types.
 */
outputs: MLFeatureType[];
```

The model provides its output feature types. This information is crucial in order to convert the model's raw outputs into more usable forms by predictors.

{% hint style="info" %}
The `outputs` are reported in the same order that they are produced by the model when making predictions.
{% endhint %}

{% hint style="warning" %}
[`MLHubModel`](/js/api/mlmodel/mlhubmodel.md) instances to not report any `outputs`.
{% endhint %}

## Inspecting Metadata

```csharp
/**
 * Model metadata dictionary.
 */
metadata: { [key: string]: string };
```

Models expose metadata that was defined when they were created.

{% hint style="warning" %}
[`MLHubModel`](/js/api/mlmodel/mlhubmodel.md) instances to not report any `metadata`.
{% endhint %}

## Disposing the Model

```csharp
/**
 * Dispose the model and release resources.
 */
dispose (): void;
```

Models create native and/or server resources. As a result, you must dispose of the model once you are done using it.

{% hint style="danger" %}
Do not use a model once it has been disposed. Doing so will lead to undefined behaviour.
{% endhint %}
