<div class="section-label"><span class="num">02</span> Grid Prediction</div> <div class="section-title">The primary form of <em>RBP</em> analysis.</div> Evaluates combinations of predictive attributes across relevance and similarity thresholds, then forms a fit-weighted composite prediction for circumstances <span class="mono">theta</span>. Also returns variable-level **Impact on Fit** and **Impact on Prediction**. Recommended default path for analysis. Same input shapes as [[Predict]]. ## Signature ```text predict_grid( y, # outcomes, length N X, # attributes, N × K theta, # circumstances, length K options? # GridOptions; omit → defaults ) → results ``` **Call:** `predict_grid` **Options:** `GridOptions` (PredictOptions base + Grid fields) **Returns:** [[Results/Overview|Results]] (composite; typically T = 1) ## Arguments | Name | Shape | Description | | --- | --- | --- | | <span class="mono">y</span> | N | Observed outcomes | | <span class="mono">X</span> | N × K | Training attributes aligned with <span class="mono">y</span> | | <span class="mono">theta</span> | K | Circumstances for the prediction task | | <span class="mono">options</span> | (object) | <span class="mono">GridOptions</span>; optional, omit for defaults | N = number of observations (rows), K = number of independent variables (columns). ## Options Omit <span class="mono">options</span> to use Grid defaults. Full field list: [[Config/Options#GridOptions|GridOptions]]. Allowed value names: [[Config/Allowed Values|Allowed values]]. ### Grid fields | Name | Type / values | Default | Description | | --- | --- | --- | --- | | <span class="mono">max_iter</span> | integer > 0 | <span class="mono">1000</span> | Cap on combination search iterations | | <span class="mono">k</span> | integer > 0 | <span class="mono">1</span> | Combination size / sampling parameter | | <span class="mono">seed</span> | unsigned integer | <span class="mono">42</span> | RNG seed for combination sampling | | <span class="mono">attribute_combi</span> | matrix Q × K | generated | Fixed combination matrix; omit to sample | | <span class="mono">retain_grid_objects</span> | omit \| comma-separated keys | omit (lean) | Which per-cell objects to keep | | <span class="mono">inner_parallel</span> | <span class="mono">auto</span> \| <span class="mono">off</span> | <span class="mono">auto</span> | Parallel over combinations | ### Retain keys <span class="mono">yhat_cells</span>, <span class="mono">adjusted_fit_cells</span>, <span class="mono">n_cells</span>, <span class="mono">weights_cells</span>, <span class="mono">k_cells</span>, <span class="mono">combi_cells</span>, <span class="mono">ysolo_distribution</span> Name only the keys you need. Descriptions and shapes: [[Config/Options#Retain grid objects|Retain grid objects]] · [[Results/Grid Cells|Grid Cells]]. ### Shared base (inherited) Includes <span class="mono">threshold</span>, <span class="mono">censor_type</span>, <span class="mono">censor_unit</span>, <span class="mono">censor_operator</span>, <span class="mono">prediction_scale</span>, <span class="mono">adj_fit_multiplier</span>, <span class="mono">inv_method</span>, and flags. See [[Config/Options#PredictOptions|PredictOptions]] and [[Config/Options#GridOptions|GridOptions]]. | Notable Grid defaults | Value | | --- | --- | | <span class="mono">threshold</span> | <span class="mono">[0, 0.2, 0.5, 0.8]</span> | | <span class="mono">censor_type</span> | <span class="mono">both</span> | ## Results Composite handle. Typically T = 1. Full field map: [[Results/Overview|Results]]. | Present | Fields | Detail | | --- | --- | --- | | Always (success) | Root core: <span class="mono">yhat</span>, <span class="mono">fit</span>, <span class="mono">adjusted_fit</span>, … | [[Results/Core\|Core]]. Scalar forecast: <span class="mono">float(result.yhat[0])</span> (Python) | | Usual (retain off) | <span class="mono">grid_insights</span>: **Impact on Fit**, **Impact on Prediction**, … | [[Results/Grid Insights\|Grid Insights]] | | If retain set | <span class="mono">grid_cells</span> (plus solo histogram if <span class="mono">ysolo_distribution</span> retained) | [[Results/Grid Cells\|Grid Cells]] | <span class="mono">prediction_weights</span>, <span class="mono">auxiliary</span>, and <span class="mono">solo_distribution</span> are often empty on the Grid composite compared with [[Predict]]. <div class="btn-row"> <a class="btn-primary" href="/Results/Grid%20Insights">Grid Insights</a> <a class="btn-ghost" href="/Config/Options#GridOptions">GridOptions</a> </div> ## Notes - **Fit-weighted composite.** Cells are Predict-style evaluations on attribute subsets × thresholds. The composite weights cells by fit so more reliable calibrations pull harder. - **Variable impact.** Impact on Fit and Impact on Prediction are task-specific total-importance measures (not only marginal effects). Prefer those names in analysis; technical aliases (MCTC / MCTP) are documented under [[Results/Grid Insights|Grid Insights]]. - **Retain is optional.** Insights above do not require retain. Set <span class="mono">retain_grid_objects</span> only when you need specific cell-level tables. - **Building blocks.** Fixed attributes and thresholds → [[Predict]]. Threshold search on one attribute set → [[MaxFit]]. Primary analysis → this page. ## Related - [[Functions/Overview|Functions]] - [[Predict]] · [[MaxFit]] - [[Config/Options#GridOptions|GridOptions]] · [[Results/Overview|Results]]