mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-31 01:17:42 +00:00
fix: preprocess output format & some mistake in spelling (#358)
* spaceship: format type of y = pd.series; fix a wrong spelling in xgb * s3e11: format of y -- pd.series * spaceship: format of y & fit nn * spaceship: wrong spelling in xgb * ci issue
This commit is contained in:
+4
@@ -16,6 +16,8 @@ def preprocess_script():
|
||||
y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl")
|
||||
X_test = pd.read_pickle("/kaggle/input/X_test.pkl")
|
||||
others = pd.read_pickle("/kaggle/input/others.pkl")
|
||||
y_train = pd.Series(y_train).reset_index(drop=True)
|
||||
y_valid = pd.Series(y_valid).reset_index(drop=True)
|
||||
|
||||
return X_train, X_valid, y_train, y_valid, X_test, *others
|
||||
|
||||
@@ -38,6 +40,8 @@ def preprocess_script():
|
||||
X_train, X_valid, y_train, y_valid = train_test_split(
|
||||
train[most_important_features], train["log_cost"], test_size=0.2, random_state=2023
|
||||
)
|
||||
y_train = pd.Series(y_train).reset_index(drop=True)
|
||||
y_valid = pd.Series(y_valid).reset_index(drop=True)
|
||||
|
||||
# test
|
||||
test = pd.read_csv("/kaggle/input/test.csv")
|
||||
|
||||
+4
@@ -79,12 +79,16 @@ def preprocess_script():
|
||||
y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl")
|
||||
X_test = pd.read_pickle("/kaggle/input/X_test.pkl")
|
||||
others = pd.read_pickle("/kaggle/input/others.pkl")
|
||||
y_train = pd.Series(y_train).reset_index(drop=True)
|
||||
y_valid = pd.Series(y_valid).reset_index(drop=True)
|
||||
|
||||
return X_train, X_valid, y_train, y_valid, X_test, *others
|
||||
X_train, X_valid, y_train, y_valid = prepreprocess()
|
||||
|
||||
# Fit the preprocessor on the training data
|
||||
preprocessor, numerical_cols, categorical_cols = preprocess_fit(X_train)
|
||||
y_train = pd.Series(y_train).reset_index(drop=True)
|
||||
y_valid = pd.Series(y_valid).reset_index(drop=True)
|
||||
|
||||
# Preprocess the train, validation, and test data
|
||||
X_train = preprocess_transform(X_train, preprocessor, numerical_cols, categorical_cols)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ def fit(X_train: pd.DataFrame, y_train: pd.DataFrame, X_valid: pd.DataFrame, y_v
|
||||
|
||||
# TODO: for quick running....
|
||||
params = {
|
||||
"nthred": -1,
|
||||
"nthread": -1,
|
||||
}
|
||||
num_round = 180
|
||||
|
||||
|
||||
@@ -85,9 +85,13 @@ def preprocess_script():
|
||||
y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl")
|
||||
X_test = pd.read_pickle("/kaggle/input/X_test.pkl")
|
||||
others = pd.read_pickle("/kaggle/input/others.pkl")
|
||||
y_train = pd.Series(y_train).reset_index(drop=True)
|
||||
y_valid = pd.Series(y_valid).reset_index(drop=True)
|
||||
|
||||
return X_train, X_valid, y_train, y_valid, X_test, *others
|
||||
X_train, X_valid, y_train, y_valid = prepreprocess()
|
||||
y_train = pd.Series(y_train).reset_index(drop=True)
|
||||
y_valid = pd.Series(y_valid).reset_index(drop=True)
|
||||
|
||||
# Fit the preprocessor on the training data
|
||||
preprocessor, label_encoders = preprocess_fit(X_train)
|
||||
|
||||
@@ -37,10 +37,12 @@ def fit(X_train, y_train, X_valid, y_valid):
|
||||
|
||||
# Convert to TensorDataset and create DataLoader
|
||||
train_dataset = TensorDataset(
|
||||
torch.tensor(X_train.to_numpy(), dtype=torch.float32), torch.tensor(y_train.reshape(-1), dtype=torch.float32)
|
||||
torch.tensor(X_train.to_numpy(), dtype=torch.float32),
|
||||
torch.tensor(y_train.to_numpy().reshape(-1), dtype=torch.float32),
|
||||
)
|
||||
valid_dataset = TensorDataset(
|
||||
torch.tensor(X_valid.to_numpy(), dtype=torch.float32), torch.tensor(y_valid.reshape(-1), dtype=torch.float32)
|
||||
torch.tensor(X_valid.to_numpy(), dtype=torch.float32),
|
||||
torch.tensor(y_valid.to_numpy().reshape(-1), dtype=torch.float32),
|
||||
)
|
||||
train_loader = DataLoader(train_dataset, batch_size=32, shuffle=True)
|
||||
valid_loader = DataLoader(valid_dataset, batch_size=32, shuffle=False)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ def fit(X_train: pd.DataFrame, y_train: pd.DataFrame, X_valid: pd.DataFrame, y_v
|
||||
|
||||
# TODO: for quick running....
|
||||
params = {
|
||||
"nthred": -1,
|
||||
"nthread": -1,
|
||||
}
|
||||
num_round = 100
|
||||
|
||||
|
||||
Reference in New Issue
Block a user