Skip to content

Instantly share code, notes, and snippets.

@luabida
Created August 8, 2024 13:09
Show Gist options
  • Save luabida/a2becd812e7f0b6b3c32f17edc8f9dc3 to your computer and use it in GitHub Desktop.
Save luabida/a2becd812e7f0b6b3c32f17edc8f9dc3 to your computer and use it in GitHub Desktop.
df_true:
id dates year epiweek ... train_1 train_2 target_1 target_2
0 3614204 2022-06-12 2022 202224 ... True True False False
0 3617405 2022-06-19 2022 202225 ... True True False False
0 3625692 2022-06-26 2022 202226 ... True True False False
0 3628534 2022-07-03 2022 202227 ... True True False False
0 3636802 2022-07-10 2022 202228 ... True True False False
.. ... ... ... ... ... ... ... ... ...
0 3586758 2022-05-08 2022 202219 ... True True False False
0 3592058 2022-05-15 2022 202220 ... True True False False
0 3608511 2022-06-05 2022 202223 ... True True False False
0 3597690 2022-05-22 2022 202221 ... True True False False
0 3599202 2022-05-29 2022 202222 ... True True False False
[79 rows x 15 columns]
ids: [6045]
preds: None
[08/Aug/2024 10:07:33] "GET /api/registry/predictions/?id=6045&page=1&per_page=300 HTTP/1.1" 200 21745
Internal Server Error: /vis/mae-bar-chart/
Traceback (most recent call last):
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/mosqlient/models/score.py", line 302, in __init__
df_ = transform_json_to_dataframe(get_prediction_by_id(id = int(id_)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/mosqlient/models/score.py", line 22, in transform_json_to_dataframe
json_struct = json.loads(res['prediction'])
~~~^^^^^^^^^^^^^^
TypeError: 'Prediction' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/django/views/generic/base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/services/mosqlimate/vis/views.py", line 377, in get
score = get_score_bar_chart(predictions_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/services/mosqlimate/vis/views.py", line 446, in get_score_bar_chart
score = Scorer(df_true=df, ids=list(map(int, prediction_ids)), preds=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/mosqlimate/lib/python3.12/site-packages/mosqlient/models/score.py", line 309, in __init__
raise ValueError(f"Invalid prediction_id provided inside ids:'{id_}'")
ValueError: Invalid prediction_id provided inside ids:'6045'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment