Skip to content

Commit

Permalink
Third test
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel-debug committed Dec 21, 2023
1 parent 0e04e77 commit 0505309
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions sklearn_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ def __init__(self, n_neighbors=1): # noqa: D107
self.n_neighbors = n_neighbors

def fit(self, X, y):
"""Fitting function.
Parameters
"""
Fitting function.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
Data to train the model.
Expand Down Expand Up @@ -98,7 +100,9 @@ def fit(self, X, y):
return self

def predict(self, X):
"""Predict function.
"""
Predict function.
Parameters
----------
X : ndarray, shape (n_test_samples, n_features)
Expand Down Expand Up @@ -127,7 +131,9 @@ def predict(self, X):
return y_pred

def score(self, X, y):
"""Calculate the score of the prediction.
"""
Calculate the score of the prediction.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
Expand All @@ -152,7 +158,9 @@ def score(self, X, y):


class MonthlySplit(BaseCrossValidator):
"""CrossValidator based on monthly split.
"""
CrossValidator based on monthly split.
Split data based on the given `time_col` (or default to index). Each split
corresponds to one month of data for the training and the next month of
data for the test.
Expand All @@ -170,7 +178,9 @@ def __init__(self, time_col='index'): # noqa: D107
self.time_col = time_col

def get_n_splits(self, X, y=None, groups=None):
"""Return the number of splitting iterations in the cross-validator.
"""
Return the number of splitting iterations in the cross-validator.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Expand Down Expand Up @@ -201,7 +211,9 @@ def get_n_splits(self, X, y=None, groups=None):
return max(0, len(months) - 1)

def split(self, X, y, groups=None):
"""Generate indices to split data into training and test set.
"""
Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Expand Down

0 comments on commit 0505309

Please sign in to comment.