mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-21 16:52:05 +00:00
ruff and minor checks
This commit is contained in:
parent
d8c0b7c7b3
commit
83d7252b3a
|
@ -11,8 +11,8 @@ To run these tests, use the following command:
|
||||||
python -m doctest test_ridge_regression.py -v
|
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():
|
def test_feature_scaling():
|
||||||
"""
|
"""
|
||||||
|
@ -30,13 +30,15 @@ def test_feature_scaling():
|
||||||
>>> np.round(std, 2)
|
>>> np.round(std, 2)
|
||||||
array([0.82, 0.82])
|
array([0.82, 0.82])
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def test_fit():
|
def test_fit():
|
||||||
"""
|
"""
|
||||||
Tests the fit function of RidgeRegression
|
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]])
|
>>> X = np.array([[1], [2], [3]])
|
||||||
>>> y = np.array([2, 3, 4])
|
>>> y = np.array([2, 3, 4])
|
||||||
|
|
||||||
|
@ -50,13 +52,15 @@ def test_fit():
|
||||||
>>> np.round(model.theta, decimals=2)
|
>>> np.round(model.theta, decimals=2)
|
||||||
array([0. , 0.79])
|
array([0. , 0.79])
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def test_predict():
|
def test_predict():
|
||||||
"""
|
"""
|
||||||
Tests the predict function of RidgeRegression
|
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]])
|
>>> X = np.array([[1], [2], [3]])
|
||||||
>>> y = np.array([2, 3, 4])
|
>>> y = np.array([2, 3, 4])
|
||||||
|
|
||||||
|
@ -71,7 +75,7 @@ def test_predict():
|
||||||
>>> np.round(predictions, decimals=2)
|
>>> np.round(predictions, decimals=2)
|
||||||
array([-0.97, 0. , 0.97])
|
array([-0.97, 0. , 0.97])
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def test_mean_absolute_error():
|
def test_mean_absolute_error():
|
||||||
"""
|
"""
|
||||||
|
@ -84,8 +88,9 @@ def test_mean_absolute_error():
|
||||||
>>> float(np.round(mae, 2))
|
>>> float(np.round(mae, 2))
|
||||||
0.07
|
0.07
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
doctest.testmod()
|
doctest.testmod()
|
Loading…
Reference in New Issue
Block a user