Is KAN (pykan) sufficient for classification tasks? #477
Open
Description
The implemented following code snippet for binary classification on tabular data, using stratified K-fold cross-validation (K=10). The performance results seem exceptionally good. Can someone help review and suggest improvements to the implementation?
`model = KAN(width=[38,5,3, 2], grid=5, k=3)
for train_idx, test_idx in (kf.split(X_scaled, y)):
X_train, X_test = X_scaled[train_idx], X_scaled[test_idx]
y_train, y_test = y[train_idx], y[test_idx]
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size=0.1, random_state=5) # Splitting train into train and val set
train_input = torch.tensor(X_train, dtype=torch.float32)
train_label = torch.tensor(y_train, dtype=torch.long)
val_input = torch.tensor(X_val, dtype=torch.float32)
val_label = torch.tensor(y_val, dtype=torch.long)
test_input = torch.tensor(X_test, dtype=torch.float32)
test_label = torch.tensor(y_test, dtype=torch.long)
dataset = {
'train_input': train_input,
'train_label': train_label,
'val_input': val_input,
'val_label': val_label,
'test_input': test_input,
'test_label': test_label
}
results = model.fit({'train_input': train_input, 'train_label': train_label,
'test_input': val_input, 'test_label': val_label},
opt="LBFGS", steps=10,
loss_fn=torch.nn.CrossEntropyLoss(),update_grid = False)
# Predictions
test_preds = torch.argmax(model.forward(test_input).detach(), dim=1)
# Evaluate metrics on test set
PD, PF, auc, balance, fir, accuracy, precision = get_clf_eval(test_label, test_preds)
`
Dataset Description :
Features - 39
data points - 16,900 (after SMOTE - 32,900)
Metadata
Assignees
Labels
No labels