<div class="section-label"><span class="num">01</span> Grid</div> <div class="section-title">The primary hosted <em>analysis</em> path.</div> `POST /grid` runs MaxFit-style searches across combinations of attributes, over relevance and similarity censors, then returns an adjusted-fit weighted composite. That is the hosted counterpart of [[Functions/Grid Prediction|Grid Prediction]]. Use Grid when you want a robust forecast without picking one attribute set by hand. **Call:** `POST /grid` **Auth:** `x-api-key` header + `access_id` in the body **Returns:** [[API/Prediction Engine/Results#Task receipt|task receipt]] — then [[API/Prediction Engine/Results|GET /results]] ## Signature ```http POST https://api.csanalytics.io/v2/prediction-engine/grid ``` Required JSON body (basic spec): ```text { access_id, # user access id y, # outcomes, N × 1 X, # attributes, N × K theta # circumstances, 1 × K } ``` N = observations, K = independent variables. Arrays are two-dimensional: [[API/Getting Started/Arrays|Arrays]]. ## Quick start The basic spec is enough to post a job. Omit options and the service uses its defaults. The operation below is loaded live from the v2 OpenAPI spec. ```openapi spec: basic path: /grid method: post ``` ```python import json import requests url = "https://api.csanalytics.io/v2/prediction-engine/grid" payload = { "access_id": "CSA_ACCESS_ID", "y": [[18.8], [2.3], [3.0], [6.7], [15.2], [20.9], [4.0]], "X": [ [25.0, 2.0, 76.0, 53.7, 23.1], [29.0, 1.0, 78.0, 39.1, 5.7], [32.0, 2.0, 77.0, 54.1, 5.3], [30.0, 5.0, 82.0, 68.7, 8.7], [24.0, 1.0, 69.0, 51.0, 20.3], [25.0, 2.0, 79.0, 50.2, 20.0], [35.0, 3.0, 80.0, 51.5, 9.4], ], "theta": [[24.0, 5.0, 81.0, 60.0, 11.0]], } headers = { "x-api-key": "CSA_API_KEY", "Content-Type": "application/json", "Connection": "keep-alive", } response = requests.post(url, headers=headers, data=json.dumps(payload)) ``` A 200 response is the task receipt, not the forecast: ```json { "job_id": 1074, "job_code": "66cfc21f7effa501" } ``` ## Custom settings The extended spec adds PSR options, MaxFit thresholds, and Grid-only combination controls. Pass only what you want to change. ```openapi spec: extended path: /grid method: post ``` ```python payload = { "access_id": "CSA_ACCESS_ID", "y": [...], "X": [...], "theta": [[24.0, 5.0, 81.0, 60.0, 11.0]], "threshold": [0, 0.20, 0.50, 0.80], "is_threshold_percent": True, "most_eval": True, "eval_type": "both", "attribute_combi": None, "k": 1, } ``` > [!note] > v2 uses <span class="mono">eval_type</span>, <span class="mono">is_threshold_percent</span>, and <span class="mono">most_eval</span>. The local engine’s [[Settings/Options#GridOptions|GridOptions]] names these <span class="mono">censor_type</span>, <span class="mono">censor_unit</span>, and <span class="mono">censor_operator</span>. ## Results After the job completes, [[API/Prediction Engine/Results|GET /results]] returns the composite forecast, fit, and Grid insights such as **Impact on Fit** and **Impact on Prediction**. Conceptual layout of those measures: [[Results/Grid Insights|Grid Insights]]. For categorical analysis, post to `/grid/binary` instead: [[API/Prediction Engine/Binary|Binary]]. ## Related - [[API/Introduction|API]] - [[API/Prediction Engine/MaxFit|MaxFit]] · [[API/Prediction Engine/PSR|PSR]] - [[API/Prediction Engine/Results|Results]] · [[Functions/Grid Prediction|Grid Prediction (local)]] <div class="btn-row center"> <a class="btn-primary" href="/API/Prediction%20Engine/Results">Retrieve results</a> <a class="btn-ghost" href="/API/Prediction%20Engine/MaxFit">MaxFit</a> </div>