summaryrefslogtreecommitdiff
path: root/neural_network.py
diff options
context:
space:
mode:
Diffstat (limited to 'neural_network.py')
-rw-r--r--neural_network.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/neural_network.py b/neural_network.py
new file mode 100644
index 0000000..81361e5
--- /dev/null
+++ b/neural_network.py
@@ -0,0 +1,18 @@
+import numpy
+from utils import random_array
+
+CYRILLIC_ALPHABET = ['I', 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ë', 'Ж', 'З',
+ 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С',
+ 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы',
+ 'Ь', 'Э', 'Ю', 'Я']
+
+"""The neural network class."""
+class NeuralNetwork:
+ def __init__(self, learning_rate: float, input_resolution: int) -> None:
+ self.learning_rate = learning_rate
+ self.output_layer_size = len(CYRILLIC_ALPHABET)
+ self.input_layer_size = input_resolution ** 2
+ self.hidden_layer_size = round((self.input_layer_size + self.output_layer_size) / 2)
+ self._hidden_weights = random_array(self.hidden_layer_size, self.input_layer_size)
+ self._output_weights = random_array(self.output_layer_size, self.hidden_layer_size)
+