{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Econometrics and Machine Learning: Different Questions, Shared Tools\n",
        "\n**Opening question:** Which tasks deserve the label AI, and which claims collapse when we ask what data, objective, and evaluation produced the result?\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "def rule_based_income(income):\n",
        "    return \"high\" if income >= 70_000 else \"not high\"\n",
        "\n",
        "for value in [55_000, 72_000]:\n",
        "    print(value, rule_based_income(value))\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "**Interpretation check:** Interpretation. The threshold is fully specified by a person. A learned classifier would estimate a boundary from labelled examples.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "from sklearn.linear_model import LogisticRegression\n",
        "\n",
        "X = np.array([[20], [30], [45], [60], [75], [90]])\n",
        "y = np.array([0, 0, 0, 1, 1, 1])\n",
        "model = LogisticRegression().fit(X, y)\n",
        "print(np.round(model.predict_proba([[50], [80]]), 3))\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "**Interpretation check:** Interpretation. The probabilities arise from the fitted data and model, not from a hand-coded threshold, although the training labels still reflect human choices.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Verified source output\n",
        "\n",
        "```text\n55000 not high 72000 high\n```\n\n```text\n[[0.76 0.24] [0. 1. ]]\n```\n\n```text\n55000 not high\n72000 high\n```\n\n```text\n[[0.76 0.24]\n [0.   1.  ]]\n```\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3"
    },
    "ceteris_lab": {
      "course_slug": "fundamentals-python-econometrics",
      "source_derived": true,
      "course_title": "Fundamentals of Python for Financial Econometrics",
      "chapter": 46,
      "source_origin": "source-derived"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
