Skip to content

Instantly share code, notes, and snippets.

@ganprad
ganprad / .block
Created September 12, 2017 21:26
Folium map with vega-lite popups
license: mit
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()
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)