---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-4-87d72b9de908> in <module>()
2
3 basinhopping(fitness, 0.8, niter=5,
----> 4 minimizer_kwargs={'args' : ('embedded_football.gml', 'value')})
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\_basinhopping.pyc in basinhopping(func, x0, niter, T, stepsize, minimizer_kwargs, take_step, accept_test, callback, interval, disp, niter_success)
603
604 bh = BasinHoppingRunner(x0, wrapped_minimizer, take_step_wrapped,
--> 605 accept_tests, disp=disp)
606
607 # start main iteration loop
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\_basinhopping.pyc in __init__(self, x0, minimizer, step_taking, accept_tests, disp)
71
72 # do initial minimization
---> 73 minres = minimizer(self.x)
74 if not minres.success:
75 self.res.minimization_failures += 1
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\_basinhopping.pyc in __call__(self, x0)
271 return self.minimizer(x0, **self.kwargs)
272 else:
--> 273 return self.minimizer(self.func, x0, **self.kwargs)
274
275
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\_minimize.pyc in minimize(fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options)
442 return _minimize_cg(fun, x0, args, jac, callback, **options)
443 elif meth == 'bfgs':
--> 444 return _minimize_bfgs(fun, x0, args, jac, callback, **options)
445 elif meth == 'newton-cg':
446 return _minimize_newtoncg(fun, x0, args, jac, hess, hessp, callback,
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\optimize.pyc in _minimize_bfgs(fun, x0, args, jac, callback, gtol, norm, eps, maxiter, disp, return_all, **unknown_options)
932 alpha_k, fc, gc, old_fval, old_old_fval, gfkp1 = \
933 _line_search_wolfe12(f, myfprime, xk, pk, gfk,
--> 934 old_fval, old_old_fval, amin=1e-100, amax=1e100)
935 except _LineSearchError:
936 # Line search failed to find a better solution.
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\optimize.pyc in _line_search_wolfe12(f, fprime, xk, pk, gfk, old_fval, old_old_fval, **kwargs)
763 ret = line_search_wolfe1(f, fprime, xk, pk, gfk,
764 old_fval, old_old_fval,
--> 765 **kwargs)
766
767 if ret[0] is None:
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\linesearch.pyc in line_search_wolfe1(f, fprime, xk, pk, gfk, old_fval, old_old_fval, args, c1, c2, amax, amin, xtol)
99 stp, fval, old_fval = scalar_search_wolfe1(
100 phi, derphi, old_fval, old_old_fval, derphi0,
--> 101 c1=c1, c2=c2, amax=amax, amin=amin, xtol=xtol)
102
103 return stp, fc[0], gc[0], fval, old_fval, gval[0]
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\linesearch.pyc in scalar_search_wolfe1(phi, derphi, phi0, old_phi0, derphi0, c1, c2, amax, amin, xtol)
172 if task[:2] == b'FG':
173 alpha1 = stp
--> 174 phi1 = phi(stp)
175 derphi1 = derphi(stp)
176 else:
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\linesearch.pyc in phi(s)
85 def phi(s):
86 fc[0] += 1
---> 87 return f(xk + s*pk, *args)
88
89 def derphi(s):
C:\Miniconda3\envs\py27\lib\site-packages\scipy\optimize\optimize.pyc in function_wrapper(*wrapper_args)
290 def function_wrapper(*wrapper_args):
291 ncalls[0] += 1
--> 292 return function(*(wrapper_args + args))
293
294 return ncalls, function_wrapper
<ipython-input-3-18bd35b2fafa> in fitness(x, gml, labels)
26 'e_en': 0.8}
27
---> 28 return 1 - ghsom_main(params, gml, labels, lam=1000)[0][0]
29
30 def neighbour(x, p=0.1):
C:\Miniconda3\Jupyter\GHSOM_simplex_dsd\spearmint_ghsom.pyc in main(params, gml_filename, labels, lam)
624
625 return fitness(params['w'], params['eta'], params['sigma'],
--> 626 params['e_sg'], params['e_en'], gml_filename, labels, lam)
627
628 def main_no_labels(params, gml_filename, lam=10000):
C:\Miniconda3\Jupyter\GHSOM_simplex_dsd\spearmint_ghsom.pyc in fitness(w, eta, sigma, e_sg, e_en, gml_filename, labels, lam)
605
606 #run ghsom algorithm
--> 607 network, MQE = ghsom(G, lam, w, eta, sigma, float("inf"), e_sg, e_en, layer)
608
609 #label graph
C:\Miniconda3\Jupyter\GHSOM_simplex_dsd\spearmint_ghsom.pyc in ghsom(G, lam, w, eta, sigma, e_0, e_sg, e_en, layer)
449
450 #train for l epochs
--> 451 train_network(X, network, lam, eta, sigma, N)
452
453 #classify nodes
C:\Miniconda3\Jupyter\GHSOM_simplex_dsd\spearmint_ghsom.pyc in train_network(X, network, num_epochs, eta_0, sigma_0, N)
85
86 # update weights
---> 87 update_weights(x, network, win_neuron, eta, sigma)
88
89 # drop neighbourhood
C:\Miniconda3\Jupyter\GHSOM_simplex_dsd\spearmint_ghsom.pyc in update_weights(x, network, win_neuron, eta, sigma)
131
132 #new v -- move along shortest path by move distance
--> 133 v += eta * neighbourhood(network, i, win_neuron, sigma) * (x - v)
134
135 #save to network
C:\Miniconda3\Jupyter\GHSOM_simplex_dsd\spearmint_ghsom.pyc in neighbourhood(network, r, win_neuron, sigma)
139 def neighbourhood(network, r, win_neuron, sigma):
140
--> 141 return np.exp(-(nx.shortest_path_length(network, r, win_neuron)) ** 2 / (2 * sigma ** 2))
142
143 # assign nodes into clusters
C:\Miniconda3\envs\py27\lib\site-packages\networkx\algorithms\shortest_paths\generic.pyc in shortest_path_length(G, source, target, weight)
243 ## Find shortest source-target path.
244 if weight is None:
--> 245 p=nx.bidirectional_shortest_path(G,source,target)
246 paths=len(p)-1
247 else:
C:\Miniconda3\envs\py27\lib\site-packages\networkx\algorithms\shortest_paths\unweighted.pyc in bidirectional_shortest_path(G, source, target)
150 while w is not None:
151 path.append(w)
--> 152 w=succ[w]
153
154 return path
KeyboardInterrupt: