Skip to content

Commit

Permalink
added fit to dfh
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Al-Saffar committed Dec 1, 2023
1 parent 3f245f7 commit e7670d5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions myresources/crocodile/deeplearning_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ def __init__(self, scaler: Union[RobustScaler, StandardScaler], imputer: SimpleI
self.imputer: SimpleImputer = imputer
self.scaler: Union[RobustScaler, StandardScaler] = scaler

@property
def cols_encoded(self):
"""all numerical columns to be used as inputs to the model. Used in getstate, setstate, design model, etc."""
onehot_names: list[str] = list(self.encoder_onehot.get_feature_names_out())
return onehot_names + self.cols_ordinal + self.cols_numerical

def __getstate__(self):
atts: list[str] = ["scaler", "imputer", "cols_numerical", "cols_ordinal", "cols_onehot", "encoder_onehot", "encoder_ordinal", "clipper_categorical", "clipper_numerical"]
res = {}
Expand Down Expand Up @@ -206,12 +212,6 @@ def clip_encode_impute_scale(self, df: 'pd.DataFrame', precision: str) -> 'pd.Da
df = self.impute_standardize(df=df)
return df

@property
def encoded_columns(self):
"""all numerical columns to be used as inputs to the model. Used in getstate, setstate, design model, etc."""
onehot_names: list[str] = list(self.encoder_onehot.get_feature_names_out())
return onehot_names + self.cols_ordinal + self.cols_numerical


def check_for_nan(ip: 'npt.NDArray[Any]') -> int:
assert len(ip.shape) == 2, f"Expected 2D array, but got {len(ip.shape)}D array"
Expand Down

0 comments on commit e7670d5

Please sign in to comment.