I have used topsbm for quite some time on an Intel-based Mac without any significant problems. Now I changed to a Mac with the M2 processor, installed everything via conda, and when running the tutorial to check everything works I am getting the following error:
---------------------------------------------------------------------------
AxisError Traceback (most recent call last)
Cell In[9], line 13
5 model.make_graph(texts,documents=titles)
7 ## we can also skip the previous step by saving/loading a graph
8 # model.save_graph(filename = 'graph.xml.gz')
9 # model.load_graph(filename = 'graph.xml.gz')
10
11 ## fit the model
12 # gt.seed_rng(32) ## seed for graph-tool's random number generator --> same results
---> 13 model.fit()
File ~/tmp/hSBM_Topicmodel/sbmtm.py:236, in sbmtm.fit(self, overlap, n_init, verbose, epsilon)
234 for i_n_init in range(n_init):
235 base_type = gt.BlockState if not overlap else gt.OverlapBlockState
--> 236 state_tmp = gt.minimize_nested_blockmodel_dl(g,
237 state_args=dict(
238 base_type=base_type,
239 **state_args),
240 multilevel_mcmc_args=dict(
241 verbose=verbose))
242 L = 0
243 for s in state_tmp.levels:
File ~/anaconda3/envs/gt/lib/python3.11/site-packages/graph_tool/inference/minimize.py:235, in minimize_nested_blockmodel_dl(g, init_bs, state, state_args, multilevel_mcmc_args)
137 def minimize_nested_blockmodel_dl(g, init_bs=None,
138 state=NestedBlockState, state_args={},
139 multilevel_mcmc_args={}):
140 r"""Fit the nested stochastic block model, by minimizing its description length
141 using an agglomerative heuristic.
142
(...)
232
233 """
--> 235 state = state(g, bs=init_bs, **state_args)
237 args = dict(niter=1, psingle=0, beta=numpy.inf)
238 args.update(multilevel_mcmc_args)
File ~/anaconda3/envs/gt/lib/python3.11/site-packages/graph_tool/inference/nested_blockmodel.py:96, in NestedBlockState.__init__(self, g, bs, base_type, state_args, hstate_args, hentropy_args, **kwargs)
81 self.hstate_args["copy_bg"] = False
82 self.hentropy_args = dict(hentropy_args,
83 adjacency=True,
84 dense=True,
(...)
93 recs_dl=False,
94 beta_dl=1.)
---> 96 self.levels = [base_type(g, b=bs[0] if bs is not None else None,
97 **self.state_args)]
99 if bs is None:
100 if base_type is OverlapBlockState:
File ~/anaconda3/envs/gt/lib/python3.11/site-packages/graph_tool/inference/blockmodel.py:380, in BlockState.__init__(self, g, b, B, eweight, vweight, recs, rec_types, rec_params, clabel, pclabel, bfield, Bfield, deg_corr, dense_bg, **kwargs)
377 assert all(self.recdx.a >= 0), self.recdx.a
379 if deg_corr:
--> 380 init_q_cache(max(2 * max(self.get_E(), self.get_N()), 100))
382 self._entropy_args = dict(adjacency=True, deg_entropy=True, dl=True,
383 partition_dl=True, degree_dl=True,
384 degree_dl_kind="distributed", edges_dl=True,
385 dense=False, multigraph=True, exact=True,
386 recs=True, recs_dl=True, beta_dl=1.,
387 Bfield=True)
389 if len(kwargs) > 0:
File ~/anaconda3/envs/gt/lib/python3.11/site-packages/numpy/core/fromnumeric.py:2810, in max(a, axis, out, keepdims, initial, where)
2692 @array_function_dispatch(_max_dispatcher)
2693 @set_module('numpy')
2694 def max(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
2695 where=np._NoValue):
2696 """
2697 Return the maximum of an array or maximum along an axis.
2698
(...)
2808 5
2809 """
-> 2810 return _wrapreduction(a, np.maximum, 'max', axis, None, out,
2811 keepdims=keepdims, initial=initial, where=where)
File ~/anaconda3/envs/gt/lib/python3.11/site-packages/numpy/core/fromnumeric.py:88, in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
85 else:
86 return reduction(axis=axis, out=out, **passkwargs)
---> 88 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
AxisError: axis 3203 is out of bounds for array of dimension 0
I could not figure it out and was wondering if you have any idea of what may be causing this and how to fix it?
Hello,
I have used topsbm for quite some time on an Intel-based Mac without any significant problems. Now I changed to a Mac with the M2 processor, installed everything via conda, and when running the tutorial to check everything works I am getting the following error:
I could not figure it out and was wondering if you have any idea of what may be causing this and how to fix it?
Thank you in advance