# importing the libraries import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd from sklearn import preprocessing # Importing the data set and extracting the dependent and Independent variables data=pd.read_excel( "Amina.xls" ) print (data) x=data.drop( columns =[ 'GWDepth' ]) y=data[ 'GWDepth' ] #Standardisation X=preprocessing.scale(x) Y=preprocessing.scale(y) # Data Visualisation # Building the Correlation Matrix print (sns.heatmap(data.corr())) #plt.show() # Splitting the dataset into training set and test set from sklearn.model_selection import train_test_split X_train , X_test , Y_train , Y_test= train_test_split(X , Y , test_size = 0.2 , random_state = 0 ) # Fitting Multiple Linear Regression to the Training set from sklearn.linear_model import LinearRegression regressor=LinearRegression() regressor.fit(X_train , Y_train) # Predicting the Test set results Y_pred=regressor.predict(X_test) #print(Y_pred) #Calculating...
Comments
Post a Comment