Ejemplo n.º 1
0
def create_fullyconnected_net(num_nodes, rescale_frac=0.999, noise_std=0.0, random_initial_state=False,
                              symmetric=False, feedforward=False, connection_rate=1.0):
    
    net = EchoStateNetwork()
    net.noise_std = noise_std
    
    for k in range(num_nodes):
        n = k
        istate = 0.0       
        if random_initial_state:
            istate = np.abs(np.random.randn()) 
        net.create_node(n, initial_state=istate)
    
    W = np.random.randn(num_nodes, num_nodes)
    if symmetric:
        for k1 in range(num_nodes):
            for k2 in range(k1):
                W[k2, k1] = W[k1, k2]
    
    if feedforward:
        for k1 in range(num_nodes):
            for k2 in range(k1+1):
                W[k1, k2] = 0.0
    
    for k1 in range(num_nodes):
        for k2 in range(num_nodes):
            rn = np.random.rand()
            if rn < connection_rate:
                net.connect_nodes(k1, k2, W[k1, k2])
    
    net.rescale_weights(rescale_frac)
    
    return net
Ejemplo n.º 2
0
def create_inputless_net():
    
    net = EchoStateNetwork()
        
    net.create_node(1, initial_state=np.abs(np.random.randn()))
    net.create_node(2, initial_state=np.abs(np.random.randn()))
    net.create_node(3, initial_state=np.abs(np.random.randn()))
    
    net.connect_nodes(1, 2, 1.0)
    #net.connect_nodes(1, 3, 0.25)
    net.connect_nodes(2, 3, 1.1)
    net.connect_nodes(3, 1, 0.75)

    net.compile()
    
    return net