---
title: Feature Constraints
description: Describes the settings available from the Feature Constraints advanced option tab, where you can control the influence, both up and down, between variables and the target.

---


# Feature Constraints {: #feature-constraints }

The **Feature Constraints** tab provides the tools described in the table below for applying constraints. Once you have completed the desired fields and built models, use the [**Describe > Constraints**](monotonic) Leaderboard tab to evaluate results of models trained with constraints.

Constraint   |   Description  
-------------|----------------
[Monotonicity](#monotonicity) | Controls the influence, both up and down, between variables and the target.
[Aggregate target class](#aggregate-target-classes) | Configures how classes are aggregated for multiclass modeling.
[Trim target labels](#trim-target-labels) | Configures how labels are trimmed for multilabel modeling.
[Pairwise Interactions](#pairwise-interactions) | Controls which pairwise interactions are included in Generalized Additive Model (GA2M) output. (_Not available for unsupervised or time series projects_.)

## Monotonicity {: #monotonicity }

[Monotonicity](monotonic) forces a directional relationship between features and the target. Use this tab to apply monotonic [feature lists](monotonic#create-feature-lists), choose models, and make a positive class assignment.

![](images/feature-con-1.png)

### Monotonic Increasing / Decreasing {: #monotonic-increasing-decreasing }

**Monotonic Increasing** and **Monotonic Decreasing** set the feature lists you want DataRobot to apply to ensure monotonic modeling. From the dropdowns, select a list to use to enforce monotonically increasing and/or decreasing constraints. Remember that these apply on top of the selected model building feature list.

Note that this option is only available if the project has a numeric-only feature list defined. You can [create an appropriate feature list](feature-lists#create-feature-lists-from-the-data-page) prior to modeling. You can also create feature lists and retrain models, from the Leaderboard menu, after the initial model run.

The following options are available:

Feature list   |   Description  
------------------|----------------
No Constraints   | When this option is selected, DataRobot applies no monotonic constraints during training.  
[Raw Features](feature-lists#automatically-created-feature-lists)  | This option is only available when all features in the Raw Features list are of the type numeric, percentage, length, and/or currency.
[Informative Features](feature-lists#automatically-created-feature-lists)  | This option is only available when all features in the Informative Features list are of the type numeric, percentage, length, and/or currency.
[User-defined feature list(s)](monotonic#create-feature-lists) | All lists that you defined for the project that meet the variable type requirement.

### Include only monotonic models {: include-only-monotonic-models }

When selected, DataRobot will only build (via Autopilot) or make available via the Repository those models that support monotonic constraints. Additionally, Autopilot only creates the [AVG Blender](leaderboard-ref#blender-models).

### Positive Class Assignment {: #positive-class-assignment }

The **Positive Class Assignment** option is available for binary classification projects only. It sets the class to use when a prediction scores higher than the classification threshold. When applying monotonic constraints, DataRobot applies the constraint between the value of the predictor and the probability of positive class.

By default, DataRobot sorts alphanumerically and then assigns the second value as the positive class. For example, if you load a dataset with a target of {`1`,`0`} or {`Yes`, `No`}, or {`True`, `False`}, the positive class in each case, after alphanumeric sorting, is `1`, `Yes`, and `True`, respectively.

## Aggregate / trim {: #aggregate-trim }

You can configure how DataRobot manages support for projects with many classes or labels. Use the appropriate toggle, which will appear depending on your project type:

*  **Aggregate target classes** manages classes for [multiclass](multiclass) projects.

* **Trim target labels** manages labels for [multilabel](multilabel) projects.


### Aggregate target classes {: #aggregate-target-classes }

To configure aggregation settings, scroll to **Aggregate target classes**.

![](images/unlimited-multi-1000-2.png)

The following table describes each field:

|  | Element | Description |
|---|---|---|
| ![](images/icon-1.png) | Aggregate target classes | Enables the aggregation functionality. When more than 1,000 classes are detected, the selection is on and cannot be changed. If fewer than 1,000 classes, the selection is off by default but can be enabled.|
| ![](images/icon-2.png) | Name of aggregation class | Sets the name of the "other" bin&mdash;the bin containing all classes that do not fall within the configuration set for this aggregation plan. It represents all the rows for the excluded values in the dataset. The provided name must differ from all existing target values in the column.|
| ![](images/icon-3.png) | Min frequency for non-aggregate classes | Sets the minimum occurrence of rows belonging to a class that is required to avoid being bucketed in the "other" bin. That is, classes with fewer instances will be collapsed into a class. |
| ![](images/icon-4.png) | Max number of non-aggregate classes | Sets the final number of classes after aggregation. The last class being the "other" bin. (For example, if you enter 900, there will be 899 class bins from your data and 1 "other" bin of aggregated classes.) Enter a value between 3-1,000.
| ![](images/icon-5.png) | Classes to be excluded from aggregation | Identifies a comma-separated list of classes that will be preserved from aggregation, ensuring the ability to predict on less frequent classes that are of interest.|

#### Aggregation example {: #aggregation-example }

A dataset has the following parameters of the target column, with 8 unique values (classes).

Class | Row count
----- | ---------
A | 1024
B | 512
C  | 256
D | 128
E | 64
F | 32
G | 16
H | 8

The parameters are set as follows:

Parameter | Value
--------- | -----
Name of aggregation class | DR_RARE_TARGET_VALUES
Min frequency for non-aggregate classes | 50
Max number of non-aggregate classes | 5
Classes to be excluded from aggregation | [E, H]

Class mapping initially applies the minimum frequency requirement, as follows:

Class | Row count | Impact
----- | --------- | --------
A | 1024 | None, above minimum frequency
B | 512 | None, above minimum frequency
C  | 256 | None, above minimum frequency
D | 128 | None, above minimum frequency
E | 64 | None, above minimum frequency
Other bin | 48 | Combined rows of F and G above; did not meet minimum frequency
H | 8 | Excluded from aggregation

So far, the class mapping has resulted in 7 unique values (F and G dropped and replaced with an aggregated class). The "Max number of classes" parameter sets the maximum to five, requiring two more "drops." DataRobot will next drop the least frequent that are not excluded from aggregation (E and H are excluded) and so drops C and D. As a result, the final target class values distribution will be:

* Classes A and B are most frequent.
* Classes E and H are excluded from aggregation.
* Classes C, D, F, and G are aggregated into a single class, DR_RARE_TARGET_VALUES.

The final five classes for modeling are:

Class | Row count
----- | ---------
A | 1024
B | 512
Aggregated classes (C, D, Other)  | 256 + 128 + 48
E | 64
H | 8


??? tip "Response time when making predictions"
    When using unlimited multiclass, it is best to use a smaller "chunk" size when making predictions because response time grows linearly with the number of classes and number of rows in a prediction dataset.

    Each class prediction can generate up to 10 digits to the right of the decimal point (`0.xxxxxxxxxx`). This can result, for each row, in 13-bytes per class. So, for example, a single dataset prediction for a 1,000-class multiclass for 10,000 rows can yield `13B * 1,000 classes * 10,000 rows` or roughly a 130MB response.

### Trim target labels {: #trim-target-labels }

To configure the labels used for multilabel modeling, scroll to **Trim target labels**.

![](images/feature-con-2.png)

The following table describes each field:

|  | Element | Description |
|---|---|---|
| ![](images/icon-1.png) | Trim target labels | Enables the trimming functionality. When more than 1,000 labels are detected, the selection is on and cannot be changed. If fewer than 1,000 labels, the selection is off by default but can be enabled.|
| ![](images/icon-2.png) | Frequency minimum | Sets the minimum occurrence of rows containing this label that is required to avoid being removed. That is, labels with fewer instances will be trimmed (unless specified as a protected label). |
| ![](images/icon-3.png) | Maximum labels | Sets the final number of labels after trimming. Enter a value between 2-1,000.
| ![](images/icon-4.png) | Protected labels | Identifies a comma-separated list of labels that will be preserved from trimming, regardless of frequency. This ensures the ability to predict on less frequent labels that are of interest.|

## Pairwise Interactions {: #pairwise-interactions }

Use this setting to control which interactions are permitted to interact during the training of a [GA2M](ga2m) model. The setting is often applied in cases where there are certain features that are not permitted to interact due to regulatory constraints.

{% include 'includes/pairwise-warning.md' %}

![](images/feature-con-3.png)

You must provide a CSV file that specifies the pairwise interactions you want to include. Click the **File Requirements** link for more information about the limitations and format needed for the CSV. The pop-up modal includes an example showing how to structure your CSV in a case that specifies two allowed pairwise interaction groups.

![](images/pairwise-3.png)

Apply the required formatting and limitations to the CSV, and then click **Browse**  to upload it (or drag and drop). DataRobot begins validating the CSV to ensure it matches the file requirements, and indicates any formatting errors with a message:

![](images/pairwise-4.png)

After successful CSV upload, you can begin training GA2M models. When the models are built, examine their output in the [**Rating Tables**](rating-table) tab. The output indicates the pairwise interactions that you specified.