<jupyter_start><jupyter_text>Gompertz curve=============Model-----$$f\left(t\right) = a\mathrm{e}^{-b\mathrm{e}^{-ct}}$$where- $a$ is an asymptote, since $\lim_{t \rightarrow \inf} a\mathrm{e}^{-b\mathrm{e}^{-ct}} = a\mathrm{e}^{0}=a$- $b$ sets the displacement along the x-axis (translates the graph to the left or right).- $c$ sets the growth rate (y scaling)The rate of growth:$$r=\frac{f'(t)}{f(t)}=bc\mathrm{e}^{-ct}$$Coefficients-------------$$ z_i = \log\Biggl(2\frac{y_{i+1}-y_i}{y_{i+1}-y_i}\Biggr) = \log\left(r\right) $$$$ \sum\left(pt + q - z_i\right)^2 \rightarrow \min$$$$ \sum\left(pt + q - y\right) t = 0 $$$$ \sum\left(pt + q - y\right) = 0 $$$$ p\left + q\left = \left$$$$ p\left + q = \left$$$$ D = \left - \left\left $$$$ D_p = \left - \left\left$$$$ D_q = \left\left - \left\left$$$$ p = \frac{D_p}{D}, q = \frac{D_q}{D} $$$$ bc\exp\left(-ct\right) = \exp\left(pt\right)\exp\left(q\right) $$$$ c = -p, b = -\frac{\exp\left(q\right)}{p}, a = \left $$<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

from corona import *
pp = {}
country = 'Spain'
cs, dt = get_country_data(country)

y = cs.to_numpy().astype(float)

i0=33
inv = [[i0, i0+29], [i0+29, y.size]]

show_inv(y, inv)
prm = fit_all_inv(y, inv)
show_model(y, prm)
pp[country] = prm
country = 'Germany'
cs, dt = get_country_data(country)

y = cs.to_numpy().astype(float)

i0=37
inv = [[i0, i0+23], [i0+23, y.size]]

show_inv(y, inv)
prm = fit_all_inv(y, inv)
show_model(y, prm)
pp[country] = prm
country = 'Italy'
cs, dt = get_country_data(country)

y = cs.to_numpy().astype(float)


#i0=32
#inv = [[i0, i0+18], [i0+18, y.size]]
i0=29
inv = [[i0, y.size]]
show_inv(y, inv)
prm = fit_all_inv(y, inv)
show_model(y, prm)
pp[country] = prm
country = 'US'
cs, dt = get_country_data(country)

y = cs.to_numpy().astype(float)


i0=39
inv = [[i0, i0+17], [i0+17, y.size]]

show_inv(y, inv)

prm = fit_all_inv(y, inv)
show_model(y, prm)
pp[country] = prm

country = 'Russia'
cs, dt = get_country_data(country)

y = cs.to_numpy().astype(float)

i0=39
inv = [[i0, y.size]]

show_inv(y, inv)
prm = fit_all_inv(y, inv)
show_model(y, prm)
pp[country] = prm
country = 'Iran'
cs, dt = get_country_data(country)

y = cs.to_numpy().astype(float)
i0=30
inv = [[i0, i0+8], [i0+8, i0+29],[i0+29, i0+34],[i0+34, y.size]]

show_inv(y, inv)
prm = fit_all_inv(y, inv)
show_model(y, prm)
pp[country] = prm
import pickle
with open('data/countries.pickle', 'wb') as f:
    pickle.dump(pp,f)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2339321357285429, 'fraction_numerical': 0.029940119760479042, 'mean_word_length': 4.400862068965517, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '655389', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1150, 'n_words': 242, 'path': 'model.ipynb', 'repo_name': 'egorsobolev/covid19', 'size': '2505'}