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
| # See "Self-Normalizing Neural Networks" https://arxiv.org/abs/1706.02515 | |
| # "SNNs cannot be derived with...tanh units..." | |
| # So I'm probably missing the point somewhere... | |
| import math | |
| import numpy | |
| # Magic number | |
| lambda0 = 1.59254 |
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 math | |
| import numpy | |
| lambda0 = 1.59254 | |
| n = 1000 | |
| nlayers = 100 | |
| # Incoming activiations have mean 0, variance 1 | |
| x = numpy.random.normal(0, 1, n) |
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
| {-# LANGUAGE FlexibleContexts #-} | |
| -- Version 2.0 | |
| import Data.Ratio | |
| (*!) _ 0 = 0 | |
| (*!) a b = a*b | |
| (^+) a b = zipWith (+) a b |
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
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| -- Uses exact-real package | |
| import Data.Ratio | |
| import Data.CReal | |
| (*!) _ 0 = 0 | |
| (*!) a b = a*b |
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 Data.Ratio | |
| (^+) a b = zipWith (+) a b | |
| (^-) a b = zipWith (-) a b | |
| (a : as) `convolve` (b : bs) = (a * b) : | |
| ((map (a *) bs) ^+ (as `convolve` (b : bs))) | |
| compose (f : fs) (0 : gs) = f : (gs `convolve` (compose fs (0 : gs))) |
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
| # -*- coding: utf-8 -*- | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import scipy.integrate as integrate | |
| # Dimension of image in pixels | |
| N = 256 | |
| # Number of samples to use for integration | |
| M = 33 |
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
| # -*- coding: utf-8 -*- | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import scipy.integrate as integrate | |
| # Dimension of image in pixels | |
| N = 256 | |
| # Number of samples to use for integration | |
| M = 257 |
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
| # -*- coding: utf-8 -*- | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import scipy.integrate as integrate | |
| # Dimension of image in pixels | |
| N = 256 | |
| # Number of samples to use for integration | |
| M = 257 |
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
| # -*- coding: utf-8 -*- | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import random | |
| import scipy.integrate as integrate | |
| # Dimension of image in pixels | |
| N = 129 | |
| # Number of samples to use for integration |
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 Data.Ratio | |
| import Data.List | |
| import Control.Monad | |
| -- I'm using two Haskell types for the two vertex types in | |
| -- a bipartite graph. | |
| -- Edges only go from type a to type b. | |
| data BipartiteGraph a b = G [a] [b] [(a, b)] | |
| instance (Show a, Show b) => Show (BipartiteGraph a b) where |