I have a binary classification problem. Right now I’m using several linear layers with ReLU activation.

I’m using BCEWithLogitsLoss() for Loss, so I’m not implementing any Softmax on the layers.

Predictions of the model look something like this:

`-0.2443, 6.6122, 25.0909, ..., -62.7383, 0.3066, 61.6255`

So I can’t really compare it to zeroes and ones of my label. I don’t understand in which moment and how I should convert my predictions into 1s and 0s?

If it’s important right now my model looks like this:

```
def __init__(self, num_cols, cat_cols, embedding_size_dict, n_classes,
embedding_dim_dict=None, learning_rate=0.01):
super().__init__()
self.cat_cols = cat_cols
self.num_cols = num_cols
self.embeddings, total_embedding_dim = self._create_embedding_layers(
cat_cols, embedding_size_dict, embedding_dim_dict)
in_features = len(num_cols) + total_embedding_dim
self.layers = nn.Sequential(
nn.Linear(in_features, 128),
nn.ReLU(),
nn.Linear(128, 256),
nn.ReLU(),
nn.Linear(256, n_classes)
)
@staticmethod
def _create_embedding_layers(cat_cols, embedding_size_dict, embedding_dim_dict):
"""construct the embedding layer, 1 per each categorical variable"""
total_embedding_dim = 0
embeddings = {}
for col in cat_cols:
embedding_size = embedding_size_dict[col]
embedding_dim = embedding_dim_dict[col]
total_embedding_dim += embedding_dim
embeddings[col] = nn.Embedding(embedding_size, embedding_dim)
return nn.ModuleDict(embeddings), total_embedding_dim
def forward(self, num_tensor, cat_tensor):
cat_outputs = []
for i, col in enumerate(self.cat_cols):
embedding = self.embeddings[col]
cat_output = embedding(cat_tensor[:, i])
cat_outputs.append(cat_output)
cat_outputs = torch.cat(cat_outputs, dim=1)
all_outputs = torch.cat((num_tensor, cat_outputs), dim=1)
final_outputs = self.layers(all_outputs).squeeze(dim=1)
return final_outputs```
```