ruff and minor checks

This commit is contained in:
jbsch 2024-10-24 12:03:41 +05:30
parent d8c0b7c7b3
commit 83d7252b3a

View File

@ -11,8 +11,8 @@ To run these tests, use the following command:
python -m doctest test_ridge_regression.py -v
"""
import numpy as np
from ridge_regression import RidgeRegression
# from ridge_regression import RidgeRegression
def test_feature_scaling():
"""
@ -30,13 +30,15 @@ def test_feature_scaling():
>>> np.round(std, 2)
array([0.82, 0.82])
"""
pass
def test_fit():
"""
Tests the fit function of RidgeRegression
--------
>>> model = RidgeRegression(alpha=0.01, regularization_param=0.1, num_iterations=1000)
>>> model = RidgeRegression(alpha=0.01,
regularization_param=0.1,
num_iterations=1000)
>>> X = np.array([[1], [2], [3]])
>>> y = np.array([2, 3, 4])
@ -50,13 +52,15 @@ def test_fit():
>>> np.round(model.theta, decimals=2)
array([0. , 0.79])
"""
pass
def test_predict():
"""
Tests the predict function of RidgeRegression
--------
>>> model = RidgeRegression(alpha=0.01, regularization_param=0.1, num_iterations=1000)
>>> model = RidgeRegression(alpha=0.01,
regularization_param=0.1,
num_iterations=1000)
>>> X = np.array([[1], [2], [3]])
>>> y = np.array([2, 3, 4])
@ -71,7 +75,7 @@ def test_predict():
>>> np.round(predictions, decimals=2)
array([-0.97, 0. , 0.97])
"""
pass
def test_mean_absolute_error():
"""
@ -84,8 +88,9 @@ def test_mean_absolute_error():
>>> float(np.round(mae, 2))
0.07
"""
pass
if __name__ == "__main__":
import doctest
doctest.testmod()