paxish.blogg.se

Excel linear regression with dates
Excel linear regression with dates






Plt.ylabel('Temperature (in degrees Fahrenheit)') Plt.xlabel('Cricket Chirps (chirps/sec for the striped ground cricket) ') Plt.title('Cricket Chirps vs Temperature (Training set)') Plt.plot(x_train, regressorObject.predict(x_train), color = 'blue') Plt.scatter(x_train, y_train, color = 'red') # Visualising the Training set results in a scatter plot Y_pred_test_data=regressorObject.predict(x_test) #Fitting Simple Linear regression data model to train data setįrom sklearn.linear_model import LinearRegression

excel linear regression with dates

X_train,x_test,y_train,y_test=train_test_split(x,y,test_size=1/3,random_state=42) #Split the data into train and test datasetįrom sklearn.cross_validation import train_test_split I have explained the code with comments #Import the libraries requiredĭataset = pd.read_excel('D:\MachineLearing\Machine Learning A-Z Template Folder\Part 2 - Regression\Section 4 - Simple Linear Regression\') You can have a look at my code on Github where I am predicting temperature using the chirps of an insect cricket with Simple Linear Regression Model. I have this dataframe with this index and 1 column.I want to do simple prediction using linear regression with sklearn.I'm very confused and I don't know how to set X and y(I want the x values to be the time and y values kwh.).I'm new to Python so every help is valuable.Thank you.








Excel linear regression with dates