soup pictures
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
|
|
||||||
### Local Datasets ###
|
### Local Datasets ###
|
||||||
|
/experiments
|
||||||
|
/setups/experiments
|
||||||
|
|
||||||
### Data ###
|
### Data ###
|
||||||
*.csv
|
*.csv
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Experiment:
|
|||||||
return dill.load(dill_file)
|
return dill.load(dill_file)
|
||||||
|
|
||||||
def __init__(self, name=None, ident=None):
|
def __init__(self, name=None, ident=None):
|
||||||
self.experiment_id = '{}_{}'.format(ident or '', time.time().as_integer_ratio()[0])
|
self.experiment_id = '{}_{}'.format(ident or '', time.time())
|
||||||
self.experiment_name = name or 'unnamed_experiment'
|
self.experiment_name = name or 'unnamed_experiment'
|
||||||
self.next_iteration = 0
|
self.next_iteration = 0
|
||||||
self.log_messages = []
|
self.log_messages = []
|
||||||
|
|||||||
@@ -167,8 +167,8 @@ class ParticleDecorator:
|
|||||||
next_uid = 0
|
next_uid = 0
|
||||||
|
|
||||||
def __init__(self, net):
|
def __init__(self, net):
|
||||||
self.uid = self.next_uid
|
self.uid = self.__class__.next_uid
|
||||||
self.next_uid += 1
|
self.__class__.next_uid += 1
|
||||||
self.net = net
|
self.net = net
|
||||||
self.states = []
|
self.states = []
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
{'divergent': 43, 'fix_zero': 57, 'fix_other': 0, 'fix_sec': 0, 'other': 0}
|
|
||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{'divergent': 0, 'fix_zero': 1, 'fix_other': 0, 'fix_sec': 0, 'other': 9}
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{'divergent': 3, 'fix_zero': 97, 'fix_other': 0, 'fix_sec': 0, 'other': 0}
|
|
||||||
BIN
code/setups/experiments/FFTNeuralNetwork/experiment.dill
Normal file
BIN
code/setups/experiments/FFTNeuralNetwork/experiment.dill
Normal file
Binary file not shown.
BIN
code/setups/experiments/FFTNeuralNetwork/trajectorys.dill
Normal file
BIN
code/setups/experiments/FFTNeuralNetwork/trajectorys.dill
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{'divergent': 0, 'fix_zero': 100, 'fix_other': 0, 'fix_sec': 0, 'other': 0}
|
|
||||||
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{'divergent': 0, 'fix_zero': 0, 'fix_other': 10, 'fix_sec': 0, 'other': 0}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{'divergent': 0, 'fix_zero': 10, 'fix_other': 0, 'fix_sec': 0, 'other': 0}
|
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
{'divergent': 0, 'fix_zero': 0, 'fix_other': 13, 'fix_sec': 0, 'other': 7}
|
||||||
BIN
code/setups/experiments/exp-soup-_1552643542.3005245-0/soup.dill
Normal file
BIN
code/setups/experiments/exp-soup-_1552643542.3005245-0/soup.dill
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -26,8 +26,9 @@ if __name__ == '__main__':
|
|||||||
run_exp(net)
|
run_exp(net)
|
||||||
K.clear_session()
|
K.clear_session()
|
||||||
exp.log(exp.counters)
|
exp.log(exp.counters)
|
||||||
|
exp.save(trajectorys=exp.without_particles())
|
||||||
|
|
||||||
if True:
|
if False:
|
||||||
# Aggregating Neural Network
|
# Aggregating Neural Network
|
||||||
with FixpointExperiment() as exp:
|
with FixpointExperiment() as exp:
|
||||||
for run_id in tqdm(range(10)):
|
for run_id in tqdm(range(10)):
|
||||||
@@ -36,8 +37,9 @@ if __name__ == '__main__':
|
|||||||
run_exp(net)
|
run_exp(net)
|
||||||
K.clear_session()
|
K.clear_session()
|
||||||
exp.log(exp.counters)
|
exp.log(exp.counters)
|
||||||
|
exp.save(trajectorys=exp.without_particles())
|
||||||
|
|
||||||
if True:
|
if False:
|
||||||
#FFT Neural Network
|
#FFT Neural Network
|
||||||
with FixpointExperiment() as exp:
|
with FixpointExperiment() as exp:
|
||||||
for run_id in tqdm(range(10)):
|
for run_id in tqdm(range(10)):
|
||||||
@@ -46,8 +48,9 @@ if __name__ == '__main__':
|
|||||||
run_exp(net)
|
run_exp(net)
|
||||||
K.clear_session()
|
K.clear_session()
|
||||||
exp.log(exp.counters)
|
exp.log(exp.counters)
|
||||||
|
exp.save(trajectorys=exp.without_particles())
|
||||||
|
|
||||||
if True:
|
if False:
|
||||||
# ok so this works quite realiably
|
# ok so this works quite realiably
|
||||||
with FixpointExperiment() as exp:
|
with FixpointExperiment() as exp:
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
@@ -60,8 +63,9 @@ if __name__ == '__main__':
|
|||||||
if run_id % 10 == 0:
|
if run_id % 10 == 0:
|
||||||
run_exp(net)
|
run_exp(net)
|
||||||
K.clear_session()
|
K.clear_session()
|
||||||
|
exp.save(trajectorys=exp.without_particles())
|
||||||
|
|
||||||
if True:
|
if False:
|
||||||
# ok so this works quite realiably
|
# ok so this works quite realiably
|
||||||
with FixpointExperiment() as exp:
|
with FixpointExperiment() as exp:
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
@@ -74,6 +78,7 @@ if __name__ == '__main__':
|
|||||||
if run_id % 10 == 0:
|
if run_id % 10 == 0:
|
||||||
run_exp(net)
|
run_exp(net)
|
||||||
K.clear_session()
|
K.clear_session()
|
||||||
|
exp.save(trajectorys=exp.without_particles())
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# this explodes in our faces completely... NAN everywhere
|
# this explodes in our faces completely... NAN everywhere
|
||||||
|
|||||||
@@ -11,15 +11,17 @@ from experiment import *
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if True:
|
if True:
|
||||||
with SoupExperiment("soup") as exp:
|
with SoupExperiment("soup") as exp:
|
||||||
for run_id in range(10):
|
for run_id in range(1):
|
||||||
# net_generator = lambda: TrainingNeuralNetworkDecorator(WeightwiseNeuralNetwork(2, 2)) \
|
net_generator = lambda: TrainingNeuralNetworkDecorator(WeightwiseNeuralNetwork(2, 2)) \
|
||||||
# .with_keras_params(activation='linear').with_params(epsilon=0.0001)
|
.with_keras_params(activation='linear').with_params(epsilon=0.0001)
|
||||||
# net_generator = lambda: TrainingNeuralNetworkDecorator(AggregatingNeuralNetwork(4, 2, 2))\
|
# net_generator = lambda: TrainingNeuralNetworkDecorator(AggregatingNeuralNetwork(4, 2, 2))\
|
||||||
# .with_keras_params(activation='linear')
|
# .with_keras_params(activation='linear')
|
||||||
net_generator = lambda: TrainingNeuralNetworkDecorator(FFTNeuralNetwork(4, 2, 2))\
|
# net_generator = lambda: TrainingNeuralNetworkDecorator(FFTNeuralNetwork(4, 2, 2))\
|
||||||
.with_keras_params(activation='linear')
|
# .with_keras_params(activation='linear')
|
||||||
# net_generator = lambda: RecurrentNeuralNetwork(2, 2).with_keras_params(activation='linear').with_params()
|
# net_generator = lambda: RecurrentNeuralNetwork(2, 2).with_keras_params(activation='linear').with_params()
|
||||||
soup = Soup(10, net_generator).with_params(remove_divergent=True, remove_zero=True, train=20)
|
soup = Soup(20, net_generator).with_params(remove_divergent=True, remove_zero=True,
|
||||||
|
train=30,
|
||||||
|
learn_from_rate=-1)
|
||||||
soup.seed()
|
soup.seed()
|
||||||
for _ in tqdm(range(100)):
|
for _ in tqdm(range(100)):
|
||||||
soup.evolve()
|
soup.evolve()
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ if __name__ == '__main__':
|
|||||||
# .with_keras_params(activation='linear')\
|
# .with_keras_params(activation='linear')\
|
||||||
# .with_params(shuffler=AggregatingNeuralNetwork.shuffle_random)
|
# .with_params(shuffler=AggregatingNeuralNetwork.shuffle_random)
|
||||||
# net_generator = lambda: RecurrentNeuralNetwork(2, 2).with_keras_params(activation='linear').with_params()
|
# net_generator = lambda: RecurrentNeuralNetwork(2, 2).with_keras_params(activation='linear').with_params()
|
||||||
soup = Soup(10, net_generator).with_params(remove_divergent=True, remove_zero=True, train=20)
|
soup = Soup(100, net_generator).with_params(remove_divergent=True, remove_zero=True, train=20)
|
||||||
soup.seed()
|
soup.seed()
|
||||||
for _ in tqdm(range(100)):
|
for _ in tqdm(range(100)):
|
||||||
soup.evolve()
|
soup.evolve()
|
||||||
|
|||||||
@@ -101,8 +101,9 @@ def plot_latent_trajectories_3D(soup_or_experiment, filename='plot'):
|
|||||||
if not data_list:
|
if not data_list:
|
||||||
return
|
return
|
||||||
|
|
||||||
bupu = cl.scales['11']['div']['RdYlGn']
|
base_scale = cl.scales['9']['div']['RdYlGn']
|
||||||
scale = cl.interp(bupu, len(data_list)+1) # Map color scale to N bins
|
# base_scale = cl.scales['9']['qual']['Set1']
|
||||||
|
scale = cl.interp(base_scale, len(data_list)+1) # Map color scale to N bins
|
||||||
|
|
||||||
# Fit the embedding space
|
# Fit the embedding space
|
||||||
transformer = PCA(n_components=2)
|
transformer = PCA(n_components=2)
|
||||||
@@ -122,10 +123,13 @@ def plot_latent_trajectories_3D(soup_or_experiment, filename='plot'):
|
|||||||
y=transformed[:, 1],
|
y=transformed[:, 1],
|
||||||
z=np.asarray(particle_dict['time']),
|
z=np.asarray(particle_dict['time']),
|
||||||
text='Particle: {}<br> It had {} lifes.'.format(p_id, len(particle_dict['trajectory'])),
|
text='Particle: {}<br> It had {} lifes.'.format(p_id, len(particle_dict['trajectory'])),
|
||||||
line=dict(color=scale[p_id]),
|
line=dict(
|
||||||
|
color=scale[p_id],
|
||||||
|
width=4
|
||||||
|
),
|
||||||
# legendgroup='Particle - {}'.format(p_id),
|
# legendgroup='Particle - {}'.format(p_id),
|
||||||
name='Particle -{}'.format(p_id),
|
name='Particle -{}'.format(p_id),
|
||||||
# showlegend=True,
|
showlegend=False,
|
||||||
hoverinfo='text',
|
hoverinfo='text',
|
||||||
mode='lines')
|
mode='lines')
|
||||||
|
|
||||||
@@ -144,18 +148,27 @@ def plot_latent_trajectories_3D(soup_or_experiment, filename='plot'):
|
|||||||
color='rgb(0, 0, 0)',
|
color='rgb(0, 0, 0)',
|
||||||
size=4
|
size=4
|
||||||
),
|
),
|
||||||
showlegend=False
|
showlegend=False
|
||||||
)
|
)
|
||||||
|
|
||||||
data.extend([line_trace, line_start, line_end])
|
data.extend([line_trace, line_start, line_end])
|
||||||
|
|
||||||
layout = go.Layout(scene=dict(aspectratio=dict(x=2, y=2, z=2),
|
axis_layout = dict(gridcolor='rgb(255, 255, 255)',
|
||||||
xaxis=dict(tickwidth=1, title='Transformed X'),
|
zerolinecolor='rgb(255, 255, 255)',
|
||||||
yaxis=dict(tickwidth=1, title='transformed Y'),
|
showbackground=True,
|
||||||
zaxis=dict(tickwidth=1, title='Epoch')),
|
backgroundcolor='rgb(230, 230,230)'
|
||||||
title='{} - Latent Trajectory Movement'.format('Penis'),
|
)
|
||||||
# width=0, height=0,
|
|
||||||
margin=dict(l=0, r=0, b=0, t=0))
|
layout = go.Layout(scene=dict(
|
||||||
|
# aspectratio=dict(x=2, y=2, z=2),
|
||||||
|
xaxis=dict(tickwidth=1, title='Transformed X', **axis_layout),
|
||||||
|
yaxis=dict(tickwidth=1, title='Transformed Y', **axis_layout),
|
||||||
|
zaxis=dict(tickwidth=1, title='Epoch', **axis_layout)),
|
||||||
|
# title='{} - Latent Trajectory Movement'.format('Soup'),
|
||||||
|
|
||||||
|
width=1024, height=1024,
|
||||||
|
margin=dict(l=0, r=0, b=0, t=0)
|
||||||
|
)
|
||||||
|
|
||||||
fig = go.Figure(data=data, layout=layout)
|
fig = go.Figure(data=data, layout=layout)
|
||||||
pl.offline.plot(fig, auto_open=True, filename=filename)
|
pl.offline.plot(fig, auto_open=True, filename=filename)
|
||||||
@@ -240,7 +253,7 @@ def search_and_apply(absolut_file_or_folder, plotting_function, files_to_look_fo
|
|||||||
search_and_apply(sub_file_or_folder.path, plotting_function, files_to_look_for=files_to_look_for)
|
search_and_apply(sub_file_or_folder.path, plotting_function, files_to_look_for=files_to_look_for)
|
||||||
elif absolut_file_or_folder.endswith('.dill'):
|
elif absolut_file_or_folder.endswith('.dill'):
|
||||||
file_or_folder = os.path.split(absolut_file_or_folder)[-1]
|
file_or_folder = os.path.split(absolut_file_or_folder)[-1]
|
||||||
if file_or_folder in files_to_look_for and not os.path.exists('{}.html'.format(file_or_folder[:-5])):
|
if file_or_folder in files_to_look_for and not os.path.exists('{}.html'.format(absolut_file_or_folder[:-5])):
|
||||||
print('Apply Plotting function "{func}" on file "{file}"'.format(func=plotting_function.__name__,
|
print('Apply Plotting function "{func}" on file "{file}"'.format(func=plotting_function.__name__,
|
||||||
file=absolut_file_or_folder)
|
file=absolut_file_or_folder)
|
||||||
)
|
)
|
||||||
@@ -262,4 +275,4 @@ if __name__ == '__main__':
|
|||||||
in_file = args.in_file[0]
|
in_file = args.in_file[0]
|
||||||
out_file = args.out_file
|
out_file = args.out_file
|
||||||
|
|
||||||
search_and_apply(in_file, plot_latent_trajectories_3D, ["experiment.dill", "soup.dill"])
|
search_and_apply(in_file, plot_latent_trajectories_3D, ["trajectorys.dill", "soup.dill"])
|
||||||
|
|||||||
Reference in New Issue
Block a user