giotto-ai / giotto-deep

Deep learning made topological.
Other
75 stars 11 forks source link

[BUG] examples/optimising_topology.ipynb fails because some array is empty #61

Closed raphaelreinauer closed 2 years ago

raphaelreinauer commented 2 years ago

`[NbConvertApp] Converting notebook examples/optimising_topology.ipynb to notebook Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.7.12/x64/bin/jupyter-nbconvert", line 8, in sys.exit(main()) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/jupyter_core/application.py", line 264, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, kwargs) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/traitlets/config/application.py", line 846, in launch_instance app.start() File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 414, in start self.convert_notebooks() File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 588, in convert_notebooks self.convert_single_notebook(notebook_filename) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 552, in convert_single_notebook notebook_filename, resources, input_buffer=input_buffer File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 480, in export_single_notebook notebook_filename, resources=resources File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 189, in from_filename return self.from_file(f, resources=resources, kw) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 207, in from_file nbformat.read(file_stream, as_version=4), resources=resources, kw File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/exporters/notebook.py", line 35, in from_notebook_node nb_copy, resources = super().from_notebook_node(nb, resources, kw) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 146, in from_notebook_node nb_copy, resources = self._preprocess(nb_copy, resources) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 335, in _preprocess nbc, resc = preprocessor(nbc, resc) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/preprocessors/base.py", line 47, in call return self.preprocess(nb, resources) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 89, in preprocess self.preprocess_cell(cell, resources, index) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 110, in preprocess_cell cell = self.execute_cell(cell, index, store_history=True) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbclient/util.py", line 84, in wrapped return just_run(coro(*args, **kwargs)) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbclient/util.py", line 62, in just_run return loop.run_until_complete(coro) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete return future.result() File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbclient/client.py", line 965, in async_execute_cell await self._check_raise_for_error(cell, cell_index, exec_reply) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/nbclient/client.py", line 862, in _check_raise_for_error raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content) nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:

persistent homology after the optimisation

vr.fit_transform_plot([dist.detach().numpy()])


ValueError Traceback (most recent call last) /tmp/ipykernel_3173/723289580.py in 1 # persistent homology after the optimisation ----> 2 vr.fit_transform_plot([dist.detach().numpy()])

/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/gtda/base.py in fit_transform_plot(self, X, y, sample, plot_params) 116 """ 117 self.fit(X, y) --> 118 Xt = self.transform_plot(X, sample=sample, plot_params) 119 return Xt 120

/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/gtda/base.py in transform_plot(self, X, sample, plot_params) 141 """ 142 Xt = self.transform(X[sample:sample+1]) --> 143 self.plot({sample: Xt[0]}, sample=sample, plot_params).show() 144 return Xt

/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/gtda/homology/simplicial.py in plot(Xt, sample, homology_dimensions, plotly_params) 345 return plot_diagram( 346 Xt[sample], homology_dimensions=homology_dimensions, --> 347 plotly_params=plotly_params 348 ) 349

/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/gtda/plotting/persistence_diagrams.py in plot_diagram(diagram, homology_dimensions, plotly_params) 41 posinfinite_mask = np.isposinf(diagram_no_dims) 42 neginfinite_mask = np.isneginf(diagram_no_dims) ---> 43 max_val = np.max(np.where(posinfinite_mask, -np.inf, diagram_no_dims)) 44 min_val = np.min(np.where(neginfinite_mask, np.inf, diagram_no_dims)) 45 parameter_range = max_val - min_val

<__array_function__ internals> in amax(*args, **kwargs) /opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/numpy/core/fromnumeric.py in amax(a, axis, out, keepdims, initial, where) 27[53](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:53) """ 27[54](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:54) return _wrapreduction(a, np.maximum, 'max', axis, None, out, -> 27[55](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:55) keepdims=keepdims, initial=initial, where=where) 27[56](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:56) 27[57](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:57) /opt/hostedtoolcache/Python/3.7.12/x[64](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:64)/lib/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs) [84](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:84) return reduction(axis=axis, out=out, **passkwargs) [85](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:85) ---> [86](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:86) return ufunc.reduce(obj, axis, dtype, out, **passkwargs) [87](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:87) [88](https://github.com/giotto-ai/giotto-deep/runs/5997224707?check_suite_focus=true#step:8:88) ValueError: zero-size array to reduction operation maximum which has no identity ValueError: zero-size array to reduction operation maximum which has no identity Error: Process completed with exit code 1.`
matteocao commented 2 years ago

solved here.