<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hadrien Mariaccia on Medium]]></title>
        <description><![CDATA[Stories by Hadrien Mariaccia on Medium]]></description>
        <link>https://medium.com/@brash6?source=rss-86e2a8b65a85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DtTVgX_qKpqHTo5LDaUNrg.jpeg</url>
            <title>Stories by Hadrien Mariaccia on Medium</title>
            <link>https://medium.com/@brash6?source=rss-86e2a8b65a85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:27:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brash6/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Denoising Radar Satellite Images with Python Has Never Been So Easy]]></title>
            <link>https://medium.com/data-science/denoising-radar-satellite-images-with-python-has-never-been-so-easy-f445241002a5?source=rss-86e2a8b65a85------2</link>
            <guid isPermaLink="false">https://medium.com/p/f445241002a5</guid>
            <category><![CDATA[radar]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[image-denoising]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <dc:creator><![CDATA[Hadrien Mariaccia]]></dc:creator>
            <pubDate>Tue, 23 Apr 2024 18:04:07 GMT</pubDate>
            <atom:updated>2024-04-25T10:30:01.972Z</atom:updated>
            <content:encoded><![CDATA[<h4>Presentation of the latest release of deepdespeckling</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cw0v6NAPh0E-Zx18kGr0yQ.png" /><figcaption>Optical and radar image of an agricultural area near Nîmes, France</figcaption></figure><p>Synthetic aperture radar (SAR) images are widely use in a large variety of sectors (aerospace, military, meteorology, etc.). The problem is this kind of images <strong>suffer from noise</strong> in their raw format. While these images are also usually heavy files, the task of denoising it efficiently appears to be both challenging from a scientific perspective and very useful in the real world.</p><p>In this <a href="https://towardsdatascience.com/denoising-radar-satellite-images-using-deep-learning-in-python-946daad31022">Towards Data Science article</a>, we presented <a href="https://github.com/hi-paris/deepdespeckling"><strong>deepdespeckling</strong></a>, an open-source python package enabling to despeckle synthetic aperture radar (SAR) images using a <strong>novel deep learning based method</strong>.</p><p>We are happy to announce that we have released a <strong>new version of</strong> <strong>deepdespeckling,</strong> enabling to use both <a href="https://arxiv.org/pdf/2110.13148.pdf">MERLIN</a> and <a href="https://arxiv.org/pdf/2006.15037.pdf">SAR2SAR</a> methods for despeckling radar satellite images.</p><h4>A quick reminder on satellite images</h4><p>There are <strong>two</strong> big categories of satellite images :</p><ul><li><strong>Optical images : </strong>the ones we are used to see when we watch a weather forecast for example. These images are taken by optical sensors. <br>While these images generally provide a high level of detail, they encounter at least <strong>two significant challenges</strong> in capturing Earth’s intricacies: the limitations posed by <strong>nighttime conditions</strong> and <strong>adverse weather</strong>.</li><li><strong>Radar images : </strong>while optical systems rely on the sunlight (the sensor is passive), radars send an electromagnetic wave and measure the component backscattered by the objects on the ground (the sensor is active). radar sensors can acquire data at any time of the day and with any meteorological conditions, as the wavelength of the transmitted wave allows it to penetrate clouds. They however encounter an intrinsic issue : <strong>speckle noise</strong>.</li></ul><h4>What is speckle noise ?</h4><p><strong>Speckle</strong> is a granular interference due to bouncing properties of emitted radio waves that degrades the quality of images and therefore their interpretability with a human eye.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*-JAAgVmgsk_7IKJ8Ibo1Rg.png" /><figcaption>Example of an image respectively without and with speckle noise</figcaption></figure><h4>How to get rid of it</h4><p>Several methods exist, but deep learning has brought significant improvements for this task. <a href="https://emanueledalsasso.github.io/"><strong>Emanuele Dalsasso</strong></a><strong>, Loïc Denis and Florence Tupin</strong> developed two deep learning based methods for despeckling SAR images :</p><ul><li><a href="https://arxiv.org/pdf/2110.13148.pdf">MERLIN</a> (coMplex sElf-supeRvised despeckLINg) : a self-supervised strategy based on the separation of the real and imaginary parts of single-look complex SAR images that we presented in the previous <a href="https://towardsdatascience.com/denoising-radar-satellite-images-using-deep-learning-in-python-946daad31022">Towards Data Science article</a></li><li><a href="https://arxiv.org/pdf/2006.15037.pdf">SAR2SAR</a> : Multi-temporal time series are leveraged in order to train neural network to restore SAR images by only looking at noisy acquisitions. <strong>This method is part of the new features of the latest release of </strong><a href="https://github.com/hi-paris/deepdespeckling"><strong>deepdespeckling</strong></a><strong>. Hence, we will focus on this method in this article</strong></li></ul><h3>SAR2SAR</h3><p>Just as MERLIN, SAR2SAR also draws inspiration from the noise2noise algorithm, which showed that it is possible to train a model to denoise without looking at noise-free examples. This feature is of particular importance in SAR despeckling, as speckle-free acquisition does not exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*_EmVbI1Em7HDFRB8bmS0RA.png" /></figure><p>SAR2SAR builds on the assumption that two images acquired over the same area at different times are corrupted by <strong>two uncorrelated speckle realizations</strong>, matching with the hypothesis allowing the application of the noise2noise principle. This allows to develop a model to remove speckle from Ground Range Detected (GRD) SAR images, which are only available in amplitude (the phase is suppressed during the detection step) and thus MERLIN cannot be used on such data. Temporal acquisitions are leveraged to generate a dataset containing independent speckle realisations of the same scene (a change compensations strategy relying on a pre-trained model is used to ensure that the temporal acquisitions only differ for the speckle component).</p><p>Once the model is trained, during inference SAR2SAR requires a single GRD image and can be effectively deployed to suppress speckle from Sentinel-1 GRD SAR images.</p><h3>SAR images acquisition</h3><p>Different acquisition modes exist depending on the compromise between the illuminated scene (the swath) and and the image resolution. Each acquisition mode thus produces images having a different resolution, thus the appearance of objects is specific to each acquisition mode.</p><p>For this reason, a model specific for each modality must be developed. Given the simplicity of application of MERLIN, which requires single SAR images, datasets for each specific modality can be seamlessly collected. We have trained MERLIN on the following images:</p><ul><li>TerraSAR-X images acquired in Stripmap mode</li><li>TerraSAR-X images acquired in HighResolution SpotLight mode</li><li>Sentinel-1 images acquired in TOPS mode</li></ul><h3>deepdespeckling package usage</h3><h4>Package installation</h4><p>Before installing deepdespeckling, make sure to install gdal dependancies, it can be done using conda with the following command :</p><pre>conda install -c conda-forge gdal</pre><p>Then you can install the package this way :</p><pre>pip install deepdespeckling</pre><h4>Despeckle one image with MERLIN</h4><blockquote>To despeckle SAR images using MERLIN, images need to be in .cos or .npy format.</blockquote><p>Two parameters have to be set:</p><ul><li>model_name<em> : </em>&quot;spotlight&quot; for SAR images retrieved with spotlight mode, &quot;stripmap&quot; for SAR images retrieved with stripmap mode or &quot;Sentinel-TOPS&quot; for images retrieved with TOPS mode</li><li>symetrise<em>: d</em>uring the preprocessing steps of the noisy image for MERLIN, the real and the imaginary parts are “<strong>symetrised</strong>” (to match the theoretical assumptions of MERLIN). To skip this step, the symetrise parameter can be set to False</li></ul><pre>from deepdespeckling.utils.load_cosar import cos2mat<br>from deepdespeckling.utils.constants import PATCH_SIZE, STRIDE_SIZE<br>from deepdespeckling.merlin.merlin_denoiser import MerlinDenoiser<br><br># Path to one image (cos or npy file)<br>image_path=&quot;path/to/cosar/image&quot;<br># Model name, can be &quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot;<br>model_name = &quot;spotlight&quot;<br>symetrise = True<br><br>image = cos2mat(image_path).astype(np.float32)<br><br>denoiser = MerlinDenoiser(model_name=model_name, symetrise=symetrise)<br>denoised_image = denoiser.denoise_image(image, patch_size=PATCH_SIZE, stride_size=STRIDE_SIZE)</pre><p>This snippet of code will store the despeckled image in a <strong>numpy array</strong> in the denoised_image<em> </em>variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*233W6ZZ7JtPSMJTPicNv1w.png" /><figcaption>Example of a full size noisy SAR image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5v8kyY2K5tKi9N4CefvyaQ.png" /><figcaption>The same image denoised using MERLIN</figcaption></figure><h4>Despeckle one image with SAR2SAR</h4><blockquote>To despeckle SAR images using SAR2SAR, images need to be in .tiff or .npy format.</blockquote><pre>from deepdespeckling.utils.load_cosar import cos2mat<br>from deepdespeckling.utils.constants import PATCH_SIZE, STRIDE_SIZE<br>from deepdespeckling.sar2sar.sar2sar_denoiser import Sar2SarDenoiser<br><br># Path to one image (tiff or npy file)<br>image_path=&quot;path/to/cosar/image&quot;<br><br># Works exactly the same as with MERLIN<br>image = cos2mat(image_path).astype(np.float32)<br><br># Denoise the image with SAR2SAR<br>denoiser = Sar2SarDenoiser()<br>denoised_image = denoiser.denoise_image(image, patch_size=PATCH_SIZE, stride_size=STRIDE_SIZE)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O6aOJAm306K8g0PNoBcqXA.png" /><figcaption>Example of result using SAR2SAR (displayed after a conversion to png)</figcaption></figure><h4>Despeckle a set of images using MERLIN or SAR2SAR</h4><p>For both MERLIN and SAR2SAR, you can choose between <strong>3 different functions</strong> to despeckle a set of SAR images contained in a folder :</p><ul><li>despeckle to despeckle full size images</li><li>despeckle_from_coordinates to despeckle a sub-part of the images defined by some coordinates</li><li>despeckle_from_crop to despeckle a sub-part of the images defined using a crop tool</li></ul><p><strong>Despeckle fullsize images</strong></p><pre>from deepdespeckling.despeckling import despeckle<br><br># Path to a folder of several images <br># images have to be in .tiff or .npy formats if using sar2sar <br># images have to be in .cos or .npy formats is using merlin (&quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot;)<br>image_path=&quot;path/to/cosar/image&quot;<br># Folder where results are stored<br>destination_directory=&quot;path/where/to/save/results&quot;<br><br># Can be &quot;sar2sar&quot;, &quot;spotlight&#39; or &quot;stripmap&quot;<br>model_name = &quot;spotlight&quot;<br># symetrise parameter if using &quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot; (harmless if using &quot;sar2sar&quot;)<br>symetrise = True<br><br>despeckle(image_path, destination_directory, model_name=model_name, symetrise=symetrise)</pre><p>The despeckle function will create several folders in the destination_directory :</p><ul><li>processed_images: the <em>npy</em> files (numpy array conversion) of the raw images stored in the folder defined in image_path.</li><li>noisy:the preprocessed noisy images in both <em>.npy</em> and <em>.png</em> formats</li><li>denoised: the denoised images in both <em>.npy</em> and <em>.png</em> formats</li></ul><p><strong>Despeckle parts of images using custom coordinates</strong></p><pre>from deepdespeckling.despeckling import despeckle_from_coordinates<br><br># Path to a folder of several images <br># images have to be in .tiff or .npy formats if using sar2sar <br># images have to be in .cos or .npy formats is using merlin (&quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot;)<br>image_path=&quot;path/to/cosar/image&quot;<br># Folder where results are stored<br>destination_directory=&quot;path/where/to/save/results&quot;<br># Example of coordinates of the subparts of the images to be despeckled<br>coordinates_dictionnary = {&#39;x_start&#39;:2600,&#39;y_start&#39;:1000,&#39;x_end&#39;:3000,&#39;y_end&#39;:1200}<br><br># Can be &quot;sar2sar&quot;, &quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot;<br>model_name = &quot;spotlight&quot;<br># symetrise parameter if using &quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot; (harmless if using &quot;sar2sar&quot;)<br>symetrise = True<br><br>despeckle_from_coordinates(image_path, coordinates_dict, destination_directory, <br>                            model_name=model_name, symetrise=symetrise)</pre><p>Thedespeckle_from_coordinates function will create the same folders as thedespeckle function, with images croped with the specified coordinates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ub19eEnhx8-iM_Oi6xkNng.png" /><figcaption>Example of image denoised using custom coordinates (displayed after a conversion to png)</figcaption></figure><p><strong>Despeckle parts of images using a crop tool</strong></p><pre>from deepdespeckling.merlin.inference.despeckling import despeckle_from_crop<br><br># Path to a folder of several images <br># images have to be in .tiff or .npy formats if using sar2sar <br># images have to be in .cos or .npy formats is using merlin (&quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot;)<br>image_path=&quot;path/to/cosar/image&quot;<br># Folder where results are stored<br>destination_directory=&quot;path/where/to/save/results&quot;<br><br># If True it will crop a 256*256 image from the position of your click<br># If False you will draw free-handly the area of your interest<br>fixed = True<br># Can be &quot;sar2sar&quot;, &quot;spotlight&quot;, &quot;stripmap&quot; or &quot;Sentinel-TOPS&quot;<br>model_name = &quot;spotlight&quot;<br># symetrise parameter if using &quot;spotlight&quot;&quot;stripmap&quot; or &quot;Sentinel-TOPS&quot; (harmless if using &quot;sar2sar&quot;)<br>symetrise = True<br><br>despeckle_from_crop(image_path, destination_directory, model_name=model_name, fixed=fixed, symetrise=symetrise)</pre><blockquote>Thedespeckle_from_crop function will first launch the crop tool : just select an area and press “q” when you are satisfied with the crop</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IozCehttDmdGuQx3f0pwCw.png" /><figcaption>the cropping tool in action</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZufWqdvCOOyKU8bFuMKQjA.png" /><figcaption>Results of the denoising using the crop tool</figcaption></figure><p>Then, the despeckle_from_crop function will create :</p><ul><li>The same folders as thedespeckle function, with images cropped using the crop tool</li><li>cropping_coordinates.txt file containing the coordinates of the selected crop</li></ul><h4>Going further</h4><p>Now you know to use deepdespeckling, to understand further more how it works, you can check <a href="https://github.com/hi-paris/deepdespeckling">the github repository</a>. We also provide a sphinx documentation <a href="https://hi-paris.github.io/deepdespeckling/">available here</a>.</p><p>Feel free to contact me for any questions and feedback !</p><h4>Authors</h4><ul><li><a href="https://www.linkedin.com/in/hadrien-mar/">Hadrien Mariaccia</a></li><li><a href="https://emanueledalsasso.github.io/">Emanuele Dalsasso</a></li></ul><blockquote>Unless otherwise noted, all images are by the authors</blockquote><h4><strong>Contact</strong></h4><p>Don’t hesitate to contact me if you have any questions.</p><p>To know more about Hi! PARIS and its Engineering Team:</p><ul><li><a href="https://www.hi-paris.fr/">Hi! PARIS</a></li><li><a href="https://engineeringteam.hi-paris.fr/">Hi! PARIS Engineering Team</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f445241002a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/denoising-radar-satellite-images-with-python-has-never-been-so-easy-f445241002a5">Denoising Radar Satellite Images with Python Has Never Been So Easy</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[La régression logistique expliquée à ma grand-mère]]></title>
            <link>https://medium.com/tell-ia/la-r%C3%A9gression-logistique-expliqu%C3%A9e-%C3%A0-ma-grand-m%C3%A8re-52a2ab30788?source=rss-86e2a8b65a85------2</link>
            <guid isPermaLink="false">https://medium.com/p/52a2ab30788</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[vulgarisation]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[intelligence-artificielle]]></category>
            <dc:creator><![CDATA[Hadrien Mariaccia]]></dc:creator>
            <pubDate>Mon, 11 Nov 2019 11:32:40 GMT</pubDate>
            <atom:updated>2019-11-15T12:46:30.459Z</atom:updated>
            <content:encoded><![CDATA[<p>La régression logistique est un <strong>modèle de classification</strong> très utilisé en statistiques et notamment en apprentissage automatique. Par ailleurs, c’est une excellente introduction à plusieurs concepts clés du machine learning. <br>Je présente ici une explication intuitive de ces concepts en élaguant les parties techniques.</p><h4>Sommaire</h4><p><strong>Présentation de la régression logistique</strong><br>— Modèle de classification ?<br> — Exemple de jeu de données<br> — Le concept de relation linéaire <br> — La fonction sigmoïde<br><strong>Apprentissage</strong><br>— Maximum de vraisemblance <br> — Descente de gradient et taux d’apprentissage<br> — Résumé</p><h4>Modèle de classification ?</h4><p>Un modèle de classification est un modèle qui classe chaque instance d’un jeu de données dans une catégorie. On distingue deux grands types de modèle de classification :</p><ul><li><strong>Binaire</strong> : il n’y a que deux catégories possibles, par exemple : la potabilité d’un échantillon d’eau <em>(potable </em>ou<em> non potable)</em>.</li><li><strong>Multi-classe</strong> : il y a au moins trois catégories, par exemple : la météo un jour donné (<em>pluie</em>, <em>soleil</em> ou <em>neige</em>).</li></ul><p>La régression logistique <strong>peut s’appliquer à ces deux types de classification</strong> mais je me concentrerai ici sur son application à une <strong>classification binaire</strong>.</p><h4>Les données</h4><p>Pour apprendre, le modèle a besoin d’une <strong>base d’apprentissage</strong>, c’est à dire un ensemble d’informations donnant une idée de comment le phénomène qu’on cherche à modéliser s’est comporté dans le passé. <br>En pratique, il s’agit d’un tableau de données dans lequel chaque ligne est une observation et, chaque colonne un indicateur jouant un rôle dans la classification de l’observation.</p><p><strong>Exemple :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*-1H00zhiqvBLGaGOkIiNEQ.png" /><figcaption>Figure 1 : Jeu de données</figcaption></figure><p>Dans le jeu de données ci-dessus, chaque colonne détaille plusieurs informations recueillies sur un ensemble de patientes d’un hôpital. Ainsi, pour chaque patiente examinée, on dispose de plusieurs indicateurs médicaux, on retrouve notamment le nombre de fois que la patiente est tombée enceinte, son âge ou encore son taux de glucose dans le plasma sanguin.</p><p>La colonne qui se détache des autres ici est la colonne<strong> <em>Outcome</em></strong> qui indique si la patiente examinée souffre de diabète. <strong>Cette variable est binaire</strong>, elle vaut <strong>1 si la patiente souffre de diabète, 0 sinon.</strong></p><h4>Le concept de relation linéaire</h4><p>Pour bien comprendre la régression logistique, il faut introduire le concept de relation linéaire.</p><p>Souvenez-vous au lycée nous appelions une “fonction affine” une fonction <em>f</em> telle que <em>f(x)=ax+b</em> avec <em>a</em> le coefficient directeur et <em>b</em> l’ordonnée à l’origine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*469_4A08kFuJwrZpLrTy7A.jpeg" /><figcaption>Figure 2 : Exemple de fonction affine : ici <em>a=2</em>, autrement dit, à chaque fois qu’on avance de 1 sur l’axe des abscisses, notre fonction avance de 2 sur l’axe des ordonnées. Par ailleurs,<em> b=1,</em> on voit bien que la droite coupe l’axe des ordonnées en 1.</figcaption></figure><p>Ainsi, une relation linéaire entre 2 variables peut se définir comme suit : une relation qu’on peut représenter par une droite.</p><blockquote><strong>Une droite est une courbe dont la pente reste la même en tout point, i.e, dont la dérivée est constante.</strong></blockquote><h4>Et si on veut expliquer linéairement un phénomène à l’aide de plusieurs variables ?</h4><p>C’est un peu comme une fonction affine mais <strong>en dimension supérieure</strong>, je m’explique : Dans le jeu de données présenté précédemment, on dispose d’une multitude de variables et il est impossible de représenter géométriquement une droite qui dépendrait de chacune de ces variables pour expliquer par exemple l’âge d’une patiente. Il y a trop de dimensions !</p><p>Mais on reste capable de définir mathématiquement une sorte “d’hyper-droite” qui dépend d’un ensemble fini de variables d’entrée et qui explique une variable de sortie.</p><p>Dans notre exemple, nous avons 8 variables d’entrée, on décrit donc cette “hyper-droite” comme suit :</p><p><em>y = β</em>₀ + <em>β</em>₁X₁ + <em>β</em>₂X₂ + … + <em>β</em>₈X₈</p><ul><li><em>X</em>ᵢ : iᵉᵐᵉ variable explicative , dans notre exemple, c’est une colonne parmi {Pregnancies, Glucose, BloodPressure, SkinThickness, Insulin, BMI, DiabetesPedigreeFunction, Age}<strong><em>.</em></strong></li><li><em>β</em>ᵢ : iᵉᵐᵉ coefficient directeur de l’hyper-droite <strong>associé à la iᵉᵐᵉ variable explicative </strong>et <em>β</em>₀ l’ordonnée à l’origine. Ici, on peut interpréter <em>β</em>ᵢ comme une mesure de l’importance donnée à <em>X</em>ᵢ dans la classification : plus ce coefficient est élevé, plus <em>X</em>ᵢ joue un rôle dans l’output du modèle.</li><li><em>y</em> : la variable expliquée, ici il s’agit de <strong><em>Outcome</em></strong></li></ul><blockquote>Si on se limite à cette modélisation, on ne peut pas prendre <strong>Outcome</strong> comme variable expliquée car c’est une variable binaire et l’hyper-droite transforme chaque input en un nombre non borné qui ne permet pas de classifier l’input associé.</blockquote><h4>La fonction sigmoïde</h4><p>Pour transformer le nombre que l’hyper droite fournie en une classification, on utilise une fonction que l’on nomme fonction sigmoïde et qui a la propriété intéressante de transformer les nombres passés à l’intérieur en nombres entre 0 et 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NloTSPs4pCMYDZ8G1kxhoQ.png" /><figcaption>Figure 3 : Graphe et expression de la fonction sigmoïde.</figcaption></figure><h4>La fonction sigmoïde comme estimateur d’une probabilité</h4><p>Rappelons qu’une probabilité est un nombre entre 0 et 1, une idée importante en classification est qu’on cherche à estimer la probabilité d’appartenance à chaque classe pour ainsi être en mesure de classifier chaque nouvelle observation dans la classe associée à la probabilité la plus forte.</p><p>L’idée principale de la régression logistique est de se servir de la fonction sigmoïde pour transformer le nombre que donne l’hyper-droite en une probabilité de souffrir du diabète. Ainsi si cette probabilité <strong>est supérieure à 0.5</strong>, on classifie la patiente dans la catégorie <strong><em>“diabétique”.</em></strong></p><blockquote>Ici choisir un seuil de 0.5 semble naturel, en effet, si on estime qu’une patiente a plus de 50% de chance d’être diabétique alors on la classifie comme diabétique. En revanche, on pourrait avoir une politique de classification plus stricte pour éviter au plus possible de diagnostiquer le diabète à tort et donc choisir un seuil plus élevé. Par exemple avec un seuil de 0.8, on classifie une patiente diabétique seulement si notre modèle estime ses chances d’être diabétique à plus de 80%.</blockquote><h4>Récapitulons</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CGWiwszY086F9MHt1nJNZg.png" /><figcaption>Figure 4 : Récapitulation de la modélisation</figcaption></figure><p>Pour récapituler, pour une patiente donnée, on multiplie chaque valeur de chaque indicateur médical par son paramètre β associé. Puis on fait la somme de chacune de ces valeurs transformées. Enfin on passe cette valeur dans la fonction sigmoïde pour obtenir la probabilité que la patiente soit diabétique.</p><h4>Apprendre le paramètre β tel que le diagnostic donné par le modèle soit le plus juste possible</h4><h4>Maximum de vraisemblance</h4><p>En statistiques, “l’estimateur de maximum de vraisemblance” sert à calculer les paramètres d’un modèle de façon à ce que le modèle dépendant de ces paramètres soit le plus vraisemblable possible compte tenu des observations dont on dispose.</p><p>Plus simplement, imaginez qu’il existe une équation très générale et parfaite expliquant l’apparition du diabète chez une femme<strong>. Nous ne connaissons pas cette équation, l’objectif est donc de trouver les paramètres qui font s’approcher le plus possible notre modèle de cette équation. </strong>L’hypothèse que nous faisons est que<strong> cette équation se cache dans les données dont nous disposons.</strong></p><p>Ainsi, on va chercher à calculer le paramètre β tel que, pour chaque patiente atteinte de diabète, la probabilité estimée par notre modèle que ces patientes soient diabétiques soit maximale. Symétriquement, pour chaque patiente non diabétique, on veut que la probabilité estimée par notre modèle que ces patientes soient diabétiques soit minimale.</p><p>En raisonnant sur l’ensemble des patientes diabétiques, on souhaite que le produit des probabilités estimées que chaque patiente est diabétique soit maximale. Et symétriquement pour les patientes non diabétiques.</p><p>Ainsi, après quelques transformations mathématiques, on dispose d’une <strong>fonction dont le minimum est le point qui maximise la vraisemblance de notre modèle.</strong></p><blockquote>En apprentissage automatique, on parle de fonction de coût, <strong>c’est la fonction qui représente la différence entre ce que notre modèle prédit et la réalité</strong>. On souhaite que ce “coût” soit minimum pour que notre modèle soit le plus efficace. On souhaite donc “minimiser” cette fonction.</blockquote><p>Pour minimiser cette fonction, on utilise l’<strong>algorithme de descente de gradient</strong>.</p><h4>Descente de gradient</h4><p>Un autre concept au cœur de l’apprentissage automatique est l’algorithme de descente de gradient. Cet algorithme consiste en une descente pas à pas vers le minimum d’une fonction en utilisant le gradient de la fonction à minimiser.</p><blockquote>Le gradient d’une fonction en un point est la direction vers laquelle la pente en ce point est la plus forte. Par exemple, si vous êtes sur le flan d’une montagne, c’est la direction que vous prenez si vous voulez arriver le plus vite possible en bas de la montagne.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*B0pXOI5MZGIvvvo8UA5Ffg.png" /><figcaption>Figure 5 : Illustration en 2 dimensions d’une descente de gradient</figcaption></figure><p>Ainsi, à chaque itération de l’algorithme, on met à jour β en lui retirant son gradient multiplié par un <strong>taux d’apprentissage</strong>.</p><h4>Le taux d’apprentissage</h4><p>Le taux d’apprentissage est la valeur par laquelle on multiplie le gradient de la fonction de coût au point β, c’est ce qui va déterminer à quelle vitesse on va descendre vers le minimum de la fonction.</p><p>On dit que le taux d’apprentissage est un<strong> hyper-paramètre</strong> du modèle, c’est à dire qu’on ne peut pas choisir ce taux de façon trivial. <strong>Il faut en tester plusieurs</strong>.</p><p>Pour comprendre pourquoi ce choix n’est pas trivial, imaginez que vous êtes sur le flan d’une montagne et que vous savez dans quelle direction aller pour descendre dans la vallée mais que vous êtes capable de faire des sauts de plusieurs kilomètres d’un coup. Si vous faites un saut de plusieurs dizaines de kilomètres, il y a de fortes chances pour que vous vous retrouviez sur le flan de la montagne d’en face sans même être passé par la vallée. A l’opposé si vous faites des pas d’escargots, vous pourriez mettre un temps très long pour arriver dans la vallée.</p><p>Ainsi, avec un taux d’apprentissage adéquate, on apprend en un temps convenable le paramètre β qui minimise la fonction de coût.</p><h4>Pour résumer</h4><p>Notre modèle prend en entrée une série d’indicateurs médicaux jouant un rôle dans l’apparition du diabète. On exprime ce modèle comme une hyper-droite (dépendant de β) qu’on transforme en lui appliquant la fonction sigmoïde pour obtenir une probabilité d’être diabétique. On fait l’hypothèse que nos données sont suffisantes pour comprendre l’apparition du diabète chez une femme. Ainsi, on définit une fonction de coût dépendant de β et du jeu de données qu’on construit par maximum de vraisemblance. On minimise cette fonction en appliquant une descente de gradient pour trouver le paramètre β qui minimise le coût, i.e, qui maximise le taux de bonne prédiction sur notre jeu de données.</p><p>Si on dispose de suffisamment de données, et que celles-ci sont de bonnes qualité, notre modèle sera en mesure de classifier de nouvelles patientes avec un taux de bonnes prédictions élevé.</p><h4>L’avantage d’un tel modèle</h4><p>Ce qui est très intéressant dans la régression logistique et de manière plus générale dans les modèles d’apprentissage automatique est que l’algorithme n’a pas besoin de connaître de règles théoriques liant l’entrée du modèle et sa sortie. Le modèle de machine learning apprend tout seul ces règles en se basant uniquement sur les données.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52a2ab30788" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tell-ia/la-r%C3%A9gression-logistique-expliqu%C3%A9e-%C3%A0-ma-grand-m%C3%A8re-52a2ab30788">La régression logistique expliquée à ma grand-mère</a> was originally published in <a href="https://medium.com/tell-ia">Tell IA</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>