Skip to content
Snippets Groups Projects

Restructured code to use classes compatible with joblib and minimize hacks when saving

Merged Danilo Enoque Ferreira de Lima requested to merge save into main
1 file
+ 11
1
Compare changes
  • Side-by-side
  • Inline
+ 11
1
@@ -87,6 +87,16 @@ class HighResolutionSmoother(TransformerMixin, BaseEstimator):
@@ -87,6 +87,16 @@ class HighResolutionSmoother(TransformerMixin, BaseEstimator):
high_res_gc = fftconvolve(X, gaussian, mode="same", axes=1)
high_res_gc = fftconvolve(X, gaussian, mode="same", axes=1)
return high_res_gc
return high_res_gc
 
def inverse_transform(self, Xt: np.ndarray) -> np.ndarray:
 
"""
 
Dummy function to allow for an inverse transform.
 
 
Args:
 
Xt: Transformed variable.
 
 
Returns: Xt.
 
"""
 
return Xt
class UncertaintyHolder(TransformerMixin, BaseEstimator):
class UncertaintyHolder(TransformerMixin, BaseEstimator):
"""
"""
@@ -573,7 +583,7 @@ class Model(TransformerMixin, BaseEstimator):
@@ -573,7 +583,7 @@ class Model(TransformerMixin, BaseEstimator):
pca_y = np.concatenate((high_pca["Y"],
pca_y = np.concatenate((high_pca["Y"],
high_pca["Y"] + high_pca["Y_eps"]),
high_pca["Y"] + high_pca["Y_eps"]),
axis=0)
axis=0)
high_res_predicted = self.y_model.inverse_transform(pca_y)
high_res_predicted = self.y_model["pca"].inverse_transform(pca_y)
expected = high_res_predicted[:n_trains, :]
expected = high_res_predicted[:n_trains, :]
unc = high_res_predicted[n_trains:, :] - expected
unc = high_res_predicted[n_trains:, :] - expected
return dict(expected=expected,
return dict(expected=expected,
Loading