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

Calibrating model requires data with date as first index #365

Open
woldmuyn opened this issue Nov 10, 2022 · 1 comment
Open

Calibrating model requires data with date as first index #365

woldmuyn opened this issue Nov 10, 2022 · 1 comment

Comments

@woldmuyn
Copy link
Contributor

woldmuyn commented Nov 10, 2022

Technical questions

  • Python version: 3.10.6
  • Operating System: Windows 64 bit

Description

While trying to calibrate my model, I got following error: Exception: Shapes of model prediction (275, 2) and (2, 275) do not correspond; np.arrays 'ymodel' and 'ydata' must be of the same size

Solution was to reorder my data so that date was the first index.

suggestion

Give users a warning that date must be the first index or do an automated reorder

@twallema
Copy link
Collaborator

I fixed this in the objective_functions.py of pySODM by automatically rearranging the dataframe with dataframe.reorder_levels()

df = df.reorder_levels([self.time_index,]+self.additional_axes_data[idx])

where, for the influenza demo,

self.time_index = 'date'
self.additional_axes_data[idx] = ['Nc',]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants