<div class="section-label"><span class="num">04</span> MaxFit</div> <div class="section-title">Solve for the strongest <em>fit</em>.</div> MaxFit solves for the strongest prediction on a **fixed** set of attributes. It searches candidate thresholds and returns the single winner on your objective: fit, adjusted fit, or k-fit (the default). It is a useful building block when you want that maximum on one attribute set, without a full combination grid. For primary analysis, prefer [[Grid Prediction]], which diversifies across attribute combinations *and* thresholds, then blends by fit. Takes the same inputs as the other prediction calls: outcomes <span class="mono">y</span>, attributes <span class="mono">X</span>, and circumstances <span class="mono">theta</span>. ## Signature ```text predict_maxfit( y, # outcomes, length N X, # attributes, N × K theta, # circumstances, length K options? # MaxFitOptions; omit → defaults ) → results ``` **Call:** `predict_maxfit` **Options:** `MaxFitOptions` (PredictOptions base + MaxFit-specific options) **Returns:** [[Results/Overview|Results]] (winning threshold; 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">MaxFitOptions</span>; optional, omit for defaults | N = number of observations (rows), K = number of independent variables (columns). ## Options A MaxFit call is ready with defaults: <span class="mono">threshold</span> <span class="mono">[0, 0.2, 0.5, 0.8]</span> and <span class="mono">censor_type</span> <span class="mono">both</span>. Pass a [[Settings/Options#MaxFitOptions|MaxFitOptions]] object when you want to change those, or any of the MaxFit-specific settings below. MaxFitOptions extends PredictOptions. Inherited fields and the full parameter list live on that page. Allowed value names: [[Settings/Allowed Values|Allowed values]]. | Name | Type / values | Default | Description | | --- | --- | --- | --- | | <span class="mono">objective</span> | <span class="mono">fit</span> \| <span class="mono">adjusted_fit</span> \| <span class="mono">kfit</span> | <span class="mono">kfit</span> | Score used to pick the winning threshold | | <span class="mono">inner_parallel</span> | <span class="mono">auto</span> \| <span class="mono">off</span> | <span class="mono">auto</span> | Parallel when searching both censor types | ## Results A successful MaxFit call gives you one winning forecast for this task — the threshold (and censor type) that scored best on your objective — with fit alongside it. | You get | Look here | | --- | --- | | Winning forecast and fit | <span class="mono">yhat</span>, <span class="mono">fit</span>, <span class="mono">adjusted_fit</span>, … — [[Results/Core\|Core]] | | Which candidate won | <span class="mono">maxfit_index</span> (when present) — [[Results/Overview\|Results]] | | Weights and scores | <span class="mono">prediction_weights</span>, <span class="mono">insights</span> — [[Results/Weights & Insights\|Weights & Insights]] | The full layout of a result object: [[Results/Overview|Results]]. ## Related - [[Functions/Overview|Functions]] - [[Grid Prediction]] · [[Predict]] - [[Settings/Options#MaxFitOptions|MaxFitOptions]] · [[Results/Overview|Results]]