{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": " Линейная_регрессия,_градиентный_спуск.ipynb", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "8S0l1cfKEdcQ" }, "source": [ "# **План**\n", "\n", "- Реализация алгоритма стохастического градиентного спуска:\n", " - загрузка данных\n", " - создание и обучение алгоритма\n", "- Сравнение написанного алгоритма с реализованным в библиотеке Sklearn.\n", "\n", "- Рекомендованная литература" ] }, { "cell_type": "markdown", "metadata": { "id": "WBIx7HpJwCKa" }, "source": [ "ноутбук в колаб: https://drive.google.com/file/d/1aqRvKK0WRq8hn89bm1O__khM5cg1wuW7/view?usp=sharing" ] }, { "cell_type": "markdown", "metadata": { "id": "xvGoXa3CFAeV" }, "source": [ "# Реализуем алгоритм стохастического градиентного спуска" ] }, { "cell_type": "code", "metadata": { "id": "8JSYdc4UJD6s" }, "source": [ "import numpy as np\n", "\n", "import pandas as pd\n", "import matplotlib.pyplot as plt" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "4oW8ZZWAXN2E" }, "source": [ "## Загрузка и подготовка данных\n", "\n", "### **Постановка задачи:** \n", "Предсказать вероятность одобрения заявки на поступление в ВУЗ (вероятность от 0 до 1) по набору признаков: оценки за экзамены, наличие research и тд" ] }, { "cell_type": "code", "metadata": { "id": "vW1tcon9JTEQ" }, "source": [ "df = pd.read_csv('https://raw.githubusercontent.com/tixonsit/mmdad_materials/master/datasets_14872_228180_Admission_Predict_Ver1.1.csv')\n", "del df['Serial No.']" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "oUQRj1lsJlFR", "colab": { "base_uri": "https://localhost:8080/", "height": 204 }, "outputId": "f39b113b-4be6-4892-ac0b-6ee50245296b" }, "source": [ "df.head()" ], "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "
\n", " | GRE Score | \n", "TOEFL Score | \n", "University Rating | \n", "SOP | \n", "LOR | \n", "CGPA | \n", "Research | \n", "Chance of Admit | \n", "
---|---|---|---|---|---|---|---|---|
0 | \n", "337 | \n", "118 | \n", "4 | \n", "4.5 | \n", "4.5 | \n", "9.65 | \n", "1 | \n", "0.92 | \n", "
1 | \n", "324 | \n", "107 | \n", "4 | \n", "4.0 | \n", "4.5 | \n", "8.87 | \n", "1 | \n", "0.76 | \n", "
2 | \n", "316 | \n", "104 | \n", "3 | \n", "3.0 | \n", "3.5 | \n", "8.00 | \n", "1 | \n", "0.72 | \n", "
3 | \n", "322 | \n", "110 | \n", "3 | \n", "3.5 | \n", "2.5 | \n", "8.67 | \n", "1 | \n", "0.80 | \n", "
4 | \n", "314 | \n", "103 | \n", "2 | \n", "2.0 | \n", "3.0 | \n", "8.21 | \n", "0 | \n", "0.65 | \n", "