From b0032285b5a78cbf226505cfafc0852aae19236c Mon Sep 17 00:00:00 2001 From: mdkbmi <50350226+mdkbmi@users.noreply.github.com> Date: Fri, 31 Jan 2025 14:35:12 -0800 Subject: [PATCH] fix: added explicit type hints to function parameters --- src/tidylinreg/tidylinreg.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tidylinreg/tidylinreg.py b/src/tidylinreg/tidylinreg.py index 653d7c9..edc1412 100644 --- a/src/tidylinreg/tidylinreg.py +++ b/src/tidylinreg/tidylinreg.py @@ -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. @@ -120,7 +120,7 @@ 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. @@ -128,12 +128,12 @@ def predict(self,X): 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 @@ -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. @@ -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.