This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": [], | |
"info": { | |
"name": "Elastic Search Requests", | |
"description": "", | |
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "Adding documents to index", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# imports | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.linear_model import LinearRegression | |
from sklearn.metrics import mean_squared_error, r2_score | |
# generate random data-set | |
np.random.seed(0) | |
x = np.random.rand(100, 1) | |
y = 2 + 3 * x + np.random.rand(100, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# imports | |
import numpy as np | |
class LinearRegressionUsingGD: | |
"""Linear Regression Using Gradient Descent. | |
Parameters | |
---------- | |
eta : float |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mean squared error | |
mse = np.sum((y_pred - y_actual)**2) | |
# root mean squared error | |
# m is the number of training examples | |
rmse = np.sqrt(mse/m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sum of square of residuals | |
ssr = np.sum((y_pred - y_actual)**2) | |
# total sum of squares | |
sst = np.sum((y_actual - np.mean(y_actual))**2) | |
# R2 score | |
r2_score = 1 - (ssr/sst) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
np.random.seed(0) | |
x = 2 - 3 * np.random.normal(0, 1, 20) | |
y = x - 2 * (x ** 2) + 0.5 * (x ** 3) + np.random.normal(-3, 3, 20) | |
plt.scatter(x,y, s=10) | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.linear_model import LinearRegression | |
np.random.seed(0) | |
x = 2 - 3 * np.random.normal(0, 1, 20) | |
y = x - 2 * (x ** 2) + 0.5 * (x ** 3) + np.random.normal(-3, 3, 20) | |
# transforming the data to include another axis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.linear_model import LinearRegression | |
from sklearn.metrics import mean_squared_error, r2_score | |
from sklearn.preprocessing import PolynomialFeatures | |
np.random.seed(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_boston | |
boston_dataset = load_boston() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import seaborn as sns | |
%matplotlib inline |
OlderNewer