A Single Layer Perceptron for Regression: Part 5

 

  New Function created:

  • calculate_rsquare:  This function calculates the R-square value. This value helps understand the accuracy of the model. It is used for both single and multiple linear regression. However, adjusted R-square works better for the latter.  
    Parameters:  (1) predicted_output(numpy array (m,1)): Predicted output values.
                         (2) actual_output(numpy array (m,1)) : The original output values. 
                         (3) num_of_predictor_variables (int): Number of predictor variables.
                         (4) mean_of_output(float or string) : The mean of the actual output values. If it is                                                                                       "default", then the mean has to be calculated.                                                                                      Otherwise it is passed.
                         (5) adjusted_r2(Boolean): By default is False. It can be made True if Adjusted R-                                                                      square value has to be calculated.
                         

Next Step:

-  Code for Adjusted R squared requires more work so that it works properly.

Code

Comments

Popular posts from this blog

What Data Structure Do I use?

A single layer Perceptron for Regression: Part 1

A Single Layer Perceptron for Regression: Part 6