Skip to content

Commit

Permalink
Added some old code to the paste-bin. Tested I/O-extraction with tupl…
Browse files Browse the repository at this point in the history
…es in for-loop on the workbench. Added new method to the SNN which will extract neo. pseudopat. I.
  • Loading branch information
williampeer committed Feb 1, 2016
1 parent a7f7b48 commit 634bb62
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
23 changes: 22 additions & 1 deletion Process Files/PasteBin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,25 @@
# if np.random.random() < self.MF:
# self.update_dg_ca3_weights_value(random_dg_neuron_index, ca3_neuron_index, np.random.random())
# else:
# self.update_dg_ca3_weights_value(random_dg_neuron_index, ca3_neuron_index, 0.0)
# self.update_dg_ca3_weights_value(random_dg_neuron_index, ca3_neuron_index, 0.0)


# def hpc_learn_patterns_iterations_hardcoded_wrapper(hpc, patterns):
# print "Commencing learning of", len(patterns), "I/O patterns."
# time_start_overall = time.time()
# iter_ctr = 0
# while iter_ctr < 2:
# p_ctr = 0
# for [input_pattern, output_pattern] in patterns:
# # Neuronal turnover, setting input and output in the hpc network.
# hpc.setup_pattern(input_pattern, output_pattern)
#
# # one iteration of learning using Hebbian learning
# hpc.learn()
# p_ctr += 1
#
# iter_ctr += 1
# time_stop_overall = time.time()
#
# print "Learned", len(patterns), "pattern-associations in ", iter_ctr, "iterations, which took" "{:7.3f}". \
# format(time_stop_overall-time_start_overall), "seconds."
16 changes: 11 additions & 5 deletions Process Files/TheanoWorkbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# # print binomial_vector_f([m])
# # print uniform_f(2, 10)
#
hpc = HPC([49, 240, 1600, 480, 49],
0.67, 0.25, 0.04, # connection rates: (in_ec, ec_dg, dg_ca3)
0.10, 0.01, 0.04, # firing rates: (ec, dg, ca3)
0.7, 1.0, 0.1, 0.5, # gamma, epsilon, nu, turnover rate
0.10, 0.95, 0.8, 2.0) # k_m, k_r, a_i, alpha, alpha is 2 in 4.1.1
# hpc = HPC([49, 240, 1600, 480, 49],
# 0.67, 0.25, 0.04, # connection rates: (in_ec, ec_dg, dg_ca3)
# 0.10, 0.01, 0.04, # firing rates: (ec, dg, ca3)
# 0.7, 1.0, 0.1, 0.5, # gamma, epsilon, nu, turnover rate
# 0.10, 0.95, 0.8, 2.0) # k_m, k_r, a_i, alpha, alpha is 2 in 4.1.1

# test = np.asarray([np.arange(5), np.arange(5)*2])
# shared_test = theano.shared(name='shared_test', value=test.astype(theano.config.floatX), borrow=True)
Expand All @@ -42,3 +42,9 @@
# print "after row replacement\n:", shared_test.get_value()
# replace_column(2, np.asarray([42, 42], dtype=np.float32))
# print "after column update:\n", shared_test.get_value()

test_list = [[2, 4]] * 3
test_list.append([13, 9])
for [i, o] in test_list:
print "i:", i
print "o:", o
8 changes: 8 additions & 0 deletions SimpleNeocorticalNetwork.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import numpy as np

theano.config.floatX = 'float32'
Expand Down Expand Up @@ -90,6 +91,13 @@ def train(self, IOPairs):
self.prev_delta_W_in_h.get_value(return_internal_type=True),
self.prev_delta_W_h_out.get_value(return_internal_type=True))

def get_pseudopattern_I(self):
# random input
rng = RandomStreams()

# get output
# return [I, O]

def print_layers(self):
print "\nPrinting layer activation values:"
print "input:\t", self._in.get_value()
Expand Down

0 comments on commit 634bb62

Please sign in to comment.