This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pickle | |
| import gzip | |
| import numpy as np | |
| from network2plus import Network | |
| import matplotlib.pyplot as plt | |
| # ── CARICAMENTO DATASET ────────────────────────────────────── | |
| def load_data(): | |
| with gzip.open('mnist.pkl.gz', 'rb') as f: | |
| training_data, validation_data, test_data = pickle.load(f, encoding='latin1') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Libraries | |
| # Standard library | |
| import json | |
| import random | |
| import sys | |
| # Third-party libraries | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pickle | |
| import gzip | |
| import numpy as np | |
| from network2 import Network | |
| import matplotlib.pyplot as plt # ← AGGIUNGI QUESTO! | |
| def load_data(): | |
| with gzip.open('mnist.pkl.gz', 'rb') as f: | |
| training_data, validation_data, test_data = pickle.load(f, encoding='latin1') | |
| # Preprocess training data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """network2.py | |
| ~~~~~~~~~~~~~~ | |
| An improved version of network.py, implementing the stochastic | |
| gradient descent learning algorithm for a feedforward neural network. | |
| Improvements include the addition of the cross-entropy cost function, | |
| regularization, and better initialization of network weights. Note | |
| that I have focused on making the code simple, easily readable, and | |
| easily modifiable. It is not optimized, and omits many desirable | |
| features. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LAB 1 — Classificatore Husky vs Lupo | |
| import math | |
| # ============================================================ | |
| # LAB 1 — Classificatore Husky vs Lupo | |
| # rete con 1 neurone, 2 ingressi, funzione sigmoide | |
| # etichette: 0 = Husky, 1 = Lupo | |
| # ============================================================ |