text_plain_output_1.png
from sklearn.ensemble import RandomForestRegressor

from sklearn.linear_model import LinearRegression

from sklearn.linear_model import Ridge

from sklearn.preprocessing import StandardScaler

from sklearn.tree import DecisionTreeRegressor

import numpy as np

import pandas as pd

train = pd.read_csv('../input/30-days-of-ml/train.csv')
test = pd.read_csv('../input/30-days-of-ml/test.csv')
sub = pd.read_csv('../input/30-days-of-ml/sample_submission.csv')

train = train.drop('id', axis=1)
test = test.drop('id', axis=1)

cols = test.columns

X_train = train[cols]
X_test = test.copy()
y = train['target']

ss = StandardScaler()
X_train_scaled = ss.fit_transform(X_train)
X_test_scaled = ss.fit_transform(X_test)

lr = LinearRegression()
lr.fit(X_train_scaled, y_train)
y_preds_lr = lr.predict(X_val_scaled)

sub_lr = pd.read_csv('../input/30-days-of-ml/sample_submission.csv')

ridge = Ridge()
ridge.fit(X_train_scaled, y_train)
y_preds_ridge = ridge.predict(X_val_scaled)

sub_ridge = pd.read_csv('../input/30-days-of-ml/sample_submission.csv')

tree_reg = DecisionTreeRegressor()
tree_reg.fit(X_train_scaled, y_train)
y_preds_tree = tree_reg.predict(X_val_scaled)

for_reg = RandomForestRegressor()
for_reg.fit(X_train_scaled, y_train)
y_preds_for = for_reg.predict(X_val_scaled)

target_pred_for = for_reg.predict(X_test_scaled)
target_pred_for

sub_for = pd.read_csv('../input/30-days-of-ml/sample_submission.csv')
sub_for['target'] = target_pred_for
sub_for.head()