add grid search

This commit is contained in:
thanhvc3 2023-05-17 13:47:41 +07:00
parent ff855256e0
commit bb6d06a903
2 changed files with 1 additions and 7 deletions

View File

@ -656,7 +656,7 @@ if __name__ == "__main__":
'module__embed_dim': [300, 400, 500],
}
grid = GridSearchCV(estimator=estimator, param_grid=paramsGrid, n_jobs=-1, cv=1)
grid = GridSearchCV(estimator=estimator, param_grid=paramsGrid, n_jobs=-1, cv=1, scoring=torch.nn.BCELoss)
data = np.array(model.triples['train'])
data = data[np.random.choice(np.arange(len(data)), size=int(len(data) * 0.2), replace=False)]
dataloader = iter(DataLoader(

View File

@ -537,12 +537,6 @@ class FouriER(torch.nn.Module):
loss = self.bceloss(pred, true_label)
return loss
def score(self, pred, true_label=None, sub_samp=None):
label_pos = true_label[0]
label_neg = true_label[1:]
loss = self.bceloss(pred, true_label)
return loss
def forward_embeddings(self, x):
x = self.patch_embed(x)
return x