The 'mode' attribute in go.Scatter() lets you make lines as well. Also note how I have generated 500 points between 5 and 120, then predicted their corresponding price based on the Linear Regression model that was fitted on the given datapoints. Please note how the 'name' attribute is used in trace to give the legend a name for a particular trace. We have two traces now, one for the data points and one for the trendline. There are some minor additions to the previous code. Hopefully, more complex examples that we will see later on will make my point concrete. Now you can see why I pressed on using this template. You can clearly see a regression line (Trendline) that we fit using LinearRegression() library in sklearn has been shown in orange. Y = regressor.predict(X).reshape(len(X),), Regressor.fit(X_appartment, Y_appartment) Y_appartment = np.array(dataset_train).reshape(-1, 1) X_appartment = np.array(dataset_train).reshape(-1, 1) Lets fit a regression line to it! #visualization of dataset with a regression line Now lets make s slightly more complex plot. Now, you can clearly see the data follows a linear trend and there is good correlation between the features 'Squaremeter' and 'Price'.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |