add grid search
This commit is contained in:
		
							
								
								
									
										2
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.py
									
									
									
									
									
								
							@@ -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(
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user