mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
support multiple types in feature engineering (#562)
This commit is contained in:
@@ -20,6 +20,9 @@ X, y, test_X, test_ids = load_data()
|
||||
X, y, test_X = feat_eng(X, y, test_X)
|
||||
train_X, val_X, train_y, val_y = train_test_split(X, y, test_size=0.2, random_state=42)
|
||||
|
||||
# Print the types of train_y and val_y
|
||||
print(f"train_y type: {type(train_y)}, val_y type: {type(val_y)}")
|
||||
|
||||
test_preds_dict = {}
|
||||
val_preds_dict = {}
|
||||
{% for mn in model_names %}
|
||||
|
||||
@@ -57,11 +57,11 @@ if isinstance(X, pd.DataFrame) and isinstance(X_test, pd.DataFrame):
|
||||
assert get_column_list(X) == get_column_list(X_test), "Mismatch in column names of training and test data."
|
||||
|
||||
if isinstance(X, pd.DataFrame):
|
||||
X_dtypes_unique_sorted = sorted(X.dtypes.unique().tolist())
|
||||
X_loaded_dtypes_unique_sorted = sorted(X_loaded.dtypes.unique().tolist())
|
||||
X_dtypes_unique_sorted = sorted([str(dt) for dt in X.dtypes.unique()])
|
||||
X_loaded_dtypes_unique_sorted = sorted([str(dt) for dt in X_loaded.dtypes.unique()])
|
||||
assert (
|
||||
len(X_loaded_dtypes_unique_sorted) == 1
|
||||
and (X_loaded_dtypes_unique_sorted[0] == np.float64 or X_loaded_dtypes_unique_sorted[0] == np.float32)
|
||||
and X_loaded_dtypes_unique_sorted[0] in {np.float64, np.float32}
|
||||
) or (
|
||||
X_dtypes_unique_sorted == X_loaded_dtypes_unique_sorted
|
||||
), f"feature engineering has produced new data types which is not allowed, data loader data types are {X_loaded_dtypes_unique_sorted} and feature engineering data types are {X_dtypes_unique_sorted}"
|
||||
|
||||
Reference in New Issue
Block a user