How to use Atom Stalker to find atoms and generate trajectories

This project started with the idea in mind to make atom identification and trajectory generation as flexible as possible. Hence it is using sliding windows and AdaBoost to efficiently find deciding features distinguishing available positive and negative samples.

Once the AdaBoost classifier is trained we can calculate atom positions in available frames and from this generate trajectories.

Note, there is no reason not to try out other classifiers as well. sklearn's api makes this very userfriendly.

Generate Samples

In order to generate samples we here make use of kmeans clustering in a feature space. For each pixel we generate a feature vector containing the pixels intensity as well as the intensity differences with the neighboring pixels (here first shell, but you can change that). This leads to clusters where we choose the cluster with the highest average pixel intensity.


In [1]:
%reset
%matplotlib inline
from AtomStalker import load_TEM_image, TEM_sliding_collector

#path = './TEM_images/FEI_HAADF_Image_movie_282-CLEANED-subtracted.h5'#BackgroundSubtracted.h5'
path = "./example-subtracted.h5"
idx_frames = range(10)
xlim = [0,240]
ylim = [0,280]
width=8
height=8
xstep=12 #shift of pixels in x per iteration
ystep=12 #shift of pixels in y per iteration
padding=5
distance = 1
ix = 0
n_clusters = 4
n_frames_pca_km = 2
key = '/Experiments/__unnamed__/data' #old h5 file: 'dataset', new: '/Experiments/__unnamed__/data'

img_vec = [load_TEM_image(path,h5=True,frame=v,key=key) for v in idx_frames]
Tsc = TEM_sliding_collector()
Tsc.set_window_size(width=width,height=height)
Tsc.set_image(img_vec)

Tsc.create_samples(n_frames_pca_km,n_clusters,distance,xstep=xstep,ystep=ystep,max_iter=300,tol=1e-4,t=1,cluster_min_size=9)
Tsc.show_all_sliding_window_classifications()


Once deleted, variables cannot be recovered. Proceed (y/[n])? y
agglomeration: xys 0 centers 0, classifications 0
xys 22 centers 22 samples 22 classifications 22

Generating samples with the sliding window technique...
positive_centers (22L, 2L)
xys 328 centers 328 samples 328 classifications 328
sliding: xys 22 centers 22, classifications 22
agglomeration: xys 0 centers 0, classifications 0
xys 25 centers 25 samples 25 classifications 25

Generating samples with the sliding window technique...
positive_centers (25L, 2L)
xys 315 centers 315 samples 315 classifications 315
sliding: xys 25 centers 25, classifications 25
image 0
D:\Anaconda\envs\python2vtk\lib\site-packages\matplotlib\axes\_axes.py:519: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labelled objects found. "
image 1

Manually correcting false classifications from kmeans

The sample generation suggests classes, see above where positive is green and negative is red. In case that suggestions are wrong please specify below in form of a list of lists. Each list corresponds to one frame with integer entries related to the numbers shown in the patches in the images above. The lists will be interpreted for each frame, hence if there are no changes to be made for a frame insert an empty list for that frame.

Tip: If you have mistakenly assigned a class to a windows using the below cell just execute this cell again to flip the classification back to its original value.


In [2]:
wrong_classifications = [[205],
                         [206,3]]
Tsc.set_classifications(wrong_classifications)
Tsc.show_all_sliding_window_classifications()


image 0
image 1

Multiplying Samples

This is a neat little trick which allows a significant improvement in the classification. We "multiply" our samples by assuming that slight shifts of the samples generated previously doesn't change their classification. This essentially generates many more samples for free!


In [3]:
Tsc.multiply_all_samples(distance=1)
Tsc.show_all_sliding_window_classifications()


Created amount of samples:
424 positive samples
5552 negative samples
5976 number of samples in total
image 0
image 1

Write samples and their classes to disk

For posterity


In [4]:
classes_save_path = "./classes_for_classifier_training.txt"
Tsc.save_sample_positions_and_class(classes_save_path)


Writing samples for classifier training to disk at ./classes_for_classifier_training.txt...

Loading samples for the training of a classifier from disk


In [5]:
%matplotlib inline
from AtomStalker import load_TEM_image, TEM_sliding_collector

path = "./example-subtracted.h5"
xlim = [0,240]
ylim = [0,280]
width=8
height=8
padding=5
key = '/Experiments/__unnamed__/data'

img_vec = [load_TEM_image(path,h5=True,frame=v,key=key) for v in range(10)]
Tsc = TEM_sliding_collector()
Tsc.set_window_size(width=width,height=height)
Tsc.set_image(img_vec)
Tsc.get_sub_image_vec(xlim=xlim,ylim=ylim,padding=padding)

classes_save_path = "./classes_for_classifier_training.txt"
Tsc.load_sample_positions_and_class(classes_save_path)
Tsc.show_all_sliding_window_classifications(default_class=0,colors=['r','g','y','m'],frames=range(10))


