This file contains 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
license: mit |
This file contains 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
def betas_prediction(X,Y): | |
Betas = dot(inv(dot(X_train.T,X_train)),dot(X_train.T,y_train).T) | |
#Generating predictions from Betas vector | |
y_predict = 1/(1+np.exp(-1*dot(X_test,Betas))) | |
return Betas,y_predict | |
Betas,y_predict = betas_prediction(X_train,y_train) | |
plt.scatter(X_test[:,0].ravel(),y_predict.ravel()) | |
plt.show() |
This file contains 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 import linear_model | |
# this is our test set, it's just a straight line with some | |
# Gaussian noise | |
xmin, xmax = -5, 5 | |
n_samples = 100 | |
np.random.seed(0) |