Оптимизация количества скрытых нейронов в питоне - PullRequest
0 голосов
/ 23 октября 2019
import torch.nn as nn
import torch.nn.functional as F

# this class define the architecture
class NetMLP(nn.Module):
    def __init__(self, hiddencells = 100):
        super(NetMLP, self).__init__()
        self.fc1 = nn.Linear(32 * 32 , hiddencells)
        self.fc2 = nn.Linear(hiddencells, 10)

    def forward(self, x):
        x = x.view(-1, 32 * 32)
        x = F.relu(self.fc1(x))
        x = F.softmax(self.fc2(x), dim=1)
        return x


###
# Define the network to use :
net = NetMLP(100)
net.to(device) # move it to GPU or CPU
# show the structure :
print(net)

###
# Define the network to use :
net = NetMLP(100)
net.to(device) # move it to GPU or CPU
# show the structure :
print(net)


Я хочу предложить протокол для поиска лучшего числа скрытых нейронов, задачи распознавания и определения количества весов в лучшей системе.

Заранее спасибо.

...