{ "cells": [ { "cell_type": "markdown", "id": "799f31eb", "metadata": {}, "source": [ "线性回归预测的是连续数值,逻辑回归预测的是离散数值。" ] }, { "cell_type": "markdown", "id": "fc3c8eef", "metadata": {}, "source": [ "线性回归: \n", "1.预测天气 \n", "2.预测股票 \n", "3.预测房价 \n", "逻辑回归: \n", "1.邮件是否是垃圾邮件 \n", "2.猫狗分类 \n", "3.是否贷款" ] }, { "cell_type": "code", "execution_count": 2, "id": "0b62f4a6", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "id": "efe20171", "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv(\"insurance_data.csv\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "a0336e69", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | age | \n", "bought_insurance | \n", "
---|---|---|
0 | \n", "22 | \n", "0 | \n", "
1 | \n", "25 | \n", "0 | \n", "
2 | \n", "47 | \n", "1 | \n", "
3 | \n", "52 | \n", "0 | \n", "
4 | \n", "46 | \n", "1 | \n", "