I am new to python and many constructions blows away my C styled brain. Now I need to understand how some python code works.
#Training inputs for RGBcolors
colors = np.array(
[[0.0, 0.0, 0.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, 0.5],
[0.125, 0.529, 1.0],
[0.33, 0.4, 0.67],
[0.6, 0.5, 1.0],
[0.0, 1.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 1.0],
[1.0, 0.0, 1.0],
[1.0, 1.0, 0.0],
[1.0, 1.0, 1.0],
[0.33, 0.33, 0.33],
[0.5, 0.5, 0.5],
[0.66, 0.66, 0.66]])
for i in range(num_training):
rnd_ind = np.random.randint(0, len(colors))
s.train(colors[rnd_ind, :]) //what's going on here?
This is the train
body:
def train(self, input_x):
# Compute the winning unit
bmu_index, diff = self.session.run([self.bmu_index, self.diff], {self.input_placeholder:[input_x], self.current_iteration:self.num_iterations})
# Update the network's weights
self.session.run(self.update_weights, {self.diff_2:diff, self.dist_sliced:self.dist[bmu_index[0],:], self.current_iteration:self.num_iterations})
self.num_iterations = min(self.num_iterations+1, self.num_expected_iterations)
I set breakpoint to train
beginning to see how it's input parameter looks like, but I no see anything unusual. This is just an array.
I tried searching and found this Colon (:) in Python list index question, but it looks like this is something different, because in my case :
written after ,
, but in their cases it follows after some value.