adding all work done so far (lessons 1 - 5)

This commit is contained in:
2019-07-10 19:58:53 +01:00
parent 8085149a49
commit b982957daf
37 changed files with 19407 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import pandas as pd
import numpy as np
from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
train_data = pd.read_csv('data.csv', header=None)
X = train_data.iloc[:, :-1]
y = train_data.iloc[:, -1]
# Create the standardization scaling object
scaler = StandardScaler()
# Scale and fit the standardization paramaeters
X_scaled = scaler.fit_transform(X)
# Create the LR model with Lasso regularization
lasso_reg = Lasso()
# Fit the model
lasso_reg.fit(X_scaled, y)
# Get the regression coeficients
reg_coef = lasso_reg.coef_
print(reg_coef)