17 lines
501 B
Python
17 lines
501 B
Python
|
|
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
|