{
  "slug": "stepwise-feature-selection",
  "name": "gizza-ai/stepwise-feature-selection",
  "version": "0.1.0",
  "title": "Stepwise Feature Selection — Pick Regression Predictors by AIC or BIC — gizza.ai",
  "description": "Run forward, backward, or bidirectional stepwise OLS regression on a numeric table to choose predictors by AIC, BIC, AICc, or p-value thresholds.",
  "tags": [
    "stepwise regression",
    "feature selection",
    "aic",
    "bic",
    "ols",
    "regression",
    "predictor selection",
    "statistics",
    "model selection"
  ],
  "category": "data",
  "urls": {
    "page": "https://gizza.ai/tools/stepwise-feature-selection/",
    "markdown": "https://gizza.ai/tools/stepwise-feature-selection/index.md",
    "descriptor": "https://gizza.ai/tools/stepwise-feature-selection/tool.json",
    "deep_link_example": "https://gizza.ai/tools/stepwise-feature-selection/?data=1%2C5%2C5.19%0A2%2C3%2C7.61%0A3%2C8%2C11.29%0A4%2C1%2C13.85&target=last%2C%20first%2C%20sales%2C%20or%204&direction=both&criterion=aic&alpha_enter=0.05&alpha_remove=0.10&force=ads%2C%202&labels=ads%2Cprice%2Ctemp%2Csales&header=true&decimals=4"
  },
  "cli": "gizza tool stepwise-feature-selection \"1,5,5.19\n2,3,7.61\n3,8,11.29\n4,1,13.85\"",
  "tool": {
    "description": "Run forward, backward or bidirectional stepwise ordinary-least-squares regression over a pasted numeric table to work out which predictor columns actually explain the target. One column is the target (target: 'last' default, 'first', a 1-based index, or a name from a header row or labels) and every other column is a candidate predictor; predictors are added or removed one at a time until no single move improves the chosen criterion. Pick direction='forward' (add only), 'backward' (drop only) or 'both' (default, bidirectional) and criterion='aic' (default), 'bic', 'aicc' or 'pvalue' (which uses the alpha_enter / alpha_remove thresholds instead). Use force to pin predictors into every candidate model. Returns the step-by-step selection path with the criterion after each move, the selected model's fitted equation and coefficient table (estimate, standard error, t, p), its R², adjusted R², RMSE, AIC/BIC/AICc and overall F-test, the list of dropped predictors, and an intercept-only vs selected vs all-predictors comparison. Accepts up to 20000 rows and 60 columns; exactly collinear subsets are skipped rather than failing. Runs locally.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "alpha_enter": {
          "default": 0.05,
          "description": "p-value a candidate must beat to ENTER the model when criterion='pvalue' (default 0.05). Ignored by the aic/bic/aicc criteria.",
          "maximum": 0.9999,
          "minimum": 0.0001,
          "type": "number"
        },
        "alpha_remove": {
          "default": 0.1,
          "description": "p-value above which a term is REMOVED from the model when criterion='pvalue' (default 0.1). Must be at least alpha_enter, otherwise a predictor would be dropped the moment it enters. Ignored by the aic/bic/aicc criteria.",
          "maximum": 0.9999,
          "minimum": 0.0001,
          "type": "number"
        },
        "criterion": {
          "default": "aic",
          "description": "What a move is judged on: 'aic' (default), 'bic' (heavier size penalty, so smaller models), 'aicc' (AIC corrected for small samples), or 'pvalue' (enter/drop on the alpha_enter and alpha_remove thresholds instead of an information criterion). AIC/BIC use the scale-free regression form n·ln(RSS/n) + penalty·k, the same convention R's step() reports.",
          "enum": [
            "aic",
            "bic",
            "aicc",
            "pvalue"
          ],
          "type": "string"
        },
        "data": {
          "description": "The data table: one observation per line, columns separated by commas, tabs, semicolons or spaces. Every row needs the same number of columns, at least 2 columns (the target plus one candidate predictor) and at least 3 rows. Blank lines and lines starting with '#' are ignored. Max 20000 rows and 60 columns, e.g. '1,5,5.1\\n2,3,7.9\\n3,8,11.2'.",
          "type": "string"
        },
        "decimals": {
          "default": 4,
          "description": "Decimal places for every number in the report, 0 to 10 (default 4).",
          "maximum": 10,
          "minimum": 0,
          "type": "integer"
        },
        "direction": {
          "default": "both",
          "description": "Search direction: 'forward' starts from the intercept-only model and only adds predictors; 'backward' starts from all predictors and only removes them; 'both' (default) is bidirectional stepwise, which may add or remove at every step and can drop a term that became redundant.",
          "enum": [
            "forward",
            "backward",
            "both"
          ],
          "type": "string"
        },
        "force": {
          "description": "Optional comma-separated predictors that must stay in every candidate model, by column name or 1-based index (e.g. 'ads' or '2'). They are never removed and seed the starting model for forward and bidirectional searches. Default: none forced.",
          "type": "string"
        },
        "header": {
          "default": false,
          "description": "Treat the first row of data as column names instead of numbers (default false). The labels parameter, when given, overrides these names.",
          "type": "boolean"
        },
        "labels": {
          "description": "Optional comma-separated column names, one per column in data order (e.g. 'ads,price,temp,sales'). They name the predictors in the report and can be used by target and force. Overrides the header row. Default v1, v2, … .",
          "type": "string"
        },
        "target": {
          "default": "last",
          "description": "Which column is the target (dependent variable) to explain: 'last' (default, the rightmost column), 'first', a 1-based column number, or a column name from the header row or labels. Every other column becomes a candidate predictor.",
          "type": "string"
        }
      },
      "required": [
        "data"
      ],
      "type": "object"
    }
  }
}