{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Linear Regression using Julia \n", "\n", "In this notebook, I presented Julia version of the solutions, Here I have used Linear Regression on Boston dataset, This notebook does not contain polynomial regression part, because It is still in progress. " ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [], "source": [ "# import Pkg\n", "# Pkg.add(\"Plots\")\n", "# Pkg.add(\"Lathe\")\n", "# Pkg.add(\"GLM\")\n", "# Pkg.add(\"StatsPlots\")\n", "# Pkg.add(\"MLBase\")\n", "# Pkg.add(\"Metrics\") \n", "\n", "# Uncomment this if you haven't installed the above libraries " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# packages we will use \n", "using Plots\n", "using Lathe\n", "using GLM\n", "using Statistics\n", "using StatsPlots\n", "using MLBase \n", "using Metrics \n", "using DataFrames, CSV\n", "using Polynomials" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
5 rows × 14 columns (omitted printing of 5 columns)
CRIM | ZN | INDUS | CHAS | NOX | RM | AGE | DIS | RAD | |
---|---|---|---|---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | |
1 | 0.00632 | 18.0 | 2.31 | 0.0 | 0.538 | 6.575 | 65.2 | 4.09 | 1.0 |
2 | 0.02731 | 0.0 | 7.07 | 0.0 | 0.469 | 6.421 | 78.9 | 4.9671 | 2.0 |
3 | 0.02729 | 0.0 | 7.07 | 0.0 | 0.469 | 7.185 | 61.1 | 4.9671 | 2.0 |
4 | 0.03237 | 0.0 | 2.18 | 0.0 | 0.458 | 6.998 | 45.8 | 6.0622 | 3.0 |
5 | 0.06905 | 0.0 | 2.18 | 0.0 | 0.458 | 7.147 | 54.2 | 6.0622 | 3.0 |
14 rows × 7 columns
variable | mean | min | median | max | nmissing | eltype | |
---|---|---|---|---|---|---|---|
Symbol | Float64 | Float64 | Float64 | Float64 | Int64 | DataType | |
1 | CRIM | 3.61352 | 0.00632 | 0.25651 | 88.9762 | 0 | Float64 |
2 | ZN | 11.3636 | 0.0 | 0.0 | 100.0 | 0 | Float64 |
3 | INDUS | 11.1368 | 0.46 | 9.69 | 27.74 | 0 | Float64 |
4 | CHAS | 0.06917 | 0.0 | 0.0 | 1.0 | 0 | Float64 |
5 | NOX | 0.554695 | 0.385 | 0.538 | 0.871 | 0 | Float64 |
6 | RM | 6.28463 | 3.561 | 6.2085 | 8.78 | 0 | Float64 |
7 | AGE | 68.5749 | 2.9 | 77.5 | 100.0 | 0 | Float64 |
8 | DIS | 3.79504 | 1.1296 | 3.20745 | 12.1265 | 0 | Float64 |
9 | RAD | 9.54941 | 1.0 | 5.0 | 24.0 | 0 | Float64 |
10 | TAX | 408.237 | 187.0 | 330.0 | 711.0 | 0 | Float64 |
11 | PTRATIO | 18.4555 | 12.6 | 19.05 | 22.0 | 0 | Float64 |
12 | B | 356.674 | 0.32 | 391.44 | 396.9 | 0 | Float64 |
13 | LSTAT | 12.6531 | 1.73 | 11.36 | 37.97 | 0 | Float64 |
14 | SalePrice | 22.5328 | 5.0 | 21.2 | 50.0 | 0 | Float64 |