R^2 Regression #101daysofcode It is a measure of how close the data are to the line of best fit given by are regression model. 1(100%) is best score and 0(0%) is the worst score. Goodness of fit tell how well do, your model has predicted value In Simple terms it shows how well the data fit the regression model (the goodness of fit). How to Calculate R-Squared The formula for calculating R-squared is: Where: SS regression is the sum of squares due to regression (explained sum of squares) SS total is the total sum of squares Practical import pandas as pd from sklearn . model_selection import train_test_split from sklearn . impute import SimpleImputer ############## DATA CLEANING ##################################################### df = pd . read_csv ( r 'path ' ) # Numerical num_var = df . select_dtypes ( include =[ 'int64' , 'float64' ]). columns print ( df [ num_var ]) im = SimpleImputer ( strategy = 'mean' ) im . fit ( df [ num_var ]) df...
Comments
Post a Comment