MCPcopy Create free account
hub / github.com/FinancialComputingUCL/LOBFrame / __init__

Method __init__

models/CNN1/cnn1.py:6–36  ·  view source on GitHub ↗
(self, num_features=40, num_classes=3, temp=26)

Source from the content-addressed store, hash-verified

4
5class CNN1(pl.LightningModule):
6 def __init__(self, num_features=40, num_classes=3, temp=26):
7 super().__init__()
8
9 # Convolution 1
10 self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=(4, num_features), padding=(3, 0), dilation=(2, 1))
11 self.relu1 = nn.LeakyReLU()
12
13 # Convolution 2
14 self.conv2 = nn.Conv1d(in_channels=16, out_channels=16, kernel_size=(4,))
15 self.relu2 = nn.LeakyReLU()
16
17 # Max pool 1
18 self.maxpool1 = nn.MaxPool1d(kernel_size=2)
19
20 # Convolution 3
21 self.conv3 = nn.Conv1d(in_channels=16, out_channels=32, kernel_size=(3,), padding=2)
22 self.relu3 = nn.LeakyReLU()
23
24 # Convolution 4
25 self.conv4 = nn.Conv1d(in_channels=32, out_channels=32, kernel_size=(3,), padding=2)
26 self.relu4 = nn.LeakyReLU()
27
28 # Max pool 2
29 self.maxpool2 = nn.MaxPool1d(kernel_size=2)
30
31 # Fully connected 1
32 self.fc1 = nn.Linear(temp*32, 32)
33 self.relu5 = nn.LeakyReLU()
34
35 # Fully connected 2
36 self.fc2 = nn.Linear(32, num_classes)
37
38 def forward(self, x):
39 # Convolution 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected