Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

add softmax to the final output #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion deeprank/learn/NeuralNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ def _epoch(self, epoch_number, pass_name, data_loader, train_model):

entry_names = []
output_values = []
output_probs = []
target_values = []

for batch_index, batch in enumerate(data_loader):
Expand Down Expand Up @@ -707,8 +708,10 @@ def _epoch(self, epoch_number, pass_name, data_loader, train_model):

output_values += outputs.tolist()
target_values += targets.tolist()

output_probs = F.softmax(torch.FloatTensor(output_values), dim=0).tolist()

self._metrics_output.process(pass_name, epoch_number, entry_names, output_values, target_values)
self._metrics_output.process(pass_name, epoch_number, entry_names, output_probs, target_values)

if count_data_entries > 0:
epoch_loss = sum_of_losses / count_data_entries
Expand Down