diff --git a/module3/exo3/exercice_python_fr.org b/module3/exo3/exercice_python_fr.org index a4a48fb342202444039bda7aa320bb6ebbfead35..b02e4c3f9ece4e89abd7fe864ae0ebdf0b300a04 100644 --- a/module3/exo3/exercice_python_fr.org +++ b/module3/exo3/exercice_python_fr.org @@ -526,9 +526,41 @@ f"Les coeff sont L = {lmodel.intercept_} et C = { 1 / lmodel.coef_}" #+END_SRC #+RESULTS: -: Les coeff sont L = 3.257592785874401 et C = [2761.3155395] +: Les coeff sont L = 113.19744441078485 et C = [9479.50730539] *** Cas supérieur à la MTU +#+BEGIN_SRC python :session :results replace +import pandas as pd +import matplotlib.pyplot as plt +from matplotlib import dates +import numpy as np +from scipy import stats +import seaborn as sns +import statsmodels.api as sm +from sklearn import linear_model + +@plt.FuncFormatter +def fake_dates(x, pos): + """ Custom formater to turn floats into e.g., 2016-05-08""" + return dates.num2date(x).strftime('%Y-%m-%d') +sns.set(color_codes=True) +df = pd.DataFrame({ +'date': pd.to_datetime(date_g1500), +'datenum': dates.date2num(date_g1500), +'T': T_g1500, +'S': S_g1500}) +fig, ax = plt.subplots() +sns.regplot(x="datenum", y="T", color='purple', data=df, ax=ax) +# here's the magic: +ax.xaxis.set_major_formatter(fake_dates) +# legible labels +ax.tick_params(labelrotation=30) +fig.savefig('stacko_g1500_reglineaireT-f(S).png') +#+END_SRC + +#+RESULTS: +: None + #+BEGIN_SRC python :session from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error @@ -543,4 +575,4 @@ f"Les coeff sont L = {lmodel.intercept_} et C = { 1 / lmodel.coef_}" #+END_SRC #+RESULTS: -: Les coeff sont L = 5.867233082184833 et C = [441.71908009] +: Les coeff sont L = 120.04921279789215 et C = [-555.38712112]