This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.skip("WIP") | |
def test_train_model_slope(regression): | |
model = regression.train_model() | |
assert model.coef_ == np.array([0.54]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.parametrize("input_array, list_with_predictions", | |
[ | |
(np.array([1, 2, 3, 4]), [6.17, 6.71, 7.25, 7.79]), | |
(np.array([5, 10, 15, 20]), [8.33, 11.03, 13.73, 16.43]), | |
(np.array([12, 22, 23, 24]), [12.11, 17.51, 18.05, 18.59]), | |
]) | |
def test_make_prediction_on_unseen_data(input_array, list_with_predictions, regression): | |
predicted_array = regression.make_prediction_on_unseen_data(input_array) | |
predicted_list = [] | |
for a in range(len(predicted_array)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.fixture | |
def regression(): | |
"""Provides a SampleLinearRegression""" | |
regression = SampleLinearRegression(np.array([5, 15, 25, 35, 45, 55]), | |
np.array([5, 20, 14, 32, 22, 38])) | |
yield regression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.linear_model import LinearRegression | |
class SampleLinearRegression: | |
def __init__(self, regressors, predictor): | |
self.regressors = regressors | |
self.predictor = predictor | |
def reshape_regressors(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleLinearRegression: | |
def __init__(self, regressors, predictor): | |
self.regressors = regressors | |
self.predictor = predictor | |
def reshape_regressors(self): | |
pass | |
def train_model(self): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
import numpy as np | |
from linear_regression import SampleLinearRegression | |
@pytest.fixture | |
def regression(): | |
"""Provides a SampleLinearRegression""" | |
regression = SampleLinearRegression(np.array([5, 15, 25, 35, 45, 55]), | |
np.array([5, 20, 14, 32, 22, 38])) |