Last active
April 12, 2021 08:52
Revisions
-
conormm revised this gist
Apr 12, 2021 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,6 @@ from sklearn.base import BaseEstimator, RegressorMixin import statsmodels.api as sm class ExponentialDecayRegressor(BaseEstimator, RegressorMixin): """Fits an exponential decay curve """ -
conormm revised this gist
Apr 12, 2021 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,8 +23,4 @@ def predict(self, X, y=None): @staticmethod def exp_decay_f(X, a, k, b): return a * np.exp(-k*X) + b -
conormm revised this gist
Apr 11, 2021 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,19 +2,29 @@ from sklearn.base import BaseEstimator, RegressorMixin import statsmodels.api as sm from scipy.optimize import curve_fit from sklearn.base import BaseEstimator, RegressorMixin import statsmodels.api as sm class ExponentialDecayRegressor(BaseEstimator, RegressorMixin): """Fits an exponential decay curve """ def __init__(self, starting_values=[1.,1.e-5,1.], **kwargs,): self.starting_values = starting_values self.kwargs = kwargs self.params = None def fit(self, X, y=None): self.params, _ = curve_fit(self.exp_decay_f, X, y, p0=self.starting_values) def predict(self, X, y=None): return self.exp_decay_f(X, *self.params) @staticmethod def exp_decay_f(X, a, k, b): return a * np.exp(-k*X) + b @staticmethod def exp_decay_f(X, a, k, b): return a * np.exp(-k*X) + b -
conormm revised this gist
Apr 10, 2021 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,6 @@ class ExponentialDecayRegressor(BaseEstimator, RegressorMixin): """Fits an exponential decay curve """ def __init__(self, **kwargs): self.kwargs = kwargs self.params = None -
conormm revised this gist
Apr 10, 2021 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,8 +11,7 @@ def __init__(self, **kwargs): self.params = None def fit(self, X, y=None): self.params, _ = curve_fit(self.exp_decay_f, X, y, p0=(1.,1.e-5,1.)) def predict(self, X, y=None): return self.exp_decay_f(X, *self.params) -
conormm created this gist
Apr 10, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ from scipy.optimize import curve_fit from sklearn.base import BaseEstimator, RegressorMixin import statsmodels.api as sm class ExponentialDecayRegressor(BaseEstimator, RegressorMixin): """Fits an exponential decay curve """ def __init__(self, **kwargs): self.kwargs = kwargs self.params = None def fit(self, X, y=None): self.params, _ = curve_fit(self.exp_decay_f, X, y, (1.,1.e-5,1.)) def predict(self, X, y=None): return self.exp_decay_f(X, *self.params) @staticmethod def exp_decay_f(X, a, k, b): return a * np.exp(-k*X) + b