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

Ferry API has null value types #17

Open
SamEdwardes opened this issue Jul 5, 2024 · 2 comments
Open

Ferry API has null value types #17

SamEdwardes opened this issue Jul 5, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@SamEdwardes
Copy link
Contributor

@brooklynbagel I noticed several of the model inputs have null value types:

  • PassengerOnly
  • FastFerry
  • arriving_precipitation
  • departing_precipitation

Screenshot 2024-07-05 at 14 06 12@2x

I think this could mean that there is no data in these fields. Can you please look into this?

@SamEdwardes SamEdwardes added the bug Something isn't working label Jul 5, 2024
@SamEdwardes
Copy link
Contributor Author

For reference, I am getting the following error when when trying to call the API with data in these fields:

File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/src/module_model_explorer.py", line 301, in predicted_delay_text
    return f"{predict_delay()} minutes"
              ^^^^^^^^^^^^^^^
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/.venv/lib/python3.12/site-packages/shiny/reactive/_reactives.py", line 284, in __call__
    return _utils.run_coro_sync(self.get_value())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/.venv/lib/python3.12/site-packages/shiny/_utils.py", line 381, in run_coro_sync
    coro.send(None)
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/.venv/lib/python3.12/site-packages/shiny/reactive/_reactives.py", line 294, in get_value
    raise self._error[0]
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/.venv/lib/python3.12/site-packages/shiny/reactive/_reactives.py", line 329, in _run_func
    self._value.append(await self._fn())
                       ^^^^^^^^^^^^^^^^
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/.venv/lib/python3.12/site-packages/shiny/_utils.py", line 263, in fn_async
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/src/module_model_explorer.py", line 275, in predict_delay
    prediction_results = predict(
                         ^^^^^^^^
  File "/Users/samedwardes/projects/posit/ds-workflows-python-2024/materials/05-shiny-app/.venv/lib/python3.12/site-packages/vetiver/server.py", line 348, in predict
    raise TypeError(re.sub(r"\n", ": ", response.text))
TypeError: [{'type': 'none_required', 'loc': ('body', 0, 'PassengerOnly'), 'msg': 'Input should be None', 'input': False}, {'type': 'none_required', 'loc': ('body', 0, 'FastFerry'), 'msg': 'Input should be None', 'input': False}, {'type': 'none_required', 'loc': ('body', 0, 'departing_precipitation'), 'msg': 'Input should be None', 'input': 0}, {'type': 'none_required', 'loc': ('body', 0, 'arriving_precipitation'), 'msg': 'Input should be None', 'input': 0}]

@brooklynbagel
Copy link
Collaborator

brooklynbagel commented Jul 29, 2024

Oddly enough, it looks like the data going in has no nulls:

from vetiver import VetiverModel

v = VetiverModel(
    model, model_name=f"{username}/ferry_delay", prototype_data=X.to_pandas()
)

X.null_count()
shape: (1, 29)
DepartingArrivingMonthWeekdayHourClassNameSpeedInKnotsEngineCountHorsepowerMaxPassengerCountPassengerOnlyFastFerryPropulsionInfoYearBuiltYearRebuiltdeparting_weather_codedeparting_temperature_2mdeparting_precipitationdeparting_cloud_coverdeparting_wind_speed_10mdeparting_wind_direction_10mdeparting_wind_gusts_10marriving_weather_codearriving_temperature_2marriving_precipitationarriving_cloud_coverarriving_wind_speed_10marriving_wind_direction_10marriving_wind_gusts_10m
u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32u32
00000000000000000000000000000
X.to_pandas().isnull().sum()
Departing                       0
Arriving                        0
Month                           0
Weekday                         0
Hour                            0
ClassName                       0
SpeedInKnots                    0
EngineCount                     0
Horsepower                      0
MaxPassengerCount               0
PassengerOnly                   0
FastFerry                       0
PropulsionInfo                  0
YearBuilt                       0
YearRebuilt                     0
departing_weather_code          0
departing_temperature_2m        0
departing_precipitation         0
departing_cloud_cover           0
departing_wind_speed_10m        0
departing_wind_direction_10m    0
departing_wind_gusts_10m        0
arriving_weather_code           0
arriving_temperature_2m         0
arriving_precipitation          0
arriving_cloud_cover            0
arriving_wind_speed_10m         0
arriving_wind_direction_10m     0
arriving_wind_gusts_10m         0
dtype: int64

I've redeployed the vetiver model a couple of times and the nulls do reproduce.

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

No branches or pull requests

2 participants