# Principal Component Analysis (DP\_PCA)

Linear dimensionality reduction using Singular Value Decomposition of the data to project it to a lower dimensional space. The input data is centered but not scaled for each feature before applying the SVD

## Sample Request

<pre class="language-javascript"><code class="lang-javascript">{
    "project_id": 41,
    "block_id": 10,
    "parent_id": 9,
    "function_code": "DP_PCA",
    "args": {
<strong>        "n_components": 3,
</strong><strong>        "dataset": false,
</strong>        "xtrain": true,
        "xtest": true,
        "x": true,
        "ytrain": false,
        "ytest": false,
        "y": false
    }
}
</code></pre>

## Parameter Details

## Principal Component Analysis

<mark style="color:green;">`POST`</mark> `https://autogon.ai/api/v1/engine/start`

#### Request Body

| Name                                             | Type   | Description                                                                                                                                          |
| ------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| project\_id<mark style="color:red;">\*</mark>    | int    | current project ID                                                                                                                                   |
| parent\_id<mark style="color:red;">\*</mark>     | int    | parent block ID                                                                                                                                      |
| block\_id<mark style="color:red;">\*</mark>      | int    | current block ID                                                                                                                                     |
| function\_code<mark style="color:red;">\*</mark> | String | block's function code                                                                                                                                |
| args<mark style="color:red;">\*</mark>           | object | block arguments                                                                                                                                      |
| n\_components                                    | float  | <p>int, float or 'mle'</p><p></p><p>Number of components to keep. If n\_components is not set, all components are kept<br><br>Defaults to 'null'</p> |
| dataset/x/y/xtrain/ytrain/xtest/ytest            | bool   | variables to apply function                                                                                                                          |

{% tabs %}
{% tab title="200: OK Data Encode Successful" %}

```javascript
{
    "status": "true",
    "message": {
        "id": 3,
        "project": 1,
        "block_id": 7,
        "parent_id": 6,
        "dataset_url": "",
        "x_value_url": "",
        "y_value_url": ""
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Python" %}

```
// Some code
```

{% endtab %}

{% tab title="Node" %}

```
projectId = 1
parentId = 6
blockId = 7

client.array_reshaping(projectId, parentId, blockId, {

```

{% endtab %}
{% endtabs %}
