Back to Mindsdb

Describe a Model

docs/mindsdb_sql/sql/api/describe.mdx

26.1.09.8 KB
Original Source

Description

The DESCRIBE statement is used to display the attributes of an existing model.

The available options to describe a model depend on the underlying engine.

Syntax

Here is how to retrieve general information on the model:

sql
DESCRIBE model_name;

Or:

sql
DESCRIBE MODEL model_name;

This command is similar to the below command:

sql
SELECT *
FROM models
WHERE name = 'model_name';

One difference between these two commands is that DESCRIBE outputs an additional column that stores all available options to describe a model, depending on the underlying engine.

Examples

NLP Models

MindsDB offers NLP models that utilize either Hugging Face or OpenAI engines. Let's see how to describe such models.

sql
DESCRIBE [MODEL] sentiment_classifier;

On execution we get:

sql
+---------------------+----------------------+--------+---------+--------+---------+----------+----------+-----------+---------------+-----------------+--------+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+
| tables              | NAME                 | ENGINE | PROJECT | ACTIVE | VERSION | STATUS   | ACCURACY | PREDICT   | UPDATE_STATUS | MINDSDB_VERSION | ERROR  | SELECT_DATA_QUERY | TRAINING_OPTIONS                                                                                                                                                                                                                                                                                              | TAG    |
+---------------------+----------------------+--------+---------+--------+---------+----------+----------+-----------+---------------+-----------------+--------+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+
| ["args","metadata"] | sentiment_classifier | openai | mindsdb | true   | 1       | complete | [NULL]   | sentiment | up_to_date    | 23.1.3.2        | [NULL] | [NULL]            | {'target': 'sentiment', 'using': {'prompt_template': 'describe the sentiment of the reviews\n                     strictly as "positive", "neutral", or "negative".\n                     "I love the product":positive\n                     "It is a scam":negative\n                     "{{review}}.":'}} | [NULL] |
+---------------------+----------------------+--------+---------+--------+---------+----------+----------+-----------+---------------+-----------------+--------+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+

The tables output column lists all available options to describe a model.

<Tabs> <Tab title='DESCRIBE args'>
sql
DESCRIBE [MODEL] sentiment_classifier.args;

The above command returns the following output columns:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>key</code></td>
      <td>It stores parameters, such as `prompt_template` and `target`.</td>
    </tr>
    <tr>
      <td><code>value</code></td>
      <td>It stores parameter values.</td>
    </tr>
  </tbody>
</table>
</Tab> <Tab title='DESCRIBE metadata'>
sql
DESCRIBE [MODEL] sentiment_classifier.metadata;

The above command returns the following output columns:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>key</code></td>
      <td>It stores metadata parameters.</td>
    </tr>
    <tr>
      <td><code>value</code></td>
      <td>It stores parameter values.</td>
    </tr>
  </tbody>
</table>
</Tab> </Tabs>

Nixtla Models

MindsDB integrates Nixtla engines, such as StatsForecast, NeuralForecast, and HierarchicalForecast. Let's see how to describe models based on Nixtla engines.

sql
DESCRIBE [MODEL] quarterly_expenditure_forecaster;

On execution we get:

sql
+-----------------------------+----------------------------------+---------------+---------+--------+---------+----------+----------+-------------+---------------+-----------------+--------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+
| tables                      | NAME                             | ENGINE        | PROJECT | ACTIVE | VERSION | STATUS   | ACCURACY | PREDICT     | UPDATE_STATUS | MINDSDB_VERSION | ERROR  | SELECT_DATA_QUERY                     | TRAINING_OPTIONS                                                                                                                                    | TAG    |
+-----------------------------+----------------------------------+---------------+---------+--------+---------+----------+----------+-------------+---------------+-----------------+--------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+
| ["info","features","model"] | quarterly_expenditure_forecaster | statsforecast | mindsdb | true   | 1       | complete | [NULL]   | expenditure | up_to_date    | 23.4.4.0        | [NULL] | SELECT * FROM historical_expenditures | {'target': 'expenditure', 'using': {}, 'timeseries_settings': {'is_timeseries': True, 'order_by': 'month', 'horizon': 3, 'group_by': ['category']}} | [NULL] |
+-----------------------------+----------------------------------+---------------+---------+--------+---------+----------+----------+-------------+---------------+-----------------+--------+---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+

The tables output column lists all available options to describe a model.

<Tabs> <Tab title='DESCRIBE info'>
sql
DESCRIBE [MODEL] quarterly_expenditure_forecaster.info;

The above command returns the following output columns:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>accuracies</code></td>
      <td>It lists the chosen model name and its accuracy score.</td>
    </tr>
    <tr>
      <td><code>outputs</code></td>
      <td>The target column.</td>
    </tr>
    <tr>
      <td><code>inputs</code></td>
      <td>All the feature columns.</td>
    </tr>
  </tbody>
</table>
</Tab> <Tab title='DESCRIBE features'>
sql
DESCRIBE [MODEL] quarterly_expenditure_forecaster.features;

The above command returns the following output columns:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>ds</code></td>
      <td>It defines intervals between records. For example, here, we've got monthly expenditure records.</td>
    </tr>
    <tr>
      <td><code>y</code></td>
      <td>It stores the target column.</td>
    </tr>
    <tr>
      <td><code>unique_id</code></td>
      <td>It stores columns listed in the `GROUP BY` clause. It defines the column(s) in the dataset by which you can split it into multiple time series that track the same process or value for different entities or groups.</td>
    </tr>
  </tbody>
</table>
</Tab> <Tab title='DESCRIBE model'>
sql
DESCRIBE [MODEL] quarterly_expenditure_forecaster.model;

The above command returns the following output columns:

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>model_name</code></td>
      <td>It is the chosen model name.</td>
    </tr>
    <tr>
      <td><code>frequency</code></td>
      <td>It is the frequency</td>
    </tr>
    <tr>
      <td><code>season_length</code></td>
      <td>It indicates how many measurements until the next *season* occurs. For example, a time series with monthly measurements and a season length of 12 means that, every 12 months, a new *season* occurs. It can have a very strong effect on the final model’s performance.</td>
    </tr>
    <tr>
      <td><code>hierarchy</code></td>
      <td>It defines whether HierarchicalForecast is used (`true`) or not (`false`).</td>
    </tr>
  </tbody>
</table>
</Tab> </Tabs>

Other Models

Models that utlize LangChain or are brought to MindsDB via MLflow can be described as follows:

sql
DESCRIBE [MODEL] other_model;

The above command returs ["info"] in its first output column.

sql
DESCRIBE [MODEL] other_model.info;

The above command lists basic model information.

<Note> If you need more information on how to `DESCRIBE [MODEL]` or understand the results, feel free to ask us on the [community Slack workspace](https://mindsdb.com/joincommunity). </Note>