Created
January 28, 2020 10:22
-
-
Save lakshay-arora/45761f1b24a4d80021654ace62ca822b to your computer and use it in GitHub Desktop.
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
# importing libraries | |
from sklearn.linear_model import LinearRegression | |
from sklearn.ensemble import RandomForestRegressor | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import mean_squared_error | |
# separate the independent and target variable | |
train_X = train_data.drop(columns=['Item_Identifier','Item_Outlet_Sales']) | |
train_Y = train_data['Item_Outlet_Sales'] | |
# randomly split the data | |
train_x, test_x, train_y, test_y = train_test_split(train_X, train_Y,test_size=0.25,random_state=0) | |
# shape of train and test splits | |
train_x.shape, test_x.shape, train_y.shape, test_y.shape |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment