Skip to content

Commit

Permalink
fix: added explicit type hints to function parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mdkbmi committed Jan 31, 2025
1 parent 8aaea9b commit b003228
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/tidylinreg/tidylinreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def initialize(self):
self.pvalues = None


def fit(self,X,y):
def fit(self, X: pd.DataFrame, y: pd.Series):
"""
Fits the linear model to the provided data.
Expand Down Expand Up @@ -120,20 +120,20 @@ def fit(self,X,y):
self.in_sample_predictions = self.predict(X)


def predict(self,X):
def predict(self, X: pd.DataFrame) -> np.ndarray:
"""
Predicts the response values from a given matrix.
The model must be fitted before prediction can occur.
Parameters
----------
X : array-like of shape (n_samples, n_features)
X : pd.DataFrame of shape (n_samples, n_features)
The input features for prediction.
Returns
-------
array-like of shape (n_samples,)
np.ndarray of shape (n_samples,)
The predicted target values.
Raises
Expand Down Expand Up @@ -218,7 +218,7 @@ def get_test_statistic(self):

return

def get_ci(self, alpha=0.05):
def get_ci(self, alpha: float=0.05):
"""
Get the confidence interval of the parameter estimates.
Expand Down Expand Up @@ -306,7 +306,7 @@ def get_pvalues(self):
self.pvalues = [2 * (1-stats.t.cdf(np.abs(t), self.df)) for t in self.test_statistic]
return self.pvalues

def summary(self, ci=False, alpha=0.05) -> pd.DataFrame:
def summary(self, ci : bool=False, alpha : float=0.05) -> pd.DataFrame:
"""
Summarizes the fit of the linear regression model.
Expand Down

0 comments on commit b003228

Please sign in to comment.