Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explorer tiles crash if there is exactly one cluster tile #24

Closed
martin-ueding opened this issue Nov 26, 2023 · 4 comments
Closed

Explorer tiles crash if there is exactly one cluster tile #24

martin-ueding opened this issue Nov 26, 2023 · 4 comments
Labels
type: bug Something isn't working
Milestone

Comments

@martin-ueding
Copy link
Owner

Reported by @pstorch:

2023-11-26 12:10:38 geo_activity_playground.webui.app ERROR Exception on /explorer/14 [GET]
Traceback (most recent call last):
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/git/geo-activity-playground/geo_activity_playground/webui/app.py", line 49, in explorer
    "explorer.html.j2", **explorer_controller.render(int(zoom))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/git/geo-activity-playground/geo_activity_playground/webui/explorer_controller.py", line 26, in render
    explored = get_three_color_tiles(tiles, self._repository, zoom)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/git/geo-activity-playground/geo_activity_playground/explorer/grid_file.py", line 83, in get_three_color_tiles
    labels = dbscan.fit_predict(cluster_tiles)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/sklearn/cluster/_dbscan.py", line 454, in fit_predict
    self.fit(X, sample_weight=sample_weight)
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/sklearn/base.py", line 1152, in wrapper
    return fit_method(estimator, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/sklearn/cluster/_dbscan.py", line 376, in fit
    X = self._validate_data(X, accept_sparse="csr")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/sklearn/base.py", line 605, in _validate_data
    out = check_array(X, input_name="X", **check_params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/.cache/pypoetry/virtualenvs/geo-activity-playground-uIcfKzN9-py3.11/lib/python3.11/site-packages/sklearn/utils/validation.py", line 938, in check_array
    raise ValueError(
ValueError: Expected 2D array, got 1D array instead:
array=[].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
2023-11-26 12:10:38 werkzeug INFO 127.0.0.1 - - [26/Nov/2023 12:10:38] "GET /explorer/14 HTTP/1.1" 500 -
@martin-ueding
Copy link
Owner Author

It seems that you have no cluster tiles yet. Is that possible?

@martin-ueding martin-ueding added this to the Next milestone Nov 26, 2023
@pstorch
Copy link

pstorch commented Nov 26, 2023

"no cluster tiles"? Do I need to install something separately?

@martin-ueding
Copy link
Owner Author

I meant that you just don't have explored any tiles which are clustered. I've tried to fix that. Can you do a git pull and try again?

@pstorch
Copy link

pstorch commented Nov 26, 2023

Explore works now. I see 4 blue and 2 red tiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants