> For the complete documentation index, see [llms.txt](https://docs.dbnl.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dbnl.com/v0.21.x/using-distributional/python-sdk/sdk-functions/run-config/create_run_config.md).

# create\_run\_config

<pre class="language-python"><code class="lang-python">dbnl.create_run_config(
    *,
    project: <a data-footnote-ref href="#user-content-fn-1">Project</a>,
    columns: list[dict[str, Any]],
    scalars: Optional[list[dict[str, Any]]] = None,
    description: Optional[str] = None,
    display_name: Optional[str] = None,
    row_id: Optional[list[str]] = None,
    components_dag: Optional[dict[str, list[str]]] = None,
) -> <a data-footnote-ref href="#user-content-fn-2">RunConfig</a>:
</code></pre>

## Parameters

<table><thead><tr><th width="230">Arguments</th><th>Description</th></tr></thead><tbody><tr><td><code>project</code></td><td>The <a href="/pages/vfXFauh5ZnUjluqFCP7i">Project</a> this RunConfig is associated with.</td></tr><tr><td><code>columns</code></td><td><p>A list of column schema specs for the uploaded data, required keys <code>name</code> and <code>type</code>, optional key <code>component</code>, <code>description</code> and <code>greater_is_better</code>.  <code>type</code> can be <code>int</code>, <code>float</code>, <code>category</code>, <code>boolean</code>, or <code>string</code>. <code>component</code> is a string that indicates the source of the data. e.g. "component" : "sentiment-classifier" or "component" : "fraud-predictor". Specified components must be present in the <code>components_dag</code> dictionary. <code>greater_is_better</code> is a boolean that indicates if larger values are better than smaller ones. False indicates smaller values are better. None indicates no preference.<br><br>Example:</p><p><code>columns=[{"name": "pred_proba", "type": "float", "component": "fraud-predictor"}, {"name": "decision", "type": "boolean", "component": "threshold-decision"}, {"name": "requests", "type": "string", "description": "curl request response msg"}]</code></p><p></p><p>See the <a href="#column-schema">column schema</a> section below for more information.</p></td></tr><tr><td><code>scalars</code></td><td>NOTE: <code>scalars</code> is available in SDK v0.0.15 and above.<br><br>A list of scalar schema specs for the uploaded data, required keys <code>name</code> and <code>type</code>, optional key <code>component</code>, <code>description</code> and <code>greater_is_better</code>. <code>type</code> can be <code>int</code>, <code>float</code>, <code>category</code>, <code>boolean</code>, or <code>string</code>. <code>component</code> is a string that indicates the source of the data. e.g. "component" : "sentiment-classifier" or "component" : "fraud-predictor". Specified components must be present in the <code>components_dag</code> dictionary. <code>greater_is_better</code> is a boolean that indicates if larger values are better than smaller ones. False indicates smaller values are better. None indicates no preference. An example RunConfig scalars: <code>scalars=[{"name": "accuracy", "type": "float", "component": "fraud-predictor"}, {"name": "error_type", "type": "category"}]</code><br><br>Scalar schema is identical to column schema.</td></tr><tr><td><code>description</code></td><td>An optional description of the RunConfig, defaults to <code>None</code>. Descriptions are limited to 255 characters.</td></tr><tr><td><code>display_name</code></td><td>An optional display name of the RunConfig, defaults to <code>None</code>. Display names do not have to be unique.</td></tr><tr><td><code>row_id</code></td><td>An optional list of the column names that can be used as unique identifiers, defaults to <code>None</code>.  </td></tr><tr><td><code>components_dag</code></td><td>An optional dictionary representing the direct acyclic graph (DAG) of the specified components, defaults to <code>None</code>. Every <code>component</code> listed in the <code>columns</code> schema must be present in the <code>components_dag</code>. Example: <code>components_dag={"fraud-predictor": ["threshold-decision"], 'threshold-decision': []}</code><br><br>See the <a href="#components-dag">components DAG</a> section below for more information.</td></tr></tbody></table>

### Column Schema

#### Column Names

Column names can only be alphanumeric characters and underscores.

#### Supported Types

The following type supported as `type` in column schema

<table><thead><tr><th width="284">type</th><th>Notes</th></tr></thead><tbody><tr><td><code>float</code></td><td></td></tr><tr><td><code>int</code></td><td></td></tr><tr><td><code>boolean</code></td><td></td></tr><tr><td><code>string</code></td><td>Any arbitrary string values. Raw string type columns do not produce any histogram or scatterplot on the web UI.</td></tr><tr><td><code>category</code></td><td>Equivalent of pandas <a href="https://pandas.pydata.org/docs/user_guide/categorical.html">categorical data type</a>. Currently only supports category of string values.</td></tr><tr><td><code>list</code></td><td>Currently only supports list of string values. List type columns do not produce any histogram or scatterplot on the web UI.</td></tr></tbody></table>

#### Components

The optional `component` key is for specifying the source of the data column in relationship to the AI/ML app subcomponents. Components are used in visualizing the [components DAG](#components-dag).

### Components DAG

<figure><img src="/files/KBy5Nrq5MVBI8hmSqXzs" alt=""><figcaption><p>An example components DAG</p></figcaption></figure>

The `components_dag` dictionary specifies the topological layout of the AI/ML app. For each key-value pair, the key represents the source component, and the value is a list of the leaf components. The following code snippet describes the DAG shown above.

```python
components_dags={
    "TweetSource": ["EntityExtractor", "SentimentClassifier"],
    "EntityExtractor": ["TradeRecommender"],
    "SentimentClassifier": ["TradeRecommender"],
    "TradeRecommender": [],
    "Global": [],
}
```

## Returns

<table><thead><tr><th width="219">Type</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/HIhELmSZ1QDDyatoPYAM">RunConfig</a></td><td>A new dbnl RunConfig</td></tr></tbody></table>

## Examples

### Basic Usage

```python
import dbnl
dbnl.login()


proj = dbnl.get_or_create_project(name="test_p1")
# create a new RunConfig
runcfg1 = dbnl.create_run_config(
    project=proj,
    columns=[
        {"name": "error_type", "type": "category"},
        {"name": "email", "type": "string", "description": "raw email text content from source"},
        {"name": "spam-pred", "type": "boolean"},
    ],
    display_name="Basic RunConfig for spam prediction",
)

```

### RunConfig with DAG

```python
import dbnl
dbnl.login()


proj = dbnl.get_or_create_project(name="test_p1")
# create a new RunConfig with DAG
runcfg1 = dbnl.create_run_config(
    project=proj,
    columns=[
        {"name": "error_type", "type": "category"},
        {"name": "email", "type": "string", "component": "data_source", "description": "raw email text content from source"},
        {"name": "spam-pred", "type": "boolean", "component": "spam_classifier"},
    ],
    display_name="Basic RunConfig for spam prediction",
    components_dag={
        "data_source": ["spam_classifier"]
        "spam_classifier": []
)
```

### RunConfig with row\_id

```python
import dbnl
dbnl.login()


proj = dbnl.get_or_create_project(name="test_p1")
# create a new RunConfig
runcfg1 = dbnl.create_run_config(
    project=proj,
    columns=[
        {"name": "error_type", "type": "category"},
        {"name": "email", "type": "string", "description": "raw email text content from source"},
        {"name": "spam-pred", "type": "boolean"},
        {"name": "email_id", "type": "string", "description": "unique id for each email"},
    ],
    display_name="Basic RunConfig for spam prediction",
    row_id=["email_id"],
)
```

RunConfig with scalars

```python
import dbnl
dbnl.login()


proj = dbnl.get_or_create_project(name="test_p1")
# create a new RunConfig
runcfg1 = dbnl.create_run_config(
    project=proj,
    columns=[
        {"name": "error_type", "type": "category"},
        {"name": "email", "type": "string", "description": "raw email text content from source"},
        {"name": "spam-pred", "type": "boolean"},
        {"name": "email_id", "type": "string", "description": "unique id for each email"},
    ],
    scalars=[
        {"name": "model_F1", "type": "float"},
        {"name": "model_recall", "type": "float"},
    ],
    display_name="Basic RunConfig for spam prediction",
)
```

[^1]: [Project](/v0.21.x/using-distributional/python-sdk/sdk-objects/project.md)

[^2]: [RunConfig](/v0.21.x/using-distributional/python-sdk/sdk-objects/runconfig.md)
