Skip to content

Commit 7063e1a

Browse files
authored
Update Class_MyLinearRegression.py
1 parent 910a733 commit 7063e1a

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

OOP_in_ML/Class_MyLinearRegression.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
class Metrics:
55
"""
6-
Class with regression metrics
6+
Methods for computing useful regression metrics
7+
78
sse: Sum of squared errors
89
sst: Total sum of squared errors (actual vs avg(actual))
910
r_squared: Regression coefficient (R^2)
@@ -48,7 +49,15 @@ def pretty_print_stats(self):
4849

4950

5051
class Diagnostics_plots:
52+
"""
53+
Diagnostics plots and methods
5154
55+
fitted_vs_residual: Plots fitted values vs. residuals
56+
fitted_vs_features: Plots residuals vs all feature variables in a grid
57+
histogram_resid: Plots a histogram of the residuals (can be normalized)
58+
shapiro_test: Performs Shapiro-Wilk normality test on the residuals
59+
qqplot_resid: Creates a quantile-quantile plot for residuals comparing with a normal distribution
60+
"""
5261
def __init__():
5362
pass
5463

@@ -123,7 +132,12 @@ def qqplot_resid(self,normalized=True):
123132

124133

125134
class Data_plots:
135+
"""
136+
Methods for data related plots
126137
138+
pairplot: Creates pairplot of all variables and the target
139+
plot_fitted: Plots fitted values against the true output values from the data
140+
"""
127141
def __init__():
128142
pass
129143

@@ -155,7 +169,13 @@ def plot_fitted(self,reference_line=False):
155169

156170

157171
class Outliers:
172+
"""
173+
Methods for plotting outliers, leverage, influence points
158174
175+
cook_distance: Computes and plots Cook's distance
176+
influence_plot: Creates the influence plot
177+
leverage_resid_plot: Plots leverage vs normalized residuals' square
178+
"""
159179
def __init__():
160180
pass
161181

@@ -190,7 +210,11 @@ def leverage_resid_plot(self):
190210

191211

192212
class Multicollinearity:
213+
"""
214+
Methods for checking multicollinearity in the dataset features
193215
216+
vif:Computes variance influence factors for each feature variable
217+
"""
194218
def __init__():
195219
pass
196220

@@ -216,7 +240,6 @@ def __repr__(self):
216240
def fit(self, X, y):
217241
"""
218242
Fit model coefficients.
219-
220243
Arguments:
221244
X: 1D or 2D numpy array
222245
y: 1D numpy array
@@ -264,7 +287,6 @@ def fit(self, X, y):
264287

265288
def predict(self, X):
266289
"""Output model prediction.
267-
268290
Arguments:
269291
X: 1D or 2D numpy array
270292
"""

0 commit comments

Comments
 (0)