diff --git a/module3/exo3/exercice_fr.ipynb b/module3/exo3/exercice_fr.ipynb index 9d4971434beb27117715f346cf79d8088441dbcb..34c98174d6edef41fde8fd20d5b9154593c11d3a 100644 --- a/module3/exo3/exercice_fr.ipynb +++ b/module3/exo3/exercice_fr.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -49,6 +49,7 @@ "from statsmodels.stats.multitest import multipletests\n", "from statsmodels.sandbox.regression.predstd import wls_prediction_std\n", "import statsmodels.formula.api as smf\n", + "import statsmodels.api as sm\n", "import scipy.stats as stats\n", "\n", "\n", @@ -883,7 +884,7 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -966,7 +967,7 @@ " Dead 7 39 51 42" ] }, - "execution_count": 118, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -1171,7 +1172,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 17, "metadata": { "hideCode": true, "hideOutput": true, @@ -1237,7 +1238,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -1319,7 +1320,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1415,7 +1416,7 @@ "3 65-more 0.586631 1.000000" ] }, - "execution_count": 18, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -1451,7 +1452,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 20, "metadata": { "hideCode": false }, @@ -1538,7 +1539,7 @@ "4 Yes Alive 81.4 65-more 0" ] }, - "execution_count": 64, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -1557,7 +1558,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 21, "metadata": { "scrolled": true }, @@ -1576,8 +1577,8 @@ "Model Family: Binomial Df Model: 1\n", "Link Function: logit Scale: 1.0000\n", "Method: IRLS Log-Likelihood: -240.21\n", - "Date: Mon, 15 Dec 2025 Deviance: 480.41\n", - "Time: 16:56:51 Pearson chi2: 568.\n", + "Date: Fri, 19 Dec 2025 Deviance: 480.41\n", + "Time: 13:10:41 Pearson chi2: 568.\n", "No. Iterations: 5 Covariance Type: nonrobust\n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", @@ -1595,8 +1596,8 @@ "Model Family: Binomial Df Model: 1\n", "Link Function: logit Scale: 1.0000\n", "Method: IRLS Log-Likelihood: -259.54\n", - "Date: Mon, 15 Dec 2025 Deviance: 519.08\n", - "Time: 16:56:51 Pearson chi2: 864.\n", + "Date: Fri, 19 Dec 2025 Deviance: 519.08\n", + "Time: 13:10:41 Pearson chi2: 864.\n", "No. Iterations: 6 Covariance Type: nonrobust\n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", @@ -1630,7 +1631,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -1656,7 +1657,7 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 23, "metadata": { "hideCode": false }, @@ -1724,7 +1725,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -1748,10 +1749,10 @@ " Method: IRLS Log-Likelihood: -499.74 \n", "\n", "\n", - " Date: Mon, 15 Dec 2025 Deviance: 999.49 \n", + " Date: Fri, 19 Dec 2025 Deviance: 999.49 \n", "\n", "\n", - " Time: 17:22:33 Pearson chi2: 1.43e+03 \n", + " Time: 13:10:42 Pearson chi2: 1.43e+03 \n", "\n", "\n", " No. Iterations: 6 Covariance Type: nonrobust\n", @@ -1785,8 +1786,8 @@ "Model Family: Binomial Df Model: 3\n", "Link Function: logit Scale: 1.0000\n", "Method: IRLS Log-Likelihood: -499.74\n", - "Date: Mon, 15 Dec 2025 Deviance: 999.49\n", - "Time: 17:22:33 Pearson chi2: 1.43e+03\n", + "Date: Fri, 19 Dec 2025 Deviance: 999.49\n", + "Time: 13:10:42 Pearson chi2: 1.43e+03\n", "No. Iterations: 6 Covariance Type: nonrobust\n", "=====================================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", @@ -1799,7 +1800,7 @@ "\"\"\"" ] }, - "execution_count": 95, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -1828,157 +1829,155 @@ }, { "cell_type": "code", - "execution_count": 157, - "metadata": {}, + "execution_count": 43, + "metadata": { + "hideCode": true + }, "outputs": [ { - "data": { - "text/plain": [ - "['Package Version ',\n", - " '---------------------- -------------------',\n", - " 'alembic 1.3.3 ',\n", - " 'asn1crypto 1.3.0 ',\n", - " 'async-generator 1.10 ',\n", - " 'attrs 19.3.0 ',\n", - " 'backcall 0.1.0 ',\n", - " 'beautifulsoup4 4.6.3 ',\n", - " 'bleach 3.1.0 ',\n", - " 'blinker 1.4 ',\n", - " 'bokeh 0.12.16 ',\n", - " 'certifi 2020.4.5.1 ',\n", - " 'certipy 0.1.3 ',\n", - " 'cffi 1.13.2 ',\n", - " 'chardet 3.0.4 ',\n", - " 'cloudpickle 0.5.6 ',\n", - " 'conda 4.8.2 ',\n", - " 'conda-package-handling 1.6.0 ',\n", - " 'cryptography 2.5 ',\n", - " 'cycler 0.10.0 ',\n", - " 'Cython 0.28.5 ',\n", - " 'cytoolz 0.10.1 ',\n", - " 'dask 2.11.0 ',\n", - " 'decorator 4.4.1 ',\n", - " 'defusedxml 0.6.0 ',\n", - " 'dill 0.2.9 ',\n", - " 'entrypoints 0.3 ',\n", - " 'fastcache 1.1.0 ',\n", - " 'gmplot 1.2.0 ',\n", - " 'gmpy2 2.1.0b1 ',\n", - " 'h5py 2.7.1 ',\n", - " 'hide-code 0.5.3 ',\n", - " 'idna 2.9 ',\n", - " 'imageio 2.8.0 ',\n", - " 'inflect 4.0.0 ',\n", - " 'ipykernel 5.1.4 ',\n", - " 'ipython 7.12.0 ',\n", - " 'ipython-genutils 0.2.0 ',\n", - " 'ipywidgets 7.2.1 ',\n", - " 'isoweek 1.3.3 ',\n", - " 'jaraco.itertools 5.0.0 ',\n", - " 'jedi 0.16.0 ',\n", - " 'Jinja2 2.11.0 ',\n", - " 'json5 0.8.5 ',\n", - " 'jsonschema 3.0.2 ',\n", - " 'jupyter 1.0.0 ',\n", - " 'jupyter-client 6.0.0 ',\n", - " 'jupyter-console 6.1.0 ',\n", - " 'jupyter-core 4.6.3 ',\n", - " 'jupyter-telemetry 0.0.4 ',\n", - " 'jupyterhub 0.8.1 ',\n", - " 'jupyterlab 1.2.5 ',\n", - " 'jupyterlab-server 1.0.6 ',\n", - " 'kiwisolver 1.1.0 ',\n", - " 'llvmlite 0.23.0 ',\n", - " 'Mako 1.1.0 ',\n", - " 'MarkupSafe 1.1.1 ',\n", - " 'matplotlib 2.2.3 ',\n", - " 'mistune 0.8.4 ',\n", - " 'more-itertools 8.2.0 ',\n", - " 'mpmath 1.1.0 ',\n", - " 'nbconvert 5.6.1 ',\n", - " 'nbformat 5.0.4 ',\n", - " 'nbgit 0.0.1 ',\n", - " 'networkx 2.4 ',\n", - " 'notebook 6.0.3 ',\n", - " 'numba 0.38.1 ',\n", - " 'numexpr 2.6.9 ',\n", - " 'numpy 1.15.2 ',\n", - " 'oauthlib 3.0.1 ',\n", - " 'olefile 0.46 ',\n", - " 'packaging 20.1 ',\n", - " 'pamela 1.0.0 ',\n", - " 'pandas 0.22.0 ',\n", - " 'pandocfilters 1.4.2 ',\n", - " 'parso 0.6.0 ',\n", - " 'patsy 0.5.1 ',\n", - " 'pdfkit 0.6.1 ',\n", - " 'pexpect 4.8.0 ',\n", - " 'pickleshare 0.7.5 ',\n", - " 'Pillow 7.0.0 ',\n", - " 'pip 20.0.2 ',\n", - " 'prometheus-client 0.7.1 ',\n", - " 'prompt-toolkit 3.0.3 ',\n", - " 'protobuf 3.11.3 ',\n", - " 'ptyprocess 0.6.0 ',\n", - " 'pycosat 0.6.3 ',\n", - " 'pycparser 2.19 ',\n", - " 'pycurl 7.43.0.1 ',\n", - " 'Pygments 2.5.2 ',\n", - " 'PyJWT 1.7.1 ',\n", - " 'pyOpenSSL 19.0.0 ',\n", - " 'pyparsing 2.4.6 ',\n", - " 'pyrsistent 0.15.7 ',\n", - " 'PySocks 1.7.1 ',\n", - " 'python-dateutil 2.8.1 ',\n", - " 'python-editor 1.0.4 ',\n", - " 'python-json-logger 0.1.11 ',\n", - " 'python-oauth2 1.1.1 ',\n", - " 'pytz 2019.3 ',\n", - " 'PyWavelets 1.1.1 ',\n", - " 'PyYAML 5.3 ',\n", - " 'pyzmq 17.1.2 ',\n", - " 'qtconsole 4.6.0 ',\n", - " 'requests 2.23.0 ',\n", - " 'rpy2 2.9.4 ',\n", - " 'ruamel-yaml 0.15.80 ',\n", - " 'ruamel.yaml 0.16.5 ',\n", - " 'scikit-image 0.14.3 ',\n", - " 'scikit-learn 0.19.2 ',\n", - " 'scipy 1.1.0 ',\n", - " 'seaborn 0.8.1 ',\n", - " 'Send2Trash 1.5.0 ',\n", - " 'setuptools 45.2.0.post20200209',\n", - " 'sh 1.12.14 ',\n", - " 'simplegeneric 0.8.1 ',\n", - " 'six 1.14.0 ',\n", - " 'SQLAlchemy 1.2.18 ',\n", - " 'statsmodels 0.9.0 ',\n", - " 'sympy 1.1.1 ',\n", - " 'terminado 0.8.3 ',\n", - " 'testpath 0.4.4 ',\n", - " 'toolz 0.10.0 ',\n", - " 'tornado 6.0.3 ',\n", - " 'tqdm 4.42.0 ',\n", - " 'traitlets 4.3.3 ',\n", - " 'tzlocal 2.0.0 ',\n", - " 'urllib3 1.25.7 ',\n", - " 'vincent 0.4.4 ',\n", - " 'wcwidth 0.1.8 ',\n", - " 'webencodings 0.5.1 ',\n", - " 'wheel 0.34.2 ',\n", - " 'widgetsnbextension 3.2.1 ',\n", - " 'xlrd 1.2.0 ',\n", - " 'zipp 2.1.0 ']" - ] - }, - "execution_count": 157, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "### <> IPython == 7.12.0 ##\n", + " - IPython.core.release == 7.12.0\n", + "### <> OpenSSL == 19.0.0 ##\n", + " - OpenSSL.version == 19.0.0\n", + "### <> PIL == 7.0.0 ##\n", + " - PIL.Image == 7.0.0\n", + " - PIL._version == 7.0.0\n", + "### <> _cffi_backend == 1.13.2 ##\n", + "### <> _csv == 1.0 ##\n", + "### <> _ctypes == 1.1.0 ##\n", + "### <> _curses == b'2.2' ##\n", + "### <> _decimal == 1.70 ##\n", + "### <> argparse == 1.1 ##\n", + "### <> asn1crypto == 1.3.0 ##\n", + " - asn1crypto.version == 1.3.0\n", + "### <> backcall == 0.1.0 ##\n", + "### <> certifi == 2020.04.05.1 ##\n", + "### <> cffi == 1.13.2 ##\n", + "### <> chardet == 3.0.4 ##\n", + " - chardet.version == 3.0.4\n", + "### <> cryptography == 2.5 ##\n", + " - cryptography.__about__ == 2.5\n", + "### <> csv == 1.0 ##\n", + "### <> ctypes == 1.1.0 ##\n", + "### <> cycler == 0.10.0 ##\n", + "### <> dateutil == 2.8.1 ##\n", + "### <> decimal == 1.70 ##\n", + "### <> decorator == 4.4.1 ##\n", + "### <> distutils == 3.6.4 ##\n", + "### <> idna == 2.9 ##\n", + " - idna.idnadata == 12.1.0\n", + " - idna.package_data == 2.9\n", + "### <> ipaddress == 1.0 ##\n", + "### <> ipykernel == 5.1.4 ##\n", + " - ipykernel._version == 5.1.4\n", + "### <> ipython_genutils == 0.2.0 ##\n", + " - ipython_genutils._version == 0.2.0\n", + "### <> ipywidgets == 7.2.1 ##\n", + " - ipywidgets._version == 7.2.1\n", + "### <> jedi == 0.16.0 ##\n", + "### <> json == 2.0.9 ##\n", + "### <> jupyter_client == 6.0.0 ##\n", + " - jupyter_client._version == 6.0.0\n", + "### <> jupyter_core == 4.6.3 ##\n", + " - jupyter_core.version == 4.6.3\n", + "### <> kiwisolver == 1.1.0 ##\n", + "### <> logging == 0.5.1.2 ##\n", + "### <> matplotlib == 2.2.3 ##\n", + " - matplotlib.backends.backend_agg == 2.2.3\n", + "### <> numexpr == 2.6.9 ##\n", + "### <> numpy == 1.15.2 ##\n", + " - numpy.core == 1.15.2\n", + " - numpy.core.multiarray == 3.1\n", + " - numpy.lib == 1.15.2\n", + " - numpy.linalg._umath_linalg == b'0.1.5'\n", + " - numpy.matlib == 1.15.2\n", + "### <> optparse == 1.5.3 ##\n", + "### <> pandas == 0.22.0 ##\n", + " - pandas._libs.json == 1.33\n", + "### <> parso == 0.6.0 ##\n", + "### <> patsy == 0.5.1 ##\n", + " - patsy.version == 0.5.1\n", + "### <> pexpect == 4.8.0 ##\n", + "### <> pickleshare == 0.7.5 ##\n", + "### <> platform == 1.0.8 ##\n", + "### <> prompt_toolkit == 3.0.3 ##\n", + "### <> ptyprocess == 0.6.0 ##\n", + "### <> pygments == 2.5.2 ##\n", + "### <> pyparsing == 2.4.6 ##\n", + "### <> pytz == 2019.3 ##\n", + "### <> re == 2.2.1 ##\n", + "### <> requests == 2.23.0 ##\n", + " - requests.__version__ == 2.23.0\n", + " - requests.packages.chardet == 3.0.4\n", + " - requests.packages.chardet.version == 3.0.4\n", + " - requests.packages.idna == 2.9\n", + " - requests.packages.idna.idnadata == 12.1.0\n", + " - requests.packages.idna.package_data == 2.9\n", + " - requests.packages.urllib3 == 1.25.7\n", + " - requests.packages.urllib3.packages.six == 1.12.0\n", + " - requests.utils == 2.23.0\n", + "### <> scipy == 1.1.0 ##\n", + " - scipy._lib.decorator == 4.0.5\n", + " - scipy._lib.six == 1.2.0\n", + " - scipy.fftpack._fftpack == b'$Revision: $'\n", + " - scipy.fftpack.convolve == b'$Revision: $'\n", + " - scipy.integrate._dop == b'$Revision: $'\n", + " - scipy.integrate._ode == $Id$\n", + " - scipy.integrate._odepack == 1.9 \n", + " - scipy.integrate._quadpack == 1.13 \n", + " - scipy.integrate.lsoda == b'$Revision: $'\n", + " - scipy.integrate.vode == b'$Revision: $'\n", + " - scipy.interpolate._fitpack == 1.7 \n", + " - scipy.interpolate.dfitpack == b'$Revision: $'\n", + " - scipy.linalg == 0.4.9\n", + " - scipy.linalg._fblas == b'$Revision: $'\n", + " - scipy.linalg._flapack == b'$Revision: $'\n", + " - scipy.linalg._flinalg == b'$Revision: $'\n", + " - scipy.ndimage == 2.0\n", + " - scipy.optimize._cobyla == b'$Revision: $'\n", + " - scipy.optimize._lbfgsb == b'$Revision: $'\n", + " - scipy.optimize._minpack == 1.10 \n", + " - scipy.optimize._nnls == b'$Revision: $'\n", + " - scipy.optimize._slsqp == b'$Revision: $'\n", + " - scipy.optimize.minpack2 == b'$Revision: $'\n", + " - scipy.signal.spline == 0.2\n", + " - scipy.sparse.linalg.eigen.arpack._arpack == b'$Revision: $'\n", + " - scipy.sparse.linalg.isolve._iterative == b'$Revision: $'\n", + " - scipy.special.specfun == b'$Revision: $'\n", + " - scipy.stats.mvn == b'$Revision: $'\n", + " - scipy.stats.statlib == b'$Revision: $'\n", + "### <> seaborn == 0.8.1 ##\n", + " - seaborn.external.husl == 2.1.0\n", + " - seaborn.external.six == 1.10.0\n", + "### <> six == 1.14.0 ##\n", + "### <> socks == 1.7.1 ##\n", + "### <> statsmodels == 0.9.0 ##\n", + " - statsmodels.__init__ == 0.9.0\n", + "### <> traitlets == 4.3.3 ##\n", + " - traitlets._version == 4.3.3\n", + " - urllib.request == 3.6\n", + "### <> urllib3 == 1.25.7 ##\n", + " - urllib3.packages.six == 1.12.0\n", + "### <> zlib == 1.0 ##\n", + "### <> zmq == 17.1.2 ##\n", + " - zmq.sugar == 17.1.2\n", + " - zmq.sugar.version == 17.1.2\n" + ] } ], "source": [ - "all_packages =!pip list\n", - "all_packages" + "list_import = sorted([name for name, module in sys.modules.items() \n", + " if module is not None and hasattr(module,'__version__')])\n", + "for pkg in list_import :\n", + " try:\n", + " if '.' not in pkg : \n", + " print(f\"### <> {pkg} == {sys.modules[pkg].__version__} ##\")\n", + " else : print(f\" - {pkg} == {sys.modules[pkg].__version__}\")\n", + " except AttributeError: \n", + " pass" ] } ],