In [1]:
import seaborn as sns
iris = sns.load_dataset("iris")
iris.head()
Out[1]:
In [2]:
%matplotlib inline
import seaborn as sns; sns.set()
sns.pairplot(iris, hue="species", size = 1.5);
In [3]:
X_iris = iris.drop("species", axis=1)
X_iris.shape
Out[3]:
In [4]:
y_iris = iris['species']
y_iris.shape
Out[4]:
In [5]:
import matplotlib.pyplot as plt
import numpy as np
rng = np.random.RandomState(42)
x = 10*rng.rand(50)
y = 2*x-1+rng.randn(50)
plt.scatter(x,y)
Out[5]:
In [7]:
from sklearn.linear_model import LinearRegression
model = LinearRegression(fit_intercept=True)
model
Out[7]:
In [15]:
X = x[:, np.newaxis]
X.shape
Out[15]:
In [16]:
model.fit(X,y)
Out[16]:
In [ ]:
In [ ]: