Closed lisphilar closed 4 years ago
Dear Rakesh,
Sorry for my mistake. I wrote sceanrio
in the first comment of this issue, but it must be scenario
... just on spelling... (I revised the first comment to correct it.)
After update of CovsirPhy to add this method, I will report to you.
Dear Lisphilar,
No need to be sorry..,actually i should have also noticed it..,anyway sometimes it happens..,ok..,please let me know after adding this feature...
Dear @SM-ins , The development version was updated and enable us to
Also, 0th phase will be shown in the figure of S-R trend analysis.
Scenario.add_phase()
was deprecated (we can use currently, but this method will be removed in the future) and renamed to Scenario.add()
without any changes of arguments.
Please download the package with !pip install "git+https://github.com/lisphilar/covid19-sir.git#egg=covsirphy"
and read the documentation in https://lisphilar.github.io/covid19-sir/usage_phases.html
Dear @lisphilar/covid19-sir reply@reply.github.com ,
Thank you so much for all these informations,I read the documentation part but still I am not able to find how to set the phases in with S-R trend analysis section...,i don't find any method mentioned there..,will you please help me out....actually i want to change the dates mentioned on the graph,i.e. 22ndMay 2020 to 5th July 2020...
With regards, Rakesh
On Thu, Jul 23, 2020 at 5:00 PM Lisphilar notifications@github.com wrote:
Dear @SM-ins https://github.com/SM-ins , The development version was updated and enable us to
- delete phases
- combine phases
- separate a phases with a new change point
Also, 0th phase will be shown in the figure of S-R trend analysis.
Scenario.add_phase() was deprecated (we can use currently, but this method will be removed in the future) and renamed to Scenario.add() without any changes of arguments.
Please download the package with !pip install "git+ https://github.com/lisphilar/covid19-sir.git#egg=covsirphy" and read the documentation in https://lisphilar.github.io/covid19-sir/usage_phases.html
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lisphilar/covid19-sir/issues/126#issuecomment-662954899, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6Y4PELXLULAWY7SCDJW63R5ANMHANCNFSM4PBMM62A .
Dear Rakesh,
Thank you for your reply.
Did you try scenario.trend(set_phases=False)
after change the dates with combine
, delete
, add
or separate
? This shows the trend without overwritting the phases. combine
, delete
, add
and separate
methods are explaind in (Optional) Remove un-necessary change points manually
section etc.
I hope I understand your point.
Dear Lisphilar,
Thanks for your response..,i understood your point..,but my point is that I am able to change all other phases except starting date of first phase,i.e. 22 May...,I need to change this date...,I want to shift it to 25th March...,do you understand it now??
On Fri, Jul 24, 2020 at 6:55 PM Lisphilar notifications@github.com wrote:
Dear Rakesh, Thank you for your reply. Did you try scenario.trend(set_phases=False) after change the dates with combine, delete, add or separate? This shows the trend without overwritting the phases. combine, delete, add and separate methods are explaind in (Optional) Remove un-necessary change points manually section etc.
I hope I understand your point.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lisphilar/covid19-sir/issues/126#issuecomment-663537191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6Y4PEQXPMZ5UJY33RTFCLR5GDV3ANCNFSM4PBMM62A .
Dear Rakesh, Thank you and please run the following codes one by one.
scenario = cs.Scenario(jhu_data, population_data, country="India")
# Set phases with S-R trend analysis and keep 0th phase
scenario.trend(set_phases=True, include_init_phase=True).summary()
# Separate 0th phase on 25Mar2020
scenario.separate(date="25Mar2020", phase="0th").summary()
# Combine 1st phase 2nd phase
scenario.combine(phases=["1st", "2nd"]).summary()
# Remove 0th phase (to 24Mar2020)
scenario.delete(phases=["0th"]).summary()
This returns
Type | Start | End | Population | |
---|---|---|---|---|
1st | Past | 25Mar2020 | 07Jun2020 | 1352617328 |
2nd | Past | 08Jun2020 | 18Jun2020 | 1352617328 |
3rd | Past | 19Jun2020 | 26Jun2020 | 1352617328 |
4th | Past | 27Jun2020 | 07Jul2020 | 1352617328 |
5th | Past | 08Jul2020 | 16Jul2020 | 1352617328 |
6th | Past | 17Jul2020 | 27Jul2020 | 1352617328 |
Make sense?
I broke down the method of changing start/end date into three methods because error and error will occur for un-expected usages. Sorry for missing comments on this.
Dear Lisphilar,
Thankyou so much for the response...,but I am getting different output as mentioned below..,even while running ind_scenario.summary(), i am getting older results....Please check it once..,if possible
Type Start End Population 0th Past 16Feb2020 21May2020 1339000000 1st Past 22May2020 05Jun2020 1339000000 2nd Past 06Jun2020 16Jun2020 1339000000 3rd Past 17Jun2020 28Jun2020 1339000000 4th Past 29Jun2020 08Jul2020 1339000000 5th Past 09Jul2020 20Jul2020 1339000000 Type Start End Population 0th Past 16Feb2020 24Mar2020 1339000000 1st Past 25Mar2020 21May2020 1339000000 2nd Past 22May2020 05Jun2020 1339000000 3rd Past 06Jun2020 16Jun2020 1339000000 4th Past 17Jun2020 28Jun2020 1339000000 5th Past 29Jun2020 08Jul2020 1339000000 6th Past 09Jul2020 20Jul2020 1339000000 Type Start End Population 0th Past 16Feb2020 24Mar2020 1339000000 1st Past 25Mar2020 05Jun2020 1339000000 2nd Past 06Jun2020 16Jun2020 1339000000 3rd Past 17Jun2020 28Jun2020 1339000000 4th Past 29Jun2020 08Jul2020 1339000000 5th Past 09Jul2020 20Jul2020 1339000000 Type Start End Population 1st Past 25Mar2020 05Jun2020 1339000000 2nd Past 06Jun2020 16Jun2020 1339000000 3rd Past 17Jun2020 28Jun2020 1339000000 4th Past 29Jun2020 08Jul2020 1339000000 5th Past 09Jul2020 20Jul2020 1339000000
On Mon, Jul 27, 2020 at 8:19 PM Lisphilar notifications@github.com wrote:
Dear Rakesh, Thank you and please run the following codes one by one.
scenario = cs.Scenario(jhu_data, population_data, country="India")# Set phases with S-R trend analysis and keep 0th phasescenario.trend(set_phases=True, include_init_phase=True)print(scenario.summary())# Separate 0th phase on 25Mar2020scenario.separate(date="25Mar2020", phase="0th")print(scenario.summary())# Combine 1st phase 2nd phasescenario.combine(phases=["1st", "2nd"])print(scenario.summary())# Remove 0th phase (to 24Mar2020)scenario.delete(phases=["0th"])print(scenario.summary())
This returns Type Start End Population 1st Past 25Mar2020 07Jun2020 1352617328 2nd Past 08Jun2020 18Jun2020 1352617328 3rd Past 19Jun2020 26Jun2020 1352617328 4th Past 27Jun2020 07Jul2020 1352617328 5th Past 08Jul2020 16Jul2020 1352617328 6th Past 17Jul2020 27Jul2020 1352617328
Make sense?
I broke down the method of changing start/end date into three methods because error and error will occur for un-expected usages. Sorry for missing comments on this.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lisphilar/covid19-sir/issues/126#issuecomment-664442687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6Y4PAIVBCBDYCBVXJ5DC3R5WHXFANCNFSM4PBMM62A .
Dear Rakesh,
Thank you. The diffirence of outputs was from that of selected datasets.
The last observation date was 20Jul2020 in the Kaggle dataset and this is consistent with the end date of 5th phase. With update of datasets, change points calculated with Scenario.trend()
(that uses ruptures Python package as a dependency) will be updated.
If you have time, please consider to use CovsirPhy in your local environment as developer mode.
Update your forked repository and clone it to your local environment. Please refer to GitHub Docs: Keep your fork synced
Install dependencies with pipenv as follows in your command line tool.
pip install wheel; pip install --upgrade pip; pip install pipenv
export PIPENV_VENV_IN_PROJECT=true
export PIPENV_TIMEOUT=7200
pipenv sync --dev
Copy and rename example/usage_phases.ipynb
to example/usage_indea_scenario.ipynb
etc.
Jupyter notebook has been installed with pipenv sync --dev
command. Please open/edit/run the file with Jupyter notebook or Jupyter lab. (usage of Jupyter: Starting the Notebook Server).
Dear Lisphilar,
Thankyou for all the information....,You are right but yes time issue is there...,I will have to go from beginning...,is not there any other way to change the dates on kaggle itself...??
With regards, Rakesh
Dear Rakesh, I mentioned developer mode because you thankfully forked this repository, but you can use standard user mode (with pip installation) if Google Colaboratory is available for you. If you need further information, let me know.
@ilyasst , a collaborator of this project, is talking about this issue with the author of the dataset. The author might request a help to maintain the dataset regurally... I know it is a very time-consuming task.
Good news everyone ! The author of the dataset, SRK @ sudalairajkumar on twitter, kindly accepted to update the dataset !
Okey..does it will help us changing phases manually...??
On Fri, 31 Jul 2020, 02:48 Ilyass Tabiai, notifications@github.com wrote:
Good news everyone ! The author of the dataset, SRK @ sudalairajkumar on twitter, kindly accepted to update the dataset !
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lisphilar/covid19-sir/issues/126#issuecomment-666707050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6Y4PDL7KTOET7X7AA7IADR6HPRJANCNFSM4PBMM62A .
Dear Rakesh, I think your question about change phases manually has been solved with the following codes.
scenario = cs.Scenario(jhu_data, population_data, country="India")
# Set phases with S-R trend analysis and keep 0th phase
scenario.trend(set_phases=True, include_init_phase=True).summary()
# Separate 0th phase on 25Mar2020
scenario.separate(date="25Mar2020", phase="0th").summary()
# Combine 1st phase 2nd phase
scenario.combine(phases=["1st", "2nd"]).summary()
# Remove 0th phase (to 24Mar2020)
scenario.delete(phases=["0th"]).summary()
Because Kaggle dataset was updated, the last date in Kaggle will be the same as that with standard/developer mode.
Dear Lisphilar, Thankyou so much for your response..,sorry for late reply..,i was busy in shifting my room..,so iwas not able to check it...,today I run the given code and getting the following output:-
Type | Start | End | Population |
---|---|---|---|
Past | 25Mar2020 | 21Jun2020 | 1352617328 |
Past | 22Jun2020 | 01Jul2020 | 1352617328 |
Past | 02Jul2020 | 09Jul2020 | 1352617328 |
Past | 10Jul2020 | 20Jul2020 | 1352617328 |
Past | 21Jul2020 | 28Jul2020 | 1352617328 |
Past | 29Jul2020 | 06Aug2020 | 1352617328 |
But when I'm running ind_scenario.summary(),I am getting different output,i.e.
Type | Start | End | Population |
---|---|---|---|
Past | 05Jun2020 | 21Jun2020 | 1339000000 |
Past | 22Jun2020 | 01Jul2020 | 1339000000 |
Past | 02Jul2020 | 09Jul2020 | 1339000000 |
Past | 10Jul2020 | 20Jul2020 | 1339000000 |
Past | 21Jul2020 | 28Jul2020 | 1339000000 |
Past | 29Jul2020 | 06Aug2020 | 1339000000 |
in place of 25th March,it's showing 5th June...,will please check it once??
With regards, Rakesh
Dear Rakesh, Thank you for your support in your busy time.
Please share with me the all codes to get the outputs. How did you get the result of ind_scenario.summary()
?
Dear Lisphilar,
You are welcome.i am sharing the code below but an error has again occurred while executing your given code to set the phase manually...,i.e...
scenario = cs.Scenario(jhu_data, population_data, country="India")
scenario.trend(set_phases=True, include_init_phase=True).summary()
scenario.separate(date="25Mar2020", phase="0th").summary()
scenario.combine(phases=["1st", "2nd"]).summary()
scenario.delete(phases=["0th"]).summary()
ValueError: @end_date must be over 05Jun2020, but 24Mar2020 was applied.
Under the India scenario,I am executing following codes:- ind_scenario = cs.Scenario(jhu_data, pop_data, "India") ind_scenario.records().tail()
_ = ind_scenario.trend()
ind_scenario.summary()
o\p
Type Start End Population
1st Past 05Jun2020 22Jun2020 1339000000 2nd Past 23Jun2020 02Jul2020 1339000000 3rd Past 03Jul2020 10Jul2020 1339000000 4th Past 11Jul2020 21Jul2020 1339000000 5th Past 22Jul2020 29Jul2020 1339000000 6th Past 30Jul2020 09Aug2020 1339000000
for better understanding..,kindly refer the fork that I have created....
With regards, Rakesh
Dear @lisphilar ,
My exams were going on so i was in touch..,have you found any clue to change the phases...
With regards, Rakesh
Dear Rakesh, Lomg time no see. Please try the codes with the latest version and new data...
Dear @lisphilar ,
What is the easiest method to change the dates of phases manually? For example, when it is desired that the last phase starts 30 days earlier? Using separate gives the error:
ValueError: Cannot be separated on 12May2020 because this date is too close to registered change dates.
Could you share the dataframe returned by .summary()
?
The dataframe that was returned is:
Type Start End Population
0th Past 31Mar2020 07Apr2020 17231624 1st Past 08Apr2020 15Apr2020 17231624 2nd Past 16Apr2020 24Apr2020 17231624 3rd Past 25Apr2020 11May2020 17231624 4th Past 12May2020 08Jun2020 17231624 5th Past 09Jun2020 24Jul2020 17231624 6th Past 25Jul2020 08Aug2020 17231624 7th Past 09Aug2020 19Aug2020 17231624 8th Past 20Aug2020 31Aug2020 17231624 9th Past 01Sep2020 09Sep2020 17231624 10th Past 10Sep2020 15Sep2020 17231624 11th Past 16Sep2020 01Oct2020 17231624
To set "17Aug2020" (30 days before 16Sep2020) as the start date of the last phase,
snl.combine(phases=["7th", "8th", "9th", "10th", "11th"])
snl.separate("17Aug2020")
The start date of 8th phase will be 17Aug2020.
Great, thank you for the fast response!
Summary of new feature
In version 2.5.4, we can remove all past phases and add past phases manually. However, as mentioned by @SM-ins in #118, we sometimes need to change the start date of the 1st phase.
Solution
Add a method
Scenario.change
which enable us to change the start date of any phases manually.