mirror of
https://github.com/deepseek-ai/DeepSeek-Coder.git
synced 2025-02-23 06:09:07 -05:00
1174 lines
52 KiB
Plaintext
1174 lines
52 KiB
Plaintext
{
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0,
|
|
"metadata": {
|
|
"colab": {
|
|
"provenance": [],
|
|
"include_colab_link": true
|
|
},
|
|
"kernelspec": {
|
|
"name": "python3",
|
|
"display_name": "Python 3"
|
|
},
|
|
"language_info": {
|
|
"name": "python"
|
|
}
|
|
},
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "view-in-github",
|
|
"colab_type": "text"
|
|
},
|
|
"source": [
|
|
"<a href=\"https://colab.research.google.com/github/Orrm23/DeepSeek-Coder/blob/main/12___Exam_mark_prediction_using_Linear_Regression.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "I1VRs4tZkbvW"
|
|
},
|
|
"source": [
|
|
"# **Day-12 | Exam mark prediction using Linear Regression-multipleVariable**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "SAFLqwkKk8rK"
|
|
},
|
|
"source": [
|
|
"### *Import Libraries*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "EgF2lvr_jzVL"
|
|
},
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"from sklearn.linear_model import LinearRegression"
|
|
],
|
|
"execution_count": 1,
|
|
"outputs": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "XWe_7j6UjxRj"
|
|
},
|
|
"source": [
|
|
"### *Load Dataset from Local Directory*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "vKrHCJk_jwfJ",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/",
|
|
"height": 73
|
|
},
|
|
"outputId": "110e0b18-ab68-4ac6-9e32-733af1698dcc"
|
|
},
|
|
"source": [
|
|
"from google.colab import files\n",
|
|
"uploaded = files.upload()"
|
|
],
|
|
"execution_count": 2,
|
|
"outputs": [
|
|
{
|
|
"output_type": "display_data",
|
|
"data": {
|
|
"text/plain": [
|
|
"<IPython.core.display.HTML object>"
|
|
],
|
|
"text/html": [
|
|
"\n",
|
|
" <input type=\"file\" id=\"files-ef43af6a-7869-4281-bad4-aa66cdd6bbc5\" name=\"files[]\" multiple disabled\n",
|
|
" style=\"border:none\" />\n",
|
|
" <output id=\"result-ef43af6a-7869-4281-bad4-aa66cdd6bbc5\">\n",
|
|
" Upload widget is only available when the cell has been executed in the\n",
|
|
" current browser session. Please rerun this cell to enable.\n",
|
|
" </output>\n",
|
|
" <script>// Copyright 2017 Google LLC\n",
|
|
"//\n",
|
|
"// Licensed under the Apache License, Version 2.0 (the \"License\");\n",
|
|
"// you may not use this file except in compliance with the License.\n",
|
|
"// You may obtain a copy of the License at\n",
|
|
"//\n",
|
|
"// http://www.apache.org/licenses/LICENSE-2.0\n",
|
|
"//\n",
|
|
"// Unless required by applicable law or agreed to in writing, software\n",
|
|
"// distributed under the License is distributed on an \"AS IS\" BASIS,\n",
|
|
"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
|
|
"// See the License for the specific language governing permissions and\n",
|
|
"// limitations under the License.\n",
|
|
"\n",
|
|
"/**\n",
|
|
" * @fileoverview Helpers for google.colab Python module.\n",
|
|
" */\n",
|
|
"(function(scope) {\n",
|
|
"function span(text, styleAttributes = {}) {\n",
|
|
" const element = document.createElement('span');\n",
|
|
" element.textContent = text;\n",
|
|
" for (const key of Object.keys(styleAttributes)) {\n",
|
|
" element.style[key] = styleAttributes[key];\n",
|
|
" }\n",
|
|
" return element;\n",
|
|
"}\n",
|
|
"\n",
|
|
"// Max number of bytes which will be uploaded at a time.\n",
|
|
"const MAX_PAYLOAD_SIZE = 100 * 1024;\n",
|
|
"\n",
|
|
"function _uploadFiles(inputId, outputId) {\n",
|
|
" const steps = uploadFilesStep(inputId, outputId);\n",
|
|
" const outputElement = document.getElementById(outputId);\n",
|
|
" // Cache steps on the outputElement to make it available for the next call\n",
|
|
" // to uploadFilesContinue from Python.\n",
|
|
" outputElement.steps = steps;\n",
|
|
"\n",
|
|
" return _uploadFilesContinue(outputId);\n",
|
|
"}\n",
|
|
"\n",
|
|
"// This is roughly an async generator (not supported in the browser yet),\n",
|
|
"// where there are multiple asynchronous steps and the Python side is going\n",
|
|
"// to poll for completion of each step.\n",
|
|
"// This uses a Promise to block the python side on completion of each step,\n",
|
|
"// then passes the result of the previous step as the input to the next step.\n",
|
|
"function _uploadFilesContinue(outputId) {\n",
|
|
" const outputElement = document.getElementById(outputId);\n",
|
|
" const steps = outputElement.steps;\n",
|
|
"\n",
|
|
" const next = steps.next(outputElement.lastPromiseValue);\n",
|
|
" return Promise.resolve(next.value.promise).then((value) => {\n",
|
|
" // Cache the last promise value to make it available to the next\n",
|
|
" // step of the generator.\n",
|
|
" outputElement.lastPromiseValue = value;\n",
|
|
" return next.value.response;\n",
|
|
" });\n",
|
|
"}\n",
|
|
"\n",
|
|
"/**\n",
|
|
" * Generator function which is called between each async step of the upload\n",
|
|
" * process.\n",
|
|
" * @param {string} inputId Element ID of the input file picker element.\n",
|
|
" * @param {string} outputId Element ID of the output display.\n",
|
|
" * @return {!Iterable<!Object>} Iterable of next steps.\n",
|
|
" */\n",
|
|
"function* uploadFilesStep(inputId, outputId) {\n",
|
|
" const inputElement = document.getElementById(inputId);\n",
|
|
" inputElement.disabled = false;\n",
|
|
"\n",
|
|
" const outputElement = document.getElementById(outputId);\n",
|
|
" outputElement.innerHTML = '';\n",
|
|
"\n",
|
|
" const pickedPromise = new Promise((resolve) => {\n",
|
|
" inputElement.addEventListener('change', (e) => {\n",
|
|
" resolve(e.target.files);\n",
|
|
" });\n",
|
|
" });\n",
|
|
"\n",
|
|
" const cancel = document.createElement('button');\n",
|
|
" inputElement.parentElement.appendChild(cancel);\n",
|
|
" cancel.textContent = 'Cancel upload';\n",
|
|
" const cancelPromise = new Promise((resolve) => {\n",
|
|
" cancel.onclick = () => {\n",
|
|
" resolve(null);\n",
|
|
" };\n",
|
|
" });\n",
|
|
"\n",
|
|
" // Wait for the user to pick the files.\n",
|
|
" const files = yield {\n",
|
|
" promise: Promise.race([pickedPromise, cancelPromise]),\n",
|
|
" response: {\n",
|
|
" action: 'starting',\n",
|
|
" }\n",
|
|
" };\n",
|
|
"\n",
|
|
" cancel.remove();\n",
|
|
"\n",
|
|
" // Disable the input element since further picks are not allowed.\n",
|
|
" inputElement.disabled = true;\n",
|
|
"\n",
|
|
" if (!files) {\n",
|
|
" return {\n",
|
|
" response: {\n",
|
|
" action: 'complete',\n",
|
|
" }\n",
|
|
" };\n",
|
|
" }\n",
|
|
"\n",
|
|
" for (const file of files) {\n",
|
|
" const li = document.createElement('li');\n",
|
|
" li.append(span(file.name, {fontWeight: 'bold'}));\n",
|
|
" li.append(span(\n",
|
|
" `(${file.type || 'n/a'}) - ${file.size} bytes, ` +\n",
|
|
" `last modified: ${\n",
|
|
" file.lastModifiedDate ? file.lastModifiedDate.toLocaleDateString() :\n",
|
|
" 'n/a'} - `));\n",
|
|
" const percent = span('0% done');\n",
|
|
" li.appendChild(percent);\n",
|
|
"\n",
|
|
" outputElement.appendChild(li);\n",
|
|
"\n",
|
|
" const fileDataPromise = new Promise((resolve) => {\n",
|
|
" const reader = new FileReader();\n",
|
|
" reader.onload = (e) => {\n",
|
|
" resolve(e.target.result);\n",
|
|
" };\n",
|
|
" reader.readAsArrayBuffer(file);\n",
|
|
" });\n",
|
|
" // Wait for the data to be ready.\n",
|
|
" let fileData = yield {\n",
|
|
" promise: fileDataPromise,\n",
|
|
" response: {\n",
|
|
" action: 'continue',\n",
|
|
" }\n",
|
|
" };\n",
|
|
"\n",
|
|
" // Use a chunked sending to avoid message size limits. See b/62115660.\n",
|
|
" let position = 0;\n",
|
|
" do {\n",
|
|
" const length = Math.min(fileData.byteLength - position, MAX_PAYLOAD_SIZE);\n",
|
|
" const chunk = new Uint8Array(fileData, position, length);\n",
|
|
" position += length;\n",
|
|
"\n",
|
|
" const base64 = btoa(String.fromCharCode.apply(null, chunk));\n",
|
|
" yield {\n",
|
|
" response: {\n",
|
|
" action: 'append',\n",
|
|
" file: file.name,\n",
|
|
" data: base64,\n",
|
|
" },\n",
|
|
" };\n",
|
|
"\n",
|
|
" let percentDone = fileData.byteLength === 0 ?\n",
|
|
" 100 :\n",
|
|
" Math.round((position / fileData.byteLength) * 100);\n",
|
|
" percent.textContent = `${percentDone}% done`;\n",
|
|
"\n",
|
|
" } while (position < fileData.byteLength);\n",
|
|
" }\n",
|
|
"\n",
|
|
" // All done.\n",
|
|
" yield {\n",
|
|
" response: {\n",
|
|
" action: 'complete',\n",
|
|
" }\n",
|
|
" };\n",
|
|
"}\n",
|
|
"\n",
|
|
"scope.google = scope.google || {};\n",
|
|
"scope.google.colab = scope.google.colab || {};\n",
|
|
"scope.google.colab._files = {\n",
|
|
" _uploadFiles,\n",
|
|
" _uploadFilesContinue,\n",
|
|
"};\n",
|
|
"})(self);\n",
|
|
"</script> "
|
|
]
|
|
},
|
|
"metadata": {}
|
|
},
|
|
{
|
|
"output_type": "stream",
|
|
"name": "stdout",
|
|
"text": [
|
|
"Saving data.csv to data.csv\n"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "6gXowmSom462"
|
|
},
|
|
"source": [
|
|
"### *Load Dataset*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "6JLDHSdym6wP"
|
|
},
|
|
"source": [
|
|
"dataset = pd.read_csv('data.csv')"
|
|
],
|
|
"execution_count": 3,
|
|
"outputs": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "-DdkIy1ZnDfA"
|
|
},
|
|
"source": [
|
|
"### *Load Summarize*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "OlElQViRnGFp",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/"
|
|
},
|
|
"outputId": "cfb430ee-c9d1-4ae7-b909-7eaf0fb9f3c5"
|
|
},
|
|
"source": [
|
|
"print(dataset.shape)\n",
|
|
"print(dataset.head(5))"
|
|
],
|
|
"execution_count": 4,
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"name": "stdout",
|
|
"text": [
|
|
"(201, 4)\n",
|
|
" hours age internet marks\n",
|
|
"0 6.83 15 1 78.50\n",
|
|
"1 6.56 16 0 76.74\n",
|
|
"2 NaN 17 1 78.68\n",
|
|
"3 5.67 18 0 71.82\n",
|
|
"4 8.67 19 1 84.19\n"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "-Zb9xIa-kOx5"
|
|
},
|
|
"source": [
|
|
"### *Finding & Removing NA values from our Features X*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "UwyBQ5nZkTpf",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/"
|
|
},
|
|
"outputId": "fbdf10d5-f2b7-4942-a800-d47f2c78eb8a"
|
|
},
|
|
"source": [
|
|
"dataset.columns[dataset.isna().any()]"
|
|
],
|
|
"execution_count": 6,
|
|
"outputs": [
|
|
{
|
|
"output_type": "execute_result",
|
|
"data": {
|
|
"text/plain": [
|
|
"Index(['hours'], dtype='object')"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"execution_count": 6
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "8LxSw9aHlJTC"
|
|
},
|
|
"source": [
|
|
"dataset.hours = dataset.hours.fillna(dataset.hours.mean())"
|
|
],
|
|
"execution_count": 13,
|
|
"outputs": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "JRyfB6prpJDP"
|
|
},
|
|
"source": [
|
|
"### *Segregate Dataset into Input X & Output Y*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "x9dQcTohpK1X",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/"
|
|
},
|
|
"outputId": "64f7c047-e8c2-4395-d502-e16b8526f1da"
|
|
},
|
|
"source": [
|
|
"X = dataset.iloc[:, :-1].values\n",
|
|
"print(X.shape)\n",
|
|
"X"
|
|
],
|
|
"execution_count": 14,
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"name": "stdout",
|
|
"text": [
|
|
"(201, 3)\n"
|
|
]
|
|
},
|
|
{
|
|
"output_type": "execute_result",
|
|
"data": {
|
|
"text/plain": [
|
|
"array([[ 6.83 , 15. , 1. ],\n",
|
|
" [ 6.56 , 16. , 0. ],\n",
|
|
" [ 6.98142857, 17. , 1. ],\n",
|
|
" [ 5.67 , 18. , 0. ],\n",
|
|
" [ 8.67 , 19. , 1. ],\n",
|
|
" [ 7.55 , 20. , 0. ],\n",
|
|
" [ 6.67 , 15. , 0. ],\n",
|
|
" [ 8.99 , 16. , 0. ],\n",
|
|
" [ 5.19 , 17. , 1. ],\n",
|
|
" [ 6.75 , 18. , 0. ],\n",
|
|
" [ 6.59 , 19. , 0. ],\n",
|
|
" [ 8.56 , 20. , 1. ],\n",
|
|
" [ 7.75 , 15. , 0. ],\n",
|
|
" [ 7.9 , 16. , 1. ],\n",
|
|
" [ 8.19 , 17. , 0. ],\n",
|
|
" [ 6.55 , 18. , 1. ],\n",
|
|
" [ 6.36 , 19. , 0. ],\n",
|
|
" [ 8.44 , 20. , 1. ],\n",
|
|
" [ 8.41 , 15. , 0. ],\n",
|
|
" [ 7.67 , 16. , 1. ],\n",
|
|
" [ 7.42 , 17. , 1. ],\n",
|
|
" [ 8.16 , 18. , 1. ],\n",
|
|
" [ 5.05 , 19. , 1. ],\n",
|
|
" [ 5.85 , 20. , 1. ],\n",
|
|
" [ 5.45 , 15. , 0. ],\n",
|
|
" [ 7.96 , 16. , 0. ],\n",
|
|
" [ 6.51 , 17. , 0. ],\n",
|
|
" [ 6.73 , 18. , 0. ],\n",
|
|
" [ 5.94 , 19. , 1. ],\n",
|
|
" [ 7.48 , 20. , 0. ],\n",
|
|
" [ 8.13 , 15. , 1. ],\n",
|
|
" [ 6.98142857, 16. , 1. ],\n",
|
|
" [ 5.4 , 17. , 1. ],\n",
|
|
" [ 8.78 , 18. , 0. ],\n",
|
|
" [ 8.72 , 19. , 1. ],\n",
|
|
" [ 7.1 , 20. , 0. ],\n",
|
|
" [ 7.86 , 15. , 1. ],\n",
|
|
" [ 7.19 , 16. , 0. ],\n",
|
|
" [ 5.62 , 17. , 1. ],\n",
|
|
" [ 7.88 , 18. , 0. ],\n",
|
|
" [ 5.28 , 19. , 1. ],\n",
|
|
" [ 8.92 , 20. , 1. ],\n",
|
|
" [ 5.46 , 15. , 0. ],\n",
|
|
" [ 8.3 , 16. , 1. ],\n",
|
|
" [ 8.09 , 17. , 0. ],\n",
|
|
" [ 6.18 , 18. , 1. ],\n",
|
|
" [ 7.01 , 19. , 1. ],\n",
|
|
" [ 5.01 , 20. , 0. ],\n",
|
|
" [ 5.54 , 15. , 1. ],\n",
|
|
" [ 5.09 , 16. , 1. ],\n",
|
|
" [ 5.09 , 17. , 0. ],\n",
|
|
" [ 7.31 , 18. , 1. ],\n",
|
|
" [ 8.71 , 19. , 0. ],\n",
|
|
" [ 5.52 , 20. , 1. ],\n",
|
|
" [ 8.76 , 15. , 0. ],\n",
|
|
" [ 8.69 , 16. , 1. ],\n",
|
|
" [ 5.75 , 17. , 1. ],\n",
|
|
" [ 8.93 , 18. , 1. ],\n",
|
|
" [ 5.39 , 19. , 1. ],\n",
|
|
" [ 5.65 , 20. , 0. ],\n",
|
|
" [ 5.49 , 15. , 1. ],\n",
|
|
" [ 7.26 , 16. , 1. ],\n",
|
|
" [ 6.35 , 17. , 0. ],\n",
|
|
" [ 7.72 , 18. , 1. ],\n",
|
|
" [ 8.88 , 19. , 0. ],\n",
|
|
" [ 5.45 , 20. , 1. ],\n",
|
|
" [ 7.86 , 15. , 1. ],\n",
|
|
" [ 8.26 , 16. , 0. ],\n",
|
|
" [ 5.07 , 17. , 1. ],\n",
|
|
" [ 8.25 , 18. , 0. ],\n",
|
|
" [ 5.37 , 19. , 1. ],\n",
|
|
" [ 5.11 , 20. , 1. ],\n",
|
|
" [ 6.35 , 15. , 0. ],\n",
|
|
" [ 7.41 , 16. , 1. ],\n",
|
|
" [ 7.31 , 17. , 0. ],\n",
|
|
" [ 6.04 , 18. , 1. ],\n",
|
|
" [ 5.11 , 19. , 1. ],\n",
|
|
" [ 6.56 , 20. , 0. ],\n",
|
|
" [ 5.09 , 15. , 1. ],\n",
|
|
" [ 5.88 , 16. , 0. ],\n",
|
|
" [ 8.34 , 17. , 1. ],\n",
|
|
" [ 7.94 , 18. , 0. ],\n",
|
|
" [ 6.66 , 19. , 1. ],\n",
|
|
" [ 6.01 , 20. , 1. ],\n",
|
|
" [ 6.88 , 15. , 0. ],\n",
|
|
" [ 5.63 , 16. , 1. ],\n",
|
|
" [ 5.88 , 17. , 0. ],\n",
|
|
" [ 8.05 , 18. , 1. ],\n",
|
|
" [ 5.33 , 19. , 0. ],\n",
|
|
" [ 8.79 , 20. , 0. ],\n",
|
|
" [ 7.52 , 15. , 1. ],\n",
|
|
" [ 8.2 , 16. , 0. ],\n",
|
|
" [ 5.44 , 17. , 1. ],\n",
|
|
" [ 7.9 , 18. , 0. ],\n",
|
|
" [ 7.69 , 19. , 1. ],\n",
|
|
" [ 6.09 , 20. , 0. ],\n",
|
|
" [ 6.98142857, 15. , 1. ],\n",
|
|
" [ 5.2 , 16. , 1. ],\n",
|
|
" [ 8.88 , 17. , 0. ],\n",
|
|
" [ 8.07 , 18. , 1. ],\n",
|
|
" [ 6.24 , 19. , 1. ],\n",
|
|
" [ 7.95 , 20. , 0. ],\n",
|
|
" [ 8.26 , 15. , 0. ],\n",
|
|
" [ 7.31 , 16. , 1. ],\n",
|
|
" [ 7.23 , 17. , 1. ],\n",
|
|
" [ 6.46 , 18. , 1. ],\n",
|
|
" [ 5.34 , 19. , 1. ],\n",
|
|
" [ 5.72 , 20. , 1. ],\n",
|
|
" [ 5.84 , 15. , 0. ],\n",
|
|
" [ 5.02 , 16. , 1. ],\n",
|
|
" [ 7.98 , 17. , 0. ],\n",
|
|
" [ 6.37 , 18. , 1. ],\n",
|
|
" [ 6.92 , 19. , 0. ],\n",
|
|
" [ 7.95 , 20. , 1. ],\n",
|
|
" [ 7.12 , 15. , 0. ],\n",
|
|
" [ 5.79 , 16. , 1. ],\n",
|
|
" [ 5.4 , 17. , 0. ],\n",
|
|
" [ 8.83 , 18. , 1. ],\n",
|
|
" [ 5.69 , 19. , 0. ],\n",
|
|
" [ 6.6 , 20. , 1. ],\n",
|
|
" [ 6.52 , 15. , 0. ],\n",
|
|
" [ 8.31 , 16. , 0. ],\n",
|
|
" [ 6.98142857, 17. , 1. ],\n",
|
|
" [ 7.62 , 18. , 0. ],\n",
|
|
" [ 8.69 , 19. , 1. ],\n",
|
|
" [ 8.75 , 20. , 0. ],\n",
|
|
" [ 6.46 , 15. , 1. ],\n",
|
|
" [ 7.14 , 16. , 1. ],\n",
|
|
" [ 6.38 , 17. , 0. ],\n",
|
|
" [ 6.33 , 18. , 1. ],\n",
|
|
" [ 5.64 , 19. , 0. ],\n",
|
|
" [ 5.26 , 20. , 1. ],\n",
|
|
" [ 6.83 , 15. , 1. ],\n",
|
|
" [ 5.76 , 16. , 0. ],\n",
|
|
" [ 6.51 , 17. , 1. ],\n",
|
|
" [ 8.33 , 18. , 0. ],\n",
|
|
" [ 8.16 , 19. , 1. ],\n",
|
|
" [ 5.14 , 20. , 0. ],\n",
|
|
" [ 8.71 , 15. , 0. ],\n",
|
|
" [ 8.6 , 16. , 1. ],\n",
|
|
" [ 8.6 , 17. , 0. ],\n",
|
|
" [ 7.43 , 18. , 1. ],\n",
|
|
" [ 7.81 , 19. , 1. ],\n",
|
|
" [ 6.51 , 20. , 0. ],\n",
|
|
" [ 8.11 , 15. , 1. ],\n",
|
|
" [ 8.95 , 16. , 0. ],\n",
|
|
" [ 7.99 , 17. , 1. ],\n",
|
|
" [ 5.92 , 18. , 0. ],\n",
|
|
" [ 8.3 , 19. , 1. ],\n",
|
|
" [ 8.97 , 20. , 0. ],\n",
|
|
" [ 5.39 , 15. , 0. ],\n",
|
|
" [ 6.77 , 16. , 0. ],\n",
|
|
" [ 8.08 , 17. , 1. ],\n",
|
|
" [ 5.24 , 18. , 0. ],\n",
|
|
" [ 6.93 , 19. , 1. ],\n",
|
|
" [ 5.14 , 20. , 0. ],\n",
|
|
" [ 8.39 , 15. , 1. ],\n",
|
|
" [ 6.18 , 16. , 0. ],\n",
|
|
" [ 7.53 , 17. , 1. ],\n",
|
|
" [ 7.86 , 18. , 0. ],\n",
|
|
" [ 7.7 , 19. , 1. ],\n",
|
|
" [ 7.3 , 20. , 0. ],\n",
|
|
" [ 7.79 , 15. , 1. ],\n",
|
|
" [ 6.75 , 16. , 0. ],\n",
|
|
" [ 7.87 , 17. , 1. ],\n",
|
|
" [ 5.38 , 18. , 0. ],\n",
|
|
" [ 7.8 , 19. , 1. ],\n",
|
|
" [ 5.07 , 20. , 0. ],\n",
|
|
" [ 7.95 , 15. , 1. ],\n",
|
|
" [ 8.35 , 16. , 0. ],\n",
|
|
" [ 5.19 , 17. , 0. ],\n",
|
|
" [ 7.19 , 18. , 0. ],\n",
|
|
" [ 7.35 , 19. , 1. ],\n",
|
|
" [ 5.22 , 20. , 1. ],\n",
|
|
" [ 5.39 , 15. , 1. ],\n",
|
|
" [ 5.39 , 16. , 1. ],\n",
|
|
" [ 8.93 , 17. , 1. ],\n",
|
|
" [ 5.79 , 18. , 0. ],\n",
|
|
" [ 8.42 , 19. , 1. ],\n",
|
|
" [ 7.26 , 20. , 0. ],\n",
|
|
" [ 6.97 , 15. , 1. ],\n",
|
|
" [ 5.55 , 16. , 1. ],\n",
|
|
" [ 8.66 , 17. , 0. ],\n",
|
|
" [ 8.61 , 18. , 1. ],\n",
|
|
" [ 5.22 , 19. , 1. ],\n",
|
|
" [ 8.05 , 20. , 0. ],\n",
|
|
" [ 8.87 , 15. , 1. ],\n",
|
|
" [ 5.54 , 16. , 0. ],\n",
|
|
" [ 6.98142857, 17. , 0. ],\n",
|
|
" [ 7.26 , 18. , 1. ],\n",
|
|
" [ 5.79 , 19. , 0. ],\n",
|
|
" [ 5.22 , 20. , 0. ],\n",
|
|
" [ 8.71 , 15. , 1. ],\n",
|
|
" [ 7.55 , 16. , 1. ],\n",
|
|
" [ 6.35 , 17. , 1. ],\n",
|
|
" [ 7.53 , 18. , 0. ],\n",
|
|
" [ 8.56 , 19. , 1. ],\n",
|
|
" [ 8.94 , 20. , 1. ],\n",
|
|
" [ 6.6 , 15. , 1. ],\n",
|
|
" [ 8.35 , 16. , 1. ],\n",
|
|
" [ 4.15 , 15. , 0. ]])"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"execution_count": 14
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "SqxVaBO0pf1W",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/"
|
|
},
|
|
"outputId": "5793f7be-3c73-48d1-ac38-11179a8161fe"
|
|
},
|
|
"source": [
|
|
"Y = dataset.iloc[:, -1].values\n",
|
|
"Y"
|
|
],
|
|
"execution_count": 8,
|
|
"outputs": [
|
|
{
|
|
"output_type": "execute_result",
|
|
"data": {
|
|
"text/plain": [
|
|
"array([78.5 , 76.74, 78.68, 71.82, 84.19, 81.18, 76.99, 85.46, 70.66,\n",
|
|
" 77.82, 75.37, 83.88, 79.5 , 80.76, 83.08, 76.03, 76.04, 85.11,\n",
|
|
" 82.5 , 80.58, 82.18, 83.36, 70.67, 75.02, 70.96, 83.33, 74.75,\n",
|
|
" 75.65, 74.15, 80.17, 82.27, 76.14, 71.1 , 84.35, 83.08, 76.76,\n",
|
|
" 81.24, 78.21, 73.08, 83.23, 70.27, 86.41, 71.1 , 82.84, 82.38,\n",
|
|
" 72.96, 77.46, 70.11, 72.38, 71.41, 72.22, 77.77, 84.44, 71.45,\n",
|
|
" 82.21, 85.48, 75.03, 86.65, 70.9 , 71.7 , 73.61, 79.41, 76.19,\n",
|
|
" 80.43, 85.78, 70.06, 81.25, 81.7 , 69.27, 82.79, 71.8 , 71.79,\n",
|
|
" 74.97, 78.61, 77.59, 72.33, 72.08, 77.33, 70.05, 73.34, 84. ,\n",
|
|
" 82.93, 76.63, 75.36, 77.29, 72.87, 73.4 , 81.74, 71.85, 84.6 ,\n",
|
|
" 79.56, 82.1 , 72.08, 79.1 , 81.01, 76.48, 75.39, 68.57, 83.64,\n",
|
|
" 82.3 , 75.18, 82.03, 82.99, 79.26, 77.55, 77.07, 72.1 , 73.25,\n",
|
|
" 74.25, 70.58, 81.08, 75.04, 76.38, 80.86, 78.42, 74.44, 70.34,\n",
|
|
" 85.04, 73.61, 75.55, 76.2 , 82.69, 76.83, 79.53, 83.57, 85.95,\n",
|
|
" 76.02, 77.65, 77.01, 74.49, 73.19, 71.86, 75.8 , 72.46, 78.39,\n",
|
|
" 83.48, 83.15, 71.22, 85.98, 83.91, 84.58, 80.31, 82.55, 75.52,\n",
|
|
" 83.82, 85.15, 82.75, 74.34, 82.02, 86.12, 71.87, 76.7 , 81.7 ,\n",
|
|
" 70.78, 78.45, 70.2 , 83.37, 75.52, 81.57, 80.72, 80.81, 79.49,\n",
|
|
" 79.17, 77.07, 82.04, 71.94, 81.6 , 70.79, 82.68, 83.08, 71.18,\n",
|
|
" 77.63, 77.78, 70.4 , 73.02, 71.11, 85.96, 73.64, 84.24, 78.17,\n",
|
|
" 77.19, 71.83, 86.99, 83.87, 71.5 , 79.63, 85.1 , 72.01, 77.27,\n",
|
|
" 79.87, 73.14, 70.51, 84.03, 79.64, 74.24, 81.67, 84.68, 86.75,\n",
|
|
" 78.05, 83.5 , 81.45])"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"execution_count": 8
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "KsDoGjjbpmjk"
|
|
},
|
|
"source": [
|
|
"### *Training Dataset using Linear Regression*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "nKmEySI1poV_",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/",
|
|
"height": 80
|
|
},
|
|
"outputId": "875ea4c7-b893-4617-bce9-011f7fe33c6d"
|
|
},
|
|
"source": [
|
|
"model = LinearRegression()\n",
|
|
"model.fit(X,Y)"
|
|
],
|
|
"execution_count": 15,
|
|
"outputs": [
|
|
{
|
|
"output_type": "execute_result",
|
|
"data": {
|
|
"text/plain": [
|
|
"LinearRegression()"
|
|
],
|
|
"text/html": [
|
|
"<style>#sk-container-id-1 {\n",
|
|
" /* Definition of color scheme common for light and dark mode */\n",
|
|
" --sklearn-color-text: #000;\n",
|
|
" --sklearn-color-text-muted: #666;\n",
|
|
" --sklearn-color-line: gray;\n",
|
|
" /* Definition of color scheme for unfitted estimators */\n",
|
|
" --sklearn-color-unfitted-level-0: #fff5e6;\n",
|
|
" --sklearn-color-unfitted-level-1: #f6e4d2;\n",
|
|
" --sklearn-color-unfitted-level-2: #ffe0b3;\n",
|
|
" --sklearn-color-unfitted-level-3: chocolate;\n",
|
|
" /* Definition of color scheme for fitted estimators */\n",
|
|
" --sklearn-color-fitted-level-0: #f0f8ff;\n",
|
|
" --sklearn-color-fitted-level-1: #d4ebff;\n",
|
|
" --sklearn-color-fitted-level-2: #b3dbfd;\n",
|
|
" --sklearn-color-fitted-level-3: cornflowerblue;\n",
|
|
"\n",
|
|
" /* Specific color for light theme */\n",
|
|
" --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
|
|
" --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n",
|
|
" --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
|
|
" --sklearn-color-icon: #696969;\n",
|
|
"\n",
|
|
" @media (prefers-color-scheme: dark) {\n",
|
|
" /* Redefinition of color scheme for dark theme */\n",
|
|
" --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
|
|
" --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n",
|
|
" --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
|
|
" --sklearn-color-icon: #878787;\n",
|
|
" }\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 {\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 pre {\n",
|
|
" padding: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 input.sk-hidden--visually {\n",
|
|
" border: 0;\n",
|
|
" clip: rect(1px 1px 1px 1px);\n",
|
|
" clip: rect(1px, 1px, 1px, 1px);\n",
|
|
" height: 1px;\n",
|
|
" margin: -1px;\n",
|
|
" overflow: hidden;\n",
|
|
" padding: 0;\n",
|
|
" position: absolute;\n",
|
|
" width: 1px;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-dashed-wrapped {\n",
|
|
" border: 1px dashed var(--sklearn-color-line);\n",
|
|
" margin: 0 0.4em 0.5em 0.4em;\n",
|
|
" box-sizing: border-box;\n",
|
|
" padding-bottom: 0.4em;\n",
|
|
" background-color: var(--sklearn-color-background);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-container {\n",
|
|
" /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
|
|
" but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
|
|
" so we also need the `!important` here to be able to override the\n",
|
|
" default hidden behavior on the sphinx rendered scikit-learn.org.\n",
|
|
" See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n",
|
|
" display: inline-block !important;\n",
|
|
" position: relative;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-text-repr-fallback {\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
"div.sk-parallel-item,\n",
|
|
"div.sk-serial,\n",
|
|
"div.sk-item {\n",
|
|
" /* draw centered vertical line to link estimators */\n",
|
|
" background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n",
|
|
" background-size: 2px 100%;\n",
|
|
" background-repeat: no-repeat;\n",
|
|
" background-position: center center;\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Parallel-specific style estimator block */\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-parallel-item::after {\n",
|
|
" content: \"\";\n",
|
|
" width: 100%;\n",
|
|
" border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
|
|
" flex-grow: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-parallel {\n",
|
|
" display: flex;\n",
|
|
" align-items: stretch;\n",
|
|
" justify-content: center;\n",
|
|
" background-color: var(--sklearn-color-background);\n",
|
|
" position: relative;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-parallel-item {\n",
|
|
" display: flex;\n",
|
|
" flex-direction: column;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-parallel-item:first-child::after {\n",
|
|
" align-self: flex-end;\n",
|
|
" width: 50%;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-parallel-item:last-child::after {\n",
|
|
" align-self: flex-start;\n",
|
|
" width: 50%;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-parallel-item:only-child::after {\n",
|
|
" width: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Serial-specific style estimator block */\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-serial {\n",
|
|
" display: flex;\n",
|
|
" flex-direction: column;\n",
|
|
" align-items: center;\n",
|
|
" background-color: var(--sklearn-color-background);\n",
|
|
" padding-right: 1em;\n",
|
|
" padding-left: 1em;\n",
|
|
"}\n",
|
|
"\n",
|
|
"\n",
|
|
"/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\n",
|
|
"clickable and can be expanded/collapsed.\n",
|
|
"- Pipeline and ColumnTransformer use this feature and define the default style\n",
|
|
"- Estimators will overwrite some part of the style using the `sk-estimator` class\n",
|
|
"*/\n",
|
|
"\n",
|
|
"/* Pipeline and ColumnTransformer style (default) */\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-toggleable {\n",
|
|
" /* Default theme specific background. It is overwritten whether we have a\n",
|
|
" specific estimator or a Pipeline/ColumnTransformer */\n",
|
|
" background-color: var(--sklearn-color-background);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Toggleable label */\n",
|
|
"#sk-container-id-1 label.sk-toggleable__label {\n",
|
|
" cursor: pointer;\n",
|
|
" display: flex;\n",
|
|
" width: 100%;\n",
|
|
" margin-bottom: 0;\n",
|
|
" padding: 0.5em;\n",
|
|
" box-sizing: border-box;\n",
|
|
" text-align: center;\n",
|
|
" align-items: start;\n",
|
|
" justify-content: space-between;\n",
|
|
" gap: 0.5em;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 label.sk-toggleable__label .caption {\n",
|
|
" font-size: 0.6rem;\n",
|
|
" font-weight: lighter;\n",
|
|
" color: var(--sklearn-color-text-muted);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 label.sk-toggleable__label-arrow:before {\n",
|
|
" /* Arrow on the left of the label */\n",
|
|
" content: \"▸\";\n",
|
|
" float: left;\n",
|
|
" margin-right: 0.25em;\n",
|
|
" color: var(--sklearn-color-icon);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Toggleable content - dropdown */\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-toggleable__content {\n",
|
|
" max-height: 0;\n",
|
|
" max-width: 0;\n",
|
|
" overflow: hidden;\n",
|
|
" text-align: left;\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-0);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-toggleable__content.fitted {\n",
|
|
" /* fitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-toggleable__content pre {\n",
|
|
" margin: 0.2em;\n",
|
|
" border-radius: 0.25em;\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-0);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-toggleable__content.fitted pre {\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
|
|
" /* Expand drop-down */\n",
|
|
" max-height: 200px;\n",
|
|
" max-width: 100%;\n",
|
|
" overflow: auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
|
|
" content: \"▾\";\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Pipeline/ColumnTransformer-specific style */\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
|
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Estimator-specific style */\n",
|
|
"\n",
|
|
"/* Colorize estimator box */\n",
|
|
"#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
|
|
" /* fitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-label label.sk-toggleable__label,\n",
|
|
"#sk-container-id-1 div.sk-label label {\n",
|
|
" /* The background is the default theme color */\n",
|
|
" color: var(--sklearn-color-text-on-default-background);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* On hover, darken the color of the background */\n",
|
|
"#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Label box, darken color on hover, fitted */\n",
|
|
"#sk-container-id-1 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Estimator label */\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-label label {\n",
|
|
" font-family: monospace;\n",
|
|
" font-weight: bold;\n",
|
|
" display: inline-block;\n",
|
|
" line-height: 1.2em;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-label-container {\n",
|
|
" text-align: center;\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Estimator-specific */\n",
|
|
"#sk-container-id-1 div.sk-estimator {\n",
|
|
" font-family: monospace;\n",
|
|
" border: 1px dotted var(--sklearn-color-border-box);\n",
|
|
" border-radius: 0.25em;\n",
|
|
" box-sizing: border-box;\n",
|
|
" margin-bottom: 0.5em;\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-0);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-estimator.fitted {\n",
|
|
" /* fitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-0);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* on hover */\n",
|
|
"#sk-container-id-1 div.sk-estimator:hover {\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 div.sk-estimator.fitted:hover {\n",
|
|
" /* fitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-2);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Specification for estimator info (e.g. \"i\" and \"?\") */\n",
|
|
"\n",
|
|
"/* Common style for \"i\" and \"?\" */\n",
|
|
"\n",
|
|
".sk-estimator-doc-link,\n",
|
|
"a:link.sk-estimator-doc-link,\n",
|
|
"a:visited.sk-estimator-doc-link {\n",
|
|
" float: right;\n",
|
|
" font-size: smaller;\n",
|
|
" line-height: 1em;\n",
|
|
" font-family: monospace;\n",
|
|
" background-color: var(--sklearn-color-background);\n",
|
|
" border-radius: 1em;\n",
|
|
" height: 1em;\n",
|
|
" width: 1em;\n",
|
|
" text-decoration: none !important;\n",
|
|
" margin-left: 0.5em;\n",
|
|
" text-align: center;\n",
|
|
" /* unfitted */\n",
|
|
" border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
|
|
" color: var(--sklearn-color-unfitted-level-1);\n",
|
|
"}\n",
|
|
"\n",
|
|
".sk-estimator-doc-link.fitted,\n",
|
|
"a:link.sk-estimator-doc-link.fitted,\n",
|
|
"a:visited.sk-estimator-doc-link.fitted {\n",
|
|
" /* fitted */\n",
|
|
" border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
|
|
" color: var(--sklearn-color-fitted-level-1);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* On hover */\n",
|
|
"div.sk-estimator:hover .sk-estimator-doc-link:hover,\n",
|
|
".sk-estimator-doc-link:hover,\n",
|
|
"div.sk-label-container:hover .sk-estimator-doc-link:hover,\n",
|
|
".sk-estimator-doc-link:hover {\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-3);\n",
|
|
" color: var(--sklearn-color-background);\n",
|
|
" text-decoration: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
"div.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n",
|
|
".sk-estimator-doc-link.fitted:hover,\n",
|
|
"div.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n",
|
|
".sk-estimator-doc-link.fitted:hover {\n",
|
|
" /* fitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-3);\n",
|
|
" color: var(--sklearn-color-background);\n",
|
|
" text-decoration: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Span, style for the box shown on hovering the info icon */\n",
|
|
".sk-estimator-doc-link span {\n",
|
|
" display: none;\n",
|
|
" z-index: 9999;\n",
|
|
" position: relative;\n",
|
|
" font-weight: normal;\n",
|
|
" right: .2ex;\n",
|
|
" padding: .5ex;\n",
|
|
" margin: .5ex;\n",
|
|
" width: min-content;\n",
|
|
" min-width: 20ex;\n",
|
|
" max-width: 50ex;\n",
|
|
" color: var(--sklearn-color-text);\n",
|
|
" box-shadow: 2pt 2pt 4pt #999;\n",
|
|
" /* unfitted */\n",
|
|
" background: var(--sklearn-color-unfitted-level-0);\n",
|
|
" border: .5pt solid var(--sklearn-color-unfitted-level-3);\n",
|
|
"}\n",
|
|
"\n",
|
|
".sk-estimator-doc-link.fitted span {\n",
|
|
" /* fitted */\n",
|
|
" background: var(--sklearn-color-fitted-level-0);\n",
|
|
" border: var(--sklearn-color-fitted-level-3);\n",
|
|
"}\n",
|
|
"\n",
|
|
".sk-estimator-doc-link:hover span {\n",
|
|
" display: block;\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* \"?\"-specific style due to the `<a>` HTML tag */\n",
|
|
"\n",
|
|
"#sk-container-id-1 a.estimator_doc_link {\n",
|
|
" float: right;\n",
|
|
" font-size: 1rem;\n",
|
|
" line-height: 1em;\n",
|
|
" font-family: monospace;\n",
|
|
" background-color: var(--sklearn-color-background);\n",
|
|
" border-radius: 1rem;\n",
|
|
" height: 1rem;\n",
|
|
" width: 1rem;\n",
|
|
" text-decoration: none;\n",
|
|
" /* unfitted */\n",
|
|
" color: var(--sklearn-color-unfitted-level-1);\n",
|
|
" border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 a.estimator_doc_link.fitted {\n",
|
|
" /* fitted */\n",
|
|
" border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
|
|
" color: var(--sklearn-color-fitted-level-1);\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* On hover */\n",
|
|
"#sk-container-id-1 a.estimator_doc_link:hover {\n",
|
|
" /* unfitted */\n",
|
|
" background-color: var(--sklearn-color-unfitted-level-3);\n",
|
|
" color: var(--sklearn-color-background);\n",
|
|
" text-decoration: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
"#sk-container-id-1 a.estimator_doc_link.fitted:hover {\n",
|
|
" /* fitted */\n",
|
|
" background-color: var(--sklearn-color-fitted-level-3);\n",
|
|
"}\n",
|
|
"</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LinearRegression()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>LinearRegression</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.6/modules/generated/sklearn.linear_model.LinearRegression.html\">?<span>Documentation for LinearRegression</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\"><pre>LinearRegression()</pre></div> </div></div></div></div>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"execution_count": 15
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {
|
|
"id": "n-UeFqpGpw9p"
|
|
},
|
|
"source": [
|
|
"### *Predicted Price for Land sq.Feet of custom values*"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"metadata": {
|
|
"id": "Ollo3wTcpyKQ",
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/"
|
|
},
|
|
"outputId": "c88cfbbe-6fa4-4be4-e1bc-747df623e40a"
|
|
},
|
|
"source": [
|
|
"a=[[9.2,20,0]]\n",
|
|
"PredictedmodelResult = model.predict(a)\n",
|
|
"print(PredictedmodelResult)"
|
|
],
|
|
"execution_count": 16,
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"name": "stdout",
|
|
"text": [
|
|
"[86.26599847]\n"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |