Forex-Bot/ml/models/forex_mlp.py

17 lines
501 B
Python
Raw Permalink Normal View History

2025-05-06 09:50:42 -04:00
import torch
import torch.nn as nn
import torch.nn.functional as F
class ForexMLP(nn.Module):
def __init__(self, input_size):
super(ForexMLP, self).__init__()
self.fc1 = nn.Linear(input_size, 64)
self.fc2 = nn.Linear(64, 32)
self.out = nn.Linear(32, 2) # [buy_score, sell_score]
def forward(self, x):
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = torch.sigmoid(self.out(x)) # We want probabilities between 0-1
return x