Loading samples for classifier training from disk at ./classes_for_classifier_training.txt...
image 0 frame 0
image 1 frame 1

Generate the classifier


In [6]:
import sys
sys.path.append("D:/Anaconda/envs/python2/Lib/site-packages")
import pywt
print(pywt.wavelist())


['bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8', 'coif1', 'coif2', 'coif3', 'coif4', 'coif5', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9', 'db10', 'db11', 'db12', 'db13', 'db14', 'db15', 'db16', 'db17', 'db18', 'db19', 'db20', 'dmey', 'haar', 'rbio1.1', 'rbio1.3', 'rbio1.5', 'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8', 'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7', 'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8', 'sym2', 'sym3', 'sym4', 'sym5', 'sym6', 'sym7', 'sym8', 'sym9', 'sym10', 'sym11', 'sym12', 'sym13', 'sym14', 'sym15', 'sym16', 'sym17', 'sym18', 'sym19', 'sym20']

As mentioned earlier we use here an AdaBoost classifier, but you can simply use another one if you so choose.


In [7]:
from AtomStalker import ClassificationTrainer
from sklearn.ensemble import AdaBoostClassifier

path_classifier = './classifier_test'

all_samples, all_classifications = Tsc.get_all_samples_and_classifications()
CT = ClassificationTrainer(wavelet='coif1')
CT.set_samples(all_samples)
CT.get_features()
ABC = AdaBoostClassifier(base_estimator=None, n_estimators=50, learning_rate=1.0, algorithm='SAMME.R', random_state=None)
CT.set_classifier_and_train(ABC,all_classifications)
CT.save_classifier2disk(path_classifier)


Getting samples...
Setting samples...
setting classifier and training...

Writing classifier to ./classifier_test...

Quality of classifier running on the training data.


In [8]:
new_classy = CT.get_predictions(all_samples)

tp = sum([v==1 for v,v2 in zip(all_classifications,new_classy) if v==v2])
tn = sum([v!=1 for v,v2 in zip(all_classifications,new_classy) if v==v2])
fn = sum([v!=1 for v,v2 in zip(all_classifications,new_classy) if v!=v2])
fp = sum([v==1 for v,v2 in zip(all_classifications,new_classy) if v!=v2])
R = tp/float(tp+fn)
P = tp/float(tp+fp)
F1 = 2*P*R/(P+R)

print("#{} positive classifications {} negative ones. tp {} fp {} tn {} fn {} F1 score = {}".format(sum(new_classy),len(new_classy)-sum(new_classy),tp,fp,tn,fn,F1))
print("all classy {} new classy {}".format(len(all_classifications),len(new_classy)))


#407.0 positive classifications 5569.0 negative ones. tp 406 fp 18 tn 5551 fn 1 F1 score = 0.977135980746
all classy 5976 new classy 5976

Classification

Either directly via the ImagePeakClassifier class...


In [9]:
from AtomStalker import ImagePeakClassifier

path = "./example-subtracted.h5"
path_save_coordinates = 'coordinates.txt'
path_classifier = './classifier_test'
t = 5 #maximum spatial distance of found window centers to be clustered - if two atoms are identified as one this value could be to large
xstep = 1
ystep = 1
num_frames = 5

width=8
height=8

Ipc = ImagePeakClassifier(wavelet='coif1')

#set classifier
classy = Ipc.load_classifier(path_classifier)
#Ipc.set_trained_classifier(CT.classifier)

#process data
Ipc.process_TEM_sequence(path,width,height,xstep=xstep,ystep=ystep,iclassy=[1],t=t,num_frames=num_frames,key='/Experiments/__unnamed__/data')
#save coordinates
Ipc.save_ClusterCenters2disk(path_save_coordinates,separator=' ')

#for i in range(num_frames):
#    Ipc.show_window_for_single_img(i)
Ipc.show_window_for_single_img(1)
Ipc.show_window_for_single_img(2)
Ipc.show_window_for_single_img(3)
Ipc.show_window_for_single_img(4)
#tr.print_diff()


Processing TEM image sequence...

Processing frame 0...

Analyzing...
51480 frames
features (51480L, 43L)
1372 positive classifications in total

 30 clusters

Processing frame 1...

Analyzing...
51480 frames
features (51480L, 43L)
1398 positive classifications in total

 36 clusters

Processing frame 2...

Analyzing...
51480 frames
features (51480L, 43L)
1097 positive classifications in total

 32 clusters

Processing frame 3...

Analyzing...
51480 frames
features (51480L, 43L)
1356 positive classifications in total

 28 clusters

Processing frame 4...

Analyzing...
51480 frames
features (51480L, 43L)
1109 positive classifications in total

 31 clusters

memory usage
var classifier: [56, 56, 56, 56, 56]
var img: [437768, 437768, 437768, 437768, 437768]
var win_width: [24, 24, 24, 24, 24]
var win_height: [24, 24, 24, 24, 24]
var samples: [26403272, 26403272, 26403272, 26403272, 26403272]
var xys: [4581368, 4581368, 4581368, 4581368, 4581368]
var classifications: [411936, 411936, 411936, 411936, 411936]
var intensities: [2104712, 2104712, 2104712, 2104712, 2104712]
var centers: [187136, 190464, 149440, 185088, 150976]
var corners: [16, 16, 16, 16, 16]
var cluster_centers: [352, 400, 368, 336, 360]
var cluster_corners: [352, 400, 368, 336, 360]
var sequence: [56, 56, 56, 56, 56]
var cluster_centers_storage: [448, 848, 1216, 1552, 1944]
var cluster_corners_storage: [448, 848, 1216, 1552, 1944]

... or via the wrapping function Process_TEM.


In [2]:
from AtomStalker import ImagePeakClassifier, Process_TEM
path = "./example-subtracted.h5"
path_save_coordinates = 'coordinates.txt'
path_classifier = './classifier_test'
t = 5 #maximum spatial distance of found window centers to be clustered - if two atoms are identified as one this value could be to large
xstep = 1
ystep = 1
num_frames = 5

width=8
height=8

centers, corners = Process_TEM(path,path_classifier,width,height,xstep=xstep,ystep=ystep,t=t,num_frames=num_frames,key='/Experiments/__unnamed__/data',
                write_path=path_save_coordinates,bool_return=True,wavelet='coif1')


Processing frame 0...

Analyzing...
51480 frames
features (51480L, 43L)
1372 positive classifications in total

 30 clusters

Processing frame 1...

Analyzing...
51480 frames
features (51480L, 43L)
1398 positive classifications in total

 36 clusters

Processing frame 2...

Analyzing...
51480 frames
features (51480L, 43L)
1097 positive classifications in total

 32 clusters

Processing frame 3...

Analyzing...
51480 frames
features (51480L, 43L)
1356 positive classifications in total

 28 clusters

Processing frame 4...

Analyzing...
51480 frames
features (51480L, 43L)
1109 positive classifications in total

 31 clusters

Writing cluster centers to disk coordinates.txt...
AtomStalker\Classification.py:209: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  if c==None:

In [1]:
%matplotlib inline
from AtomStalker import load_coordinates

#reading real positions for inference
path = "./example_coordinates.txt"
loaded_positions = load_coordinates(path)
loaded_intensities = [[1]*pos.shape[1] for pos in loaded_positions] #faking some intensities (just for the IO - not actually included in the sigmoid)


loaded 282 frames

Let's connect the dots...


In [2]:
%matplotlib inline
from AtomStalker import show_trajectories
show_trajectories(loaded_positions,None,None,show_tuple=False,t_lim=(0,10))


D:\Anaconda\envs\python2vtk\lib\site-packages\matplotlib\axes\_axes.py:519: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labelled objects found. "

Tracking

For the tracking we require a sigmoid, explanation below. Here is the place where we create it.


In [3]:
from AtomStalker import SigmoidConstructor
import numpy as np

space = {'r':np.linspace(0,50,100),'dt':np.linspace(0,5,5)} #ranges for the variables included into the sigmoid
SC = SigmoidConstructor(space)
SC.create()
SC.show_sigmoid()
splined_sigmoid = SC.get_splined_sigmoid()


Linking

Given two observed atoms we can calculate their differences as $\vec{x}$, in our case $\vec{x} = (r,\theta,\Delta I,...)^T$. Using $\vec{x}$ we want to decide whether those two atoms form a link or not. This is equivalent to the classification of $\vec{x}$ into either $\mathcal{C=+}$ for "yes they form a link" or $\mathcal{C=-}$ otherwise. The idea then is to either use user input in manually specifying links from which the two classes are generated or to give an initial assumption about the distribution of those classes. Every so often these classes are then updated to adjust better to the actual observations made.

This is based on the logistic sigmoid function $\sigma(a) = \frac{1}{1+\exp{(-a)}}$ with $a=\ln\frac{p(\vec{x}|C=+)p(C=+)}{p(\vec{x}|C=-)p(C=-)}$. Hence if $p(\vec{x}|C=+) = p(\vec{x}|C=-)$ then $\sigma = 1/2$. If $C=+$ is more likely then $\sigma > 1/2$ and vice versa.

Practically this means one creates a histogram for both classes containing all available info and then plug them both into the logistic sigmoid and fit all sorts of things, splines (currently), Gaussian Processes, ...

Linking strategies

Given an atom at time $i$ and "neighboring" atoms at time $i+1$ there could be multiple $\vec{x}$ which are classified as $\mathcal{C=+}$. There we use different strategies to link, three linking strategies are implemented:

  • greedy,
  • $\varepsilon$-greedy and
  • softmax.

Greedy Strategy

The greedy strategy choses always the link with maximum sigmoid value.


In [4]:
from AtomStalker import link_positions

dt = 5
t_max = 25
t_update = 5

LM_traj_greedy, link_values_greedy = link_positions(loaded_positions,loaded_intensities,splined_sigmoid,dt=dt,t_update=t_update,t_max=t_max,
               link_type='greedy',link_paras=None,final_eval=True)


t 0
calc sigmoids and combinations 0.298000097275s...
update pos 0.0s...
updating targets 0.0130000114441s...
splitting targets 0.000999927520752s...
linking time 0.31200003624s...

t 1
calc sigmoids and combinations 0.298000097275s...
update pos 0.00399994850159s...
updating targets 0.007000207901s...
splitting targets 0.000999927520752s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0019998550415s...
linking time 0.319999933243s...

t 2
calc sigmoids and combinations 0.152000188828s...
update pos 0.000999927520752s...
updating targets 0.00999999046326s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.176000118256s...

t 3
AtomStalker\TrajectoryLinker.py:1168: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  if self.positions != None:
AtomStalker\TrajectoryLinker.py:1173: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  if self.intensities != None:
calc sigmoids and combinations 0.171999931335s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.000999927520752s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.198999881744s...

t 4
calc sigmoids and combinations 0.144000053406s...
update pos 0.0s...
updating targets 0.00400018692017s...
splitting targets 0.000999927520752s...
finding fixed 0.0s...
to_solidify 0.0019998550415s...
possible new links 0.0s...
possible new links 0.0019998550415s...
linking time 0.175000190735s...

t 5
calc sigmoids and combinations 0.232000112534s...
update pos 0.0019998550415s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.000999927520752s...
possible new links 0.00399994850159s...
linking time 0.271000146866s...
AtomStalker\TrajectoryLinker.py:1088: RuntimeWarning: divide by zero encountered in log
  a = np.log(pd_pos) - np.log(pd_neg)
AtomStalker\TrajectoryLinker.py:1088: RuntimeWarning: invalid value encountered in subtract
  a = np.log(pd_pos) - np.log(pd_neg)
t 6
calc sigmoids and combinations 0.159999847412s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.000999927520752s...
finding fixed 0.00100016593933s...
to_solidify 0.0019998550415s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.197999954224s...

t 7
calc sigmoids and combinations 0.141999959946s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.180999994278s...

t 8
calc sigmoids and combinations 0.15700006485s...
update pos 0.000999927520752s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00200009346008s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.210999965668s...

t 9
calc sigmoids and combinations 0.245000123978s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.000999927520752s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.303999900818s...

t 10
calc sigmoids and combinations 0.247000217438s...
update pos 0.000999927520752s...
updating targets 0.00600004196167s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.000999927520752s...
possible new links 0.00100016593933s...
linking time 0.294000148773s...

t 11
calc sigmoids and combinations 0.142000198364s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.000999927520752s...
possible new links 0.0s...
linking time 0.199000120163s...

t 12
calc sigmoids and combinations 0.116999864578s...
update pos 0.000999927520752s...
updating targets 0.00400018692017s...
splitting targets 0.000999927520752s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.000999927520752s...
possible new links 0.0s...
linking time 0.18700003624s...

t 13
calc sigmoids and combinations 0.125s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00200009346008s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.194999933243s...

t 14
calc sigmoids and combinations 0.0929999351501s...
update pos 0.0s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.158999919891s...

t 15
calc sigmoids and combinations 0.117000102997s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.184000015259s...

t 16
calc sigmoids and combinations 0.197999954224s...
update pos 0.0s...
updating targets 0.0130000114441s...
splitting targets 0.00100016593933s...
finding fixed 0.00200009346008s...
to_solidify 0.0019998550415s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.302000045776s...

t 17
calc sigmoids and combinations 0.106999874115s...
update pos 0.00100016593933s...
updating targets 0.00799989700317s...
splitting targets 0.00100016593933s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00100016593933s...
linking time 0.18499994278s...

t 18
calc sigmoids and combinations 0.115999937057s...
update pos 0.0s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.193000078201s...

t 19
calc sigmoids and combinations 0.115999937057s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.000999927520752s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.190999984741s...

t 20
calc sigmoids and combinations 0.111000061035s...
update pos 0.000999927520752s...
updating targets 0.00800013542175s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.194000005722s...

t 21
calc sigmoids and combinations 0.139999866486s...
update pos 0.0s...
updating targets 0.00400018692017s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.00100016593933s...
possible new links 0.00399994850159s...
linking time 0.226999998093s...

t 22
calc sigmoids and combinations 0.144999980927s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.00100016593933s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00300002098083s...
linking time 0.239000082016s...

t 23
calc sigmoids and combinations 0.133000135422s...
update pos 0.0s...
updating targets 0.00299978256226s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.000999927520752s...
possible new links 0.00100016593933s...
linking time 0.213999986649s...

t 24
calc sigmoids and combinations 0.131000041962s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.00300002098083s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.236000061035s...
Re-evaluting the links using the fitted sigmoid...
calc sigmoids and combinations 0.18499994278s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
calc sigmoids and combinations 0.15399980545s...
update pos 0.00100016593933s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.273999929428s...
update pos 0.0s...
updating targets 0.00599980354309s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.173000097275s...
update pos 0.00599980354309s...
updating targets 0.0090000629425s...
splitting targets 0.00100016593933s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.203999996185s...
update pos 0.000999927520752s...
updating targets 0.00600004196167s...
splitting targets 0.000999927520752s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.209999799728s...
update pos 0.00100016593933s...
updating targets 0.00599980354309s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
calc sigmoids and combinations 0.421000003815s...
update pos 0.0s...
updating targets 0.00600004196167s...
splitting targets 0.000999927520752s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.299000024796s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00399994850159s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.207000017166s...
update pos 0.00100016593933s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.144999980927s...
update pos 0.0s...
updating targets 0.0120000839233s...
splitting targets 0.00299978256226s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.188999891281s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.106999874115s...
update pos 0.00100016593933s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00399994850159s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0839998722076s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00300002098083s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.112999916077s...
update pos 0.000999927520752s...
updating targets 0.00300002098083s...
splitting targets 0.00100016593933s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0940001010895s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.126999855042s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.118999958038s...
update pos 0.000999927520752s...
updating targets 0.00699996948242s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.111999988556s...
update pos 0.0s...
updating targets 0.00699996948242s...
splitting targets 0.00200009346008s...
finding fixed 0.00300002098083s...
to_solidify 0.0s...
possible new links 0.00500011444092s...
possible new links 0.000999927520752s...
calc sigmoids and combinations 0.322999954224s...
update pos 0.00100016593933s...
updating targets 0.0119998455048s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
calc sigmoids and combinations 0.144999980927s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0960001945496s...
update pos 0.000999927520752s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.213999986649s...
update pos 0.00100016593933s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.125s...
update pos 0.0s...
updating targets 0.00899982452393s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.115000009537s...
update pos 0.000999927520752s...
updating targets 0.00699996948242s...
splitting targets 0.00100016593933s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.125999927521s...
update pos 0.00100016593933s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
total time 0.214999914169s...

$\varepsilon$-Greedy Strategy

The $\varepsilon$-greedy strategy is a modification of the the greedy strategy. An issue of the greedy strategy is that always chosing the link with the maximum sigmoid value between two atoms may not lead to the most likely trajectory when multiple trajectories are present. Hence one choses a $\varepsilon \in ]0,1[$. For every linking then there is the probability of $\varepsilon$ to chose a link completely at random without regard for the assigned sigmoid value.


In [5]:
dt = 5
t_max = 25
t_update = 5

#greedy
LM_traj_epsgreedy, link_values_epsgreedy = link_positions(loaded_positions,loaded_intensities,splined_sigmoid,dt=dt,t_update=t_update,t_max=t_max,
               link_type='eps-greedy',link_paras={'eps':.2},final_eval=True)


t 0
calc sigmoids and combinations 0.302999973297s...
update pos 0.0s...
updating targets 0.00699996948242s...
splitting targets 0.0s...
linking time 0.311999797821s...

t 1
calc sigmoids and combinations 0.146000146866s...
update pos 0.0s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.0s...
possible new links 0.000999927520752s...
possible new links 0.00200009346008s...
linking time 0.15900015831s...

t 2
calc sigmoids and combinations 0.197999954224s...
update pos 0.000999927520752s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00299978256226s...
linking time 0.21799993515s...

t 3
calc sigmoids and combinations 0.131999969482s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.00100016593933s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00300002098083s...
linking time 0.154000043869s...

t 4
calc sigmoids and combinations 0.167999982834s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00300002098083s...
linking time 0.197000026703s...

t 5
calc sigmoids and combinations 0.229000091553s...
update pos 0.0s...
updating targets 0.0110001564026s...
splitting targets 0.000999927520752s...
finding fixed 0.0s...
to_solidify 0.0s...
possible new links 0.000999927520752s...
possible new links 0.00200009346008s...
linking time 0.276000022888s...

t 6
calc sigmoids and combinations 0.148000001907s...
update pos 0.0s...
updating targets 0.00400018692017s...
splitting targets 0.000999927520752s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.000999927520752s...
possible new links 0.000999927520752s...
linking time 0.180999994278s...

t 7
calc sigmoids and combinations 0.139000177383s...
update pos 0.0s...
updating targets 0.00400018692017s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.000999927520752s...
possible new links 0.00200009346008s...
linking time 0.206000089645s...

t 8
calc sigmoids and combinations 0.227999925613s...
update pos 0.00100016593933s...
updating targets 0.00799989700317s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00300002098083s...
linking time 0.299000024796s...

t 9
calc sigmoids and combinations 0.128999948502s...
update pos 0.0s...
updating targets 0.00799989700317s...
splitting targets 0.00100016593933s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.00100016593933s...
possible new links 0.000999927520752s...
linking time 0.207000017166s...

t 10
calc sigmoids and combinations 0.1859998703s...
update pos 0.00100016593933s...
updating targets 0.0160000324249s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00399994850159s...
possible new links 0.00100016593933s...
possible new links 0.0019998550415s...
linking time 0.272000074387s...

t 11
calc sigmoids and combinations 0.0910000801086s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.146000146866s...

t 12
calc sigmoids and combinations 0.102999925613s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.154000043869s...

t 13
calc sigmoids and combinations 0.108999967575s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0019998550415s...
linking time 0.164000034332s...

t 14
calc sigmoids and combinations 0.148000001907s...
update pos 0.000999927520752s...
updating targets 0.0110001564026s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.00200009346008s...
possible new links 0.00200009346008s...
possible new links 0.0019998550415s...
linking time 0.28200006485s...

t 15
calc sigmoids and combinations 0.302000045776s...
update pos 0.00300002098083s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0019998550415s...
linking time 0.457000017166s...

t 16
calc sigmoids and combinations 0.115000009537s...
update pos 0.0s...
updating targets 0.0820000171661s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.262000083923s...

t 17
calc sigmoids and combinations 0.0970001220703s...
update pos 0.000999927520752s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
linking time 0.15499997139s...

t 18
calc sigmoids and combinations 0.134000062943s...
update pos 0.000999927520752s...
updating targets 0.00399994850159s...
splitting targets 0.00100016593933s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.196000099182s...

t 19
calc sigmoids and combinations 0.134999990463s...
update pos 0.000999927520752s...
updating targets 0.00800013542175s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.000999927520752s...
possible new links 0.00300002098083s...
linking time 0.217000007629s...

t 20
calc sigmoids and combinations 0.115000009537s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0019998550415s...
possible new links 0.0s...
possible new links 0.00399994850159s...
linking time 0.200000047684s...

t 21
calc sigmoids and combinations 0.120000123978s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.196000099182s...

t 22
calc sigmoids and combinations 0.148999929428s...
update pos 0.00200009346008s...
updating targets 0.00300002098083s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00200009346008s...
linking time 0.21799993515s...

t 23
calc sigmoids and combinations 0.0930001735687s...
update pos 0.0s...
updating targets 0.00299978256226s...
splitting targets 0.0s...
finding fixed 0.00500011444092s...
to_solidify 0.000999927520752s...
possible new links 0.00100016593933s...
possible new links 0.0019998550415s...
linking time 0.190999984741s...

t 24
calc sigmoids and combinations 0.118000030518s...
update pos 0.0s...
updating targets 0.00599980354309s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00300002098083s...
linking time 0.239000082016s...
Re-evaluting the links using the fitted sigmoid...
calc sigmoids and combinations 0.158999919891s...
update pos 0.000999927520752s...
updating targets 0.0090000629425s...
splitting targets 0.0s...
calc sigmoids and combinations 0.161000013351s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.195000171661s...
update pos 0.000999927520752s...
updating targets 0.00500011444092s...
splitting targets 0.000999927520752s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.131999969482s...
update pos 0.00100016593933s...
updating targets 0.0160000324249s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.169999837875s...
update pos 0.000999927520752s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00100016593933s...
calc sigmoids and combinations 0.194000005722s...
update pos 0.000999927520752s...
updating targets 0.00799989700317s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.108000040054s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.105999946594s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.137000083923s...
update pos 0.000999927520752s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.095999956131s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.12299990654s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0849997997284s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.108000040054s...
update pos 0.000999927520752s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.106999874115s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0859999656677s...
update pos 0.0s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.101000070572s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.109999895096s...
update pos 0.000999927520752s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.131999969482s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.111999988556s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.118000030518s...
update pos 0.0s...
updating targets 0.00400018692017s...
splitting targets 0.0s...
finding fixed 0.00500011444092s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.108999967575s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.139999866486s...
update pos 0.000999927520752s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.174000024796s...
update pos 0.00100016593933s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.101999998093s...
update pos 0.0s...
updating targets 0.00200009346008s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.111999988556s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
total time 0.213000059128s...

Softmax Strategy

The softmax strategy is a modification of the $\varepsilon$-greedy strategy. In the softmax strategy we assign a probability to each link available for a given position. This is done by taking the sigmoid values we obtained $\sigma$. For this the Boltzmann distribution is used $$ P(\sigma_k) = \frac{e^{-\frac{\sigma_k}{\tau}}}{\sum_{k^\prime}e^{-\frac{\sigma_{k^\prime}}{\tau}}} $$ yielding the probability for an atom and its possible link $k$ with corresponding $\sigma$ value.


In [6]:
dt = 5
t_max = 25
t_update = 5

#greedy
LM_traj_softmax, link_values_softmax = link_positions(loaded_positions,loaded_intensities,splined_sigmoid,dt=dt,t_update=t_update,t_max=t_max,
               link_type='softmax',link_paras={'tau':1.},final_eval=True)


t 0
calc sigmoids and combinations 0.242999792099s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
linking time 0.25s...

t 1
calc sigmoids and combinations 0.171999931335s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00999999046326s...
linking time 0.191999912262s...

t 2
calc sigmoids and combinations 0.25200009346s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0199999809265s...
linking time 0.289999961853s...

t 3
calc sigmoids and combinations 0.157999992371s...
update pos 0.00100016593933s...
updating targets 0.010999917984s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0170001983643s...
linking time 0.210000038147s...

t 4
calc sigmoids and combinations 0.166000127792s...
update pos 0.00200009346008s...
updating targets 0.00799989700317s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0209999084473s...
linking time 0.22200012207s...

t 5
calc sigmoids and combinations 0.383000135422s...
update pos 0.0s...
updating targets 0.0119998455048s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.00300002098083s...
possible new links 0.000999927520752s...
possible new links 0.0329999923706s...
linking time 0.483999967575s...

t 6
calc sigmoids and combinations 0.12099981308s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00800013542175s...
linking time 0.159999847412s...

t 7
calc sigmoids and combinations 0.138000011444s...
update pos 0.000999927520752s...
updating targets 0.00499987602234s...
splitting targets 0.00100016593933s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.000999927520752s...
possible new links 0.00699996948242s...
linking time 0.183000087738s...

t 8
calc sigmoids and combinations 0.138000011444s...
update pos 0.0s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0090000629425s...
linking time 0.190999984741s...

t 9
calc sigmoids and combinations 0.128000020981s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00899982452393s...
linking time 0.173000097275s...

t 10
calc sigmoids and combinations 0.208999872208s...
update pos 0.00100016593933s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0090000629425s...
linking time 0.269000053406s...

t 11
calc sigmoids and combinations 0.0920000076294s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00600004196167s...
linking time 0.137000083923s...

t 12
calc sigmoids and combinations 0.0989999771118s...
update pos 0.000999927520752s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00500011444092s...
linking time 0.164000034332s...

t 13
calc sigmoids and combinations 0.0999999046326s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00499987602234s...
linking time 0.164999961853s...

t 14
calc sigmoids and combinations 0.107000112534s...
update pos 0.0s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00500011444092s...
linking time 0.160000085831s...

t 15
calc sigmoids and combinations 0.108999967575s...
update pos 0.000999927520752s...
updating targets 0.00400018692017s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00399994850159s...
linking time 0.177999973297s...

t 16
calc sigmoids and combinations 0.111000061035s...
update pos 0.0s...
updating targets 0.00800013542175s...
splitting targets 0.0s...
finding fixed 0.0s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00799989700317s...
linking time 0.180999994278s...

t 17
calc sigmoids and combinations 0.147000074387s...
update pos 0.0s...
updating targets 0.00500011444092s...
splitting targets 0.000999927520752s...
finding fixed 0.00300002098083s...
to_solidify 0.000999927520752s...
possible new links 0.00100016593933s...
possible new links 0.00699996948242s...
linking time 0.248000144958s...

t 18
calc sigmoids and combinations 0.138000011444s...
update pos 0.0s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.000999927520752s...
possible new links 0.010999917984s...
linking time 0.226999998093s...

t 19
calc sigmoids and combinations 0.109000205994s...
update pos 0.0s...
updating targets 0.0120000839233s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.00100016593933s...
possible new links 0.010999917984s...
linking time 0.208000183105s...

t 20
calc sigmoids and combinations 0.0929999351501s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.000999927520752s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.000999927520752s...
possible new links 0.0110001564026s...
linking time 0.182999849319s...

t 21
calc sigmoids and combinations 0.118999958038s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.00799989700317s...
linking time 0.196999788284s...

t 22
calc sigmoids and combinations 0.150000095367s...
update pos 0.00200009346008s...
updating targets 0.00300002098083s...
splitting targets 0.000999927520752s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.000999927520752s...
possible new links 0.00699996948242s...
linking time 0.272000074387s...

t 23
calc sigmoids and combinations 0.111999988556s...
update pos 0.000999927520752s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00999999046326s...
linking time 0.207999944687s...

t 24
calc sigmoids and combinations 0.139000177383s...
update pos 0.000999927520752s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.00699996948242s...
linking time 0.245000123978s...
Re-evaluting the links using the fitted sigmoid...
calc sigmoids and combinations 0.169999837875s...
update pos 0.000999927520752s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
calc sigmoids and combinations 0.139999866486s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.214999914169s...
update pos 0.000999927520752s...
updating targets 0.0090000629425s...
splitting targets 0.000999927520752s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.141000032425s...
update pos 0.0s...
updating targets 0.00699996948242s...
splitting targets 0.0s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.138999938965s...
update pos 0.000999927520752s...
updating targets 0.00800013542175s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.148000001907s...
update pos 0.0s...
updating targets 0.00500011444092s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.184000015259s...
update pos 0.000999927520752s...
updating targets 0.00499987602234s...
splitting targets 0.00100016593933s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.106000185013s...
update pos 0.000999927520752s...
updating targets 0.00300002098083s...
splitting targets 0.000999927520752s...
finding fixed 0.00200009346008s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.148000001907s...
update pos 0.000999927520752s...
updating targets 0.0090000629425s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.102999925613s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.1890001297s...
update pos 0.000999927520752s...
updating targets 0.00699996948242s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.118999958038s...
update pos 0.00100016593933s...
updating targets 0.0019998550415s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00100016593933s...
calc sigmoids and combinations 0.0969998836517s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.000999927520752s...
finding fixed 0.00200009346008s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0920000076294s...
update pos 0.0s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.0989999771118s...
update pos 0.00100016593933s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
calc sigmoids and combinations 0.146999835968s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.00100016593933s...
finding fixed 0.00100016593933s...
to_solidify 0.000999927520752s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.118000030518s...
update pos 0.000999927520752s...
updating targets 0.00500011444092s...
splitting targets 0.000999927520752s...
finding fixed 0.00699996948242s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.000999927520752s...
calc sigmoids and combinations 0.167999982834s...
update pos 0.000999927520752s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.115999937057s...
update pos 0.0s...
updating targets 0.00399994850159s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.151000022888s...
update pos 0.00100016593933s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.00100016593933s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.165999889374s...
update pos 0.000999927520752s...
updating targets 0.00600004196167s...
splitting targets 0.0s...
finding fixed 0.0019998550415s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.167999982834s...
update pos 0.000999927520752s...
updating targets 0.00400018692017s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.119999885559s...
update pos 0.00100016593933s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.00100016593933s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.204999923706s...
update pos 0.000999927520752s...
updating targets 0.00300002098083s...
splitting targets 0.0s...
finding fixed 0.000999927520752s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.0s...
calc sigmoids and combinations 0.116999864578s...
update pos 0.0s...
updating targets 0.00499987602234s...
splitting targets 0.0s...
finding fixed 0.00300002098083s...
to_solidify 0.0s...
possible new links 0.0s...
possible new links 0.00100016593933s...
total time 0.221999883652s...

Some comparative analysis. Which star constellations do you see?


In [8]:
from AtomStalker import show_trajectories,show_values_vs_t

#trajectories
show_trajectories(loaded_positions,LM_traj_greedy,None,show_tuple=False,t_lim=(0,10),title='Greedy',legend=False)
show_trajectories(loaded_positions,LM_traj_epsgreedy,None,show_tuple=False,t_lim=(0,10),title='$\varepsilon$-$Greedy',legend=False)
show_trajectories(loaded_positions,LM_traj_softmax,None,show_tuple=False,t_lim=(0,10),title='Softmax',legend=False)

#q vs t
show_values_vs_t(greedy=link_values_greedy,epsgreedy=link_values_epsgreedy,softmax=link_values_softmax)


softmax: q [39.708423432083237, 46.865652159269146, 44.010580760531354, 39.591210164334711, 37.716582617946884, 36.565280380059917, 13.944210410982647, 12.504253122568079, 18.278360858327215, 15.714640476965215, 13.261367332310712, 13.340838408212791, 12.100511613383331, 12.371122572198306, 11.164197621386901, 14.686857394241478, 12.58478526282539, 17.712962435168034, 15.971357362724438, 17.571515772128272, 17.169300849661617, 16.67067932101908, 12.857327512187037, 10.692531913993179, 0],
t [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
greedy: q [43.04989249299507, 46.979138142433676, 45.447165634765227, 39.742475482935134, 39.535322760907597, 38.807450809669426, 15.770657386829392, 13.576445337973579, 19.52824485587524, 16.706623533396147, 15.103136973620265, 12.497404791746769, 9.3805888828560704, 11.320051316543413, 13.115652175322012, 13.955223445970503, 17.883505437844075, 19.421034722574692, 15.383186834850425, 18.446612684566894, 15.438846325736607, 16.794535871735977, 14.794485279919986, 10.184674931889834, 0],
t [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
epsgreedy: q [41.846040158653359, 46.682334499394479, 46.172954147124045, 37.652630819806348, 38.565208656368824, 38.19508071554155, 16.401938249518384, 13.482988679802803, 20.011481668566852, 15.698113845320769, 15.265495404351764, 13.224242748888216, 11.059018461197203, 11.492565342373744, 13.264761310475432, 14.611049541778527, 18.67050149864432, 18.988592095606624, 15.108630840075236, 18.333264863391161, 17.20286943910066, 16.625938833095724, 15.803531399046999, 9.1660567714886696, 0],
t [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]

Writing trajectories to disk


In [9]:
from AtomStalker import write_trajectories
path = "./result.traj"
write_trajectories(path,LM_traj_greedy,loaded_positions,loaded_intensities)

In [ ]: