<?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 Emrick Sinitambirivoutin on Medium]]></title>
        <description><![CDATA[Stories by Emrick Sinitambirivoutin on Medium]]></description>
        <link>https://medium.com/@e.birivoutin?source=rss-276e6e236aa8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XHEh7q8M9MHOG0C0U-7viA.jpeg</url>
            <title>Stories by Emrick Sinitambirivoutin on Medium</title>
            <link>https://medium.com/@e.birivoutin?source=rss-276e6e236aa8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 19:10:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@e.birivoutin/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[An introduction to Variational Auto Encoders (VAEs)]]></title>
            <link>https://medium.com/data-science/an-introduction-to-variational-auto-encoders-vaes-803ddfb623df?source=rss-276e6e236aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/803ddfb623df</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[generative-model]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Emrick Sinitambirivoutin]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 20:36:12 GMT</pubDate>
            <atom:updated>2020-06-22T12:20:09.121Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding Variational Autoencoders (VAEs) from theory to practice using PyTorch</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFlWccqyFYpJjWvv5tUEqQ.jpeg" /><figcaption>Art work from <a href="https://joanielemercier.com/">https://joanielemercier.com/</a> (Eyjafjallajökull, NY, May 2010 — commissioned by onedotzero)</figcaption></figure><p>VAE are latent variable models [1,2]. Such models rely on the idea that the data generated by a model can be parametrized by some variables that will generate some specific characteristics of a given data point. These variables are called latent variables.</p><p>One of the key ideas behind VAE is that instead of trying to construct a latent space (space of latent variables) explicitly and to sample from it in order to find samples that could actually generate proper outputs (as close as possible to our distribution), we construct an Encoder-Decoder like network which is split in two parts:</p><ul><li>The encoder learns to generate a distribution depending on input samples X from which we can sample a latent variable that is highly likely to generate X samples. In other words we learn a set of parameters θ1 that generate a distribution Q(X,θ1) from which we can sample a latent variable z maximizing P(X|z).</li><li>The decoder part learns to generate an output which belongs to the real data distribution given a latent variable z as an input. In other words, we learn a set of parameters θ2 that generates a function f(z,θ2) that maps the latent distribution that we learned to the real data distribution of the dataset.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLLC3nrS42oCdzz4hRDmGA.png" /><figcaption>Variational Auto Encoder global architecture</figcaption></figure><p>In order to understand the mathematics behind Variational Auto Encoders, we will go through the theory and see why these models works better than older approaches.</p><h4>This article will cover the following</h4><ul><li>How to define the construct the latent space</li><li>How to generate data efficiently from latent space sampling.</li><li>The final architecture of VAEs</li><li>Some experiments showing interesting properties of VAEs</li></ul><h3>1. Latent Variable Models</h3><p>Latent variable models come from the idea that the data generated by a model needs to be parametrized by <em>latent </em>variables. This name comes from the fact that given just a data point produced by the model, we don’t necessarily know which settings of the latent variables generated this data point.</p><p>In a more formal setting, we have a vector of latent variables <em>z</em> in a high-dimensional space Z which we can easily sample according to some probability density function <em>P</em>(<em>z</em>) defined over Z. Then, we have a family of deterministic functions <em>f</em> (<em>z</em>; <em>θ</em>), parameterized by a vector <em>θ</em> in some space Θ, where <em>f</em> :Z×Θ→X. <em>f</em> is deterministic, but if <em>z</em> is random and <em>θ</em> is fixed, then <em>f</em> (<em>z</em>; <em>θ</em>) is a random variable in the space X .</p><p>During training, we optimize <em>θ</em> such that we can sample <em>z</em> from <em>P</em>(<em>z</em>) and, with high probability, having <em>f</em> (<em>z</em>; <em>θ</em>) as close as the <em>X</em>’s in the dataset. In order to achieve that, we need to find the parameters <em>θ</em> such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*1hQWI-QQJPq59o0mObQCOA.png" /></figure><p>Here, we just replace <em>f</em> (<em>z</em>; <em>θ</em>) by a distribution <em>P</em>(<em>X</em>|<em>z</em>; <em>θ</em>) in order to make the dependence of <em>X</em> on <em>z</em> explicit by using the law of total probability. An other assumption that we make is to suppose that P(W|z;<em>θ</em>) follow a Gaussian distribution N(X|<em>f</em> (<em>z</em>; <em>θ</em>), σ*I) (By doing so we consider that generated data are almost as X but not exactly X).</p><h4>Defining the latent space</h4><p>As explained in the beginning, the latent space is supposed to model a space of variables influencing some specific characteristics of our data distribution. We can imagine that if the dataset that we consider is composed of cars and that our data distribution is then the space of all possible cars, some components of our latent vector would influence the color, the orientation or the number of doors of a car.</p><p>However, it is rapidly very tricky to explicitly define the role of each latent components, particularly when we are dealing with hundreds of dimensions. In addition to that, some component can depends on others which makes it even more complex to design by hand this latent space. In other words, it’s really difficult to define this complex distribution P(z).</p><h4>Solution</h4><p>In order to overcome this issue, the trick is to use a mathematical property of probability distributions and the ability of neural networks to learn some deterministic functions under some constrains with backpropagation.</p><p>The mathematical property that makes the problem way more tractable is that:</p><blockquote>Any distribution in d dimensions can be generated by taking a set of d variables that are normally distributed and mapping them through a sufficiently complicated function.</blockquote><p>As a consequence, we can arbitrarily decide our latent variables to be Gaussians and then construct a deterministic function that will map our Gaussian latent space into the complex distribution from which we will sample to generate our data.</p><p>The deterministic function needed to map our simple latent distribution into a more complex one that would represent our complex latent space can then be build using a neural network with some parameters that can be fine tuned during training.</p><h3>2. Learn to generate data from the latent space</h3><p>Before jumping into the interesting part of this article, let’s recall our final goal:</p><p>We have a d dimensional latent space which is normally distributed and we want to learn a function f(z;θ2) that will map our latent distribution to our real data distribution. In other words we want to sample latent variables and then use this latent variable as an input of our generator in order to generate a data sample that will be as close as possible of a real data points.</p><p><strong>We still need to resolve two things:</strong></p><ul><li>How do we explore our latent space efficiently in order to discover the z that will maximize the probability P(X|z)? (we need to find the right z for a given X during training)</li><li>How do we train this all process using back propagation? (we need to find an objective that will optimize f to map P(z) to P(X))</li></ul><h4>Finding the right z latent variable for our X data sample</h4><p>In practice, for most <em>z</em>, <em>P</em>(X|z) will be nearly zero, and hence contribute almost nothing to our estimate of <em>P</em>(X). The key idea behind the variational auto-encoder is to attempt to sample values of z that are likely to have produced X, and compute P(X) just from those. In order to do that, we need a new function <em>Q</em>(z|X) which can take a value of X and give us a distribution over z values that are likely to produce X. Hopefully the space of z values that are likely under Q will be much smaller than the space of all z’s that are likely under the prior P(z).</p><p>This part of the VAE will be the encoder and we will assume that Q will be learned during training by a neural network mapping the input X to the output Q(z|X) which will be the distribution from which we are most likely to find a good z to generate this particular X.</p><h4>Training the model with backpropagation</h4><p>In order to understand how to train our VAE, we first need to define what should be the objective, and to do so, we will first need to do a little bit of maths.</p><p>Let’s start with the Encoder, we want Q(z|X) to be as close as possible to P(X|z). In order to measure how close the two distributions are, we can use the Kullback-Leibler divergence D between the two distributions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*zepP53OnKeHbcEC1j4p8yQ.png" /></figure><p>With a little bit of maths, we can rewrite this equality in a more interesting way.</p><p>By applying the Bayes rule on P(z|X) we have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68oDoQTs_1WcGyV-ulrA1g.png" /></figure><p>Which is equivalent to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ULfMZV9N9wV5wRg7p3FFA.png" /></figure><p><strong>Let’s take a time to look at this formulae</strong></p><ul><li><strong>Part A</strong>: The left term is not really interesting for our backpropagation setting (we don’t know a simple expression for P(X)), but log(P(X)) is actually what we want to maximize given a z and we can see here that we can do so by minimizing the right part (making Q(z|X) as close as possible to P(z|X)). This is exactly what we mentioned at the beginning.</li><li><strong>Part B</strong>: This term is much more interesting as we know P(X|z) (it’s our decoder part -&gt; generator) and Q(z|X) (it’s our encoder). We can see here that in order to maximize this term, we need to maximize log(P(X|z)) which means that we wan’t to maximize the log likelihood of our probability and minimize the KL Divergence between Q(z|X) and P(z).</li></ul><p>In order to make <strong>Part B</strong> more easy to compute is to suppose that Q(z|X) is a gaussian distribution N(z|mu(X,θ1), sigma(X,θ1)) where θ1 are the parameters learned by our neural network from our data set.</p><p>One issue remains unclear with our formulae : How do we compute the expectation during backpropagation ?</p><p><strong>Handling the expectation operator</strong></p><p>One way would be to do multiple forward pass in order to be able to compute the expectation of the log(P(X|z)) but this is computationally inefficient. Hopefully, as we are in a stochastic training, we can supposed that the data sample Xi that we we use during the epoch is representative of the entire dataset and thus it is reasonable to consider that the log(P(Xi|zi)) that we obtain from this sample Xi and the dependently generated zi is representative of the expectation over Q of log(P(X|z)).</p><p>Finally, the decoder is simply a generator model that we want to reconstruct the input image so a simple approach is to use the mean square error between the input image and the generated image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFRoN-ex9Yrj6pXr9At1FQ.png" /></figure><h3>3. Final architecture of VAEs</h3><p>We can know resume the final architecture of a VAE. As announced in the introduction, the network is split in two parts:</p><ul><li>The encoder that learns to generate a distribution depending on input samples X from which we can sample a latent variable that is highly likely to generate X samples. This part needs to be optimized in order to enforce our Q(z|X) to be gaussian.</li><li>The decoder part learns to generate an output which belongs to the real data distribution given a latent variable z as an input. This part maps a sampled z (initially from a normal distribution) into a more complex latent space (the one actually representing our data) and from this complex latent variable z generate a data point which is as close as possible to a real data point from our distribution.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*g1RivMJgAG1-InJ0MeRk6w.png" /><figcaption>Variational Auto Encoder detailed architecture. (Left) and (right) are equivalent but we cannot do backpropagation in the (left) example, so we use the (right) one in practice.</figcaption></figure><h3>4. Experiments with VAEs</h3><p>Now that you know all the mathematics behind Variational Auto Encoders, let’s see what we can do with these generative models by making some experiments using PyTorch.</p><p><strong>Global architecture in PyTorch</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf55c94e212cb56d18e3d1fc204889f9/href">https://medium.com/media/cf55c94e212cb56d18e3d1fc204889f9/href</a></iframe><p><strong>Training</strong></p><p>The following plots shows the results that we get during training. For this demonstration, the VAE have been trained on the MNIST dataset [3]. Every 10 epochs, we plot the input X and the generated data that produced the VAE for this given input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ANVJGHLqwpGMI4Hf3PdHcg.png" /><figcaption>Training samples (input up, output bottom) — epoch 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XvQYzR2Hlp54M1zgmeA4vQ.png" /><figcaption>Training samples (input up, output bottom) — epoch 10</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4XBZwiLdLEEGie85PgWnA.png" /><figcaption>Training samples (input up, output bottom) — epoch 20</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XklfB-gw43D1Z2LTLhCtEw.png" /><figcaption>Training samples (input up, output bottom) — epoch 30</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z7gTtK2us1YQTmU4s4u5qA.png" /><figcaption>Training samples (input up, output bottom) — epoch 40</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MiCJfJteaeG-6QgSRFTlYA.png" /><figcaption>Training samples (input up, output bottom) — epoch 50</figcaption></figure><p><strong>Latent space</strong></p><p>One interesting thing about VAEs is that the latent space learned during training has some nice continuity properties. We can visualise these properties by considering a 2 dimensional latent space in order to be able to visualise our data points easily in 2D.</p><p>When looking at the repartition of the MNIST dataset samples in the 2D latent space learned during training, we can see that similar digits are grouped together (3 in green are all grouped together and close to 8 that are quite similar).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*c1gxtoX5d56jL_UzN0pT7w.png" /><figcaption>Latent space visualization in 2D</figcaption></figure><p>A great way to have a more visual understanding of the latent space continuity is to look at generated images from a latent space area. We can see in the following figure that digits are smoothly converted so similar one when moving throughout the latent space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZNiv66_cs4kkSGzeEABVA.png" /><figcaption>Generated digits from a 2D latent space sampling</figcaption></figure><h3>Conclusion</h3><p>Variational auto encoders are really an amazing tool, solving some real challenging problems of generative models thanks to the power of neural networks. Compared to previous methods, VAEs solve two main issues:</p><ul><li>How to sample the most relevant latent variables in the latent space to produce a given output.</li><li>How to map a latent space distribution to a real data distribution.</li></ul><p>However, VAEs also have some drawbacks:</p><ul><li>Generated images are blurry because the mean square error tend to make the generator converge to an averaged optimum.</li></ul><p>Generative Adverserial Networks (GANs) solve the latter issue by using a discriminator instead of a mean square error loss and produce much more realistic images. However, GAN latent space is much difficult to control and doesn’t have (in the classical setting) continuity properties as VAEs, which is sometime needed for some applications.</p><h4>Reference</h4><p>[1] Doersch, C., 2016. Tutorial on variational autoencoders. <em>arXiv preprint arXiv:1606.05908</em>.</p><p>[2] Kingma, D.P. and Welling, M., 2019. An introduction to variational autoencoders. <em>arXiv preprint arXiv:1906.02691</em>.</p><p>[3] MNIST dataset, <a href="http://yann.lecun.com/exdb/mnist/">http://yann.lecun.com/exdb/mnist/</a></p><h4>Code</h4><p><a href="https://github.com/sinitame/neural-networks-experiments">sinitame/neural-networks-experiments</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=803ddfb623df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/an-introduction-to-variational-auto-encoders-vaes-803ddfb623df">An introduction to Variational Auto Encoders (VAEs)</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[Understanding Batch Normalization for Neural Networks]]></title>
            <link>https://medium.com/data-science/understanding-batch-normalization-for-neural-networks-1cd269786fa6?source=rss-276e6e236aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cd269786fa6</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[training]]></category>
            <dc:creator><![CDATA[Emrick Sinitambirivoutin]]></dc:creator>
            <pubDate>Sun, 01 Mar 2020 14:44:11 GMT</pubDate>
            <atom:updated>2020-03-02T10:38:41.237Z</atom:updated>
            <content:encoded><![CDATA[<h4>Discover how batch normalization can make your deep learning models learn better and how to implement it from scratch in PyTorch.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxZacWvzE6RrnrdzO-_zIw.png" /><figcaption>Source: <a href="https://www.tes.com/news/grouping-primary-children-ability-indefensible">link</a></figcaption></figure><p>One of the main assumptions made when training learning systems is to suppose that the distribution of the inputs stays the same throughout the training. For linear models, which simply map input data to some appropriate outputs, this condition is always satisfied but it is not the case when dealing with Neural Networks which are composed of several layers stacked on top of each other.</p><p>In such architecture, each layer’s inputs are affected by the parameters of all preceding layers (small changes to the network parameters amplify as the network becomes deeper). As a consequence, a small change made during the backpropagation step within a layer can produce a huge variation of the inputs of another layer and at the end change feature maps distribution. During the training, each layer needs to continuously adapt to the new distribution obtained from the previous one and this slows down the convergence.</p><p>Batch normalization [1] overcomes this issue and make the training more efficient at the same time by reducing the covariance shift within internal layers (change in the distribution of network activations due to the change in network parameters during training) during training and with the advantages of working with batches.</p><h4>This article will cover the following</h4><ul><li>How batch normalization can reduce internal covariance shift and how this can improve the training of a Neural Network.</li><li>How to implement a batch normalization layer in PyTorch.</li><li>Some simple experiments showing the advantages of using batch normalization.</li></ul><h3>Reduce internal covariance shift via mini-batch statistics</h3><p>One way to reduce remove the ill effects of the internal covariance shift within a Neural Network is to normalize layers inputs. This operation not only enforces inputs to have the same distribution but also whitens each of them. This method is motivated by some studies [2] showing that the network training converges faster if its inputs are whitened and as a consequence, enforcing the whitening of the inputs of each layer is a desirable property for the network.</p><p>However, the full whitening of each layer’s inputs is costly and not fully differentiable. Batch normalization overcomes this issue by considering two assumptions:</p><ul><li>instead of whitening the features in layer inputs and outputs jointly, we will normalize each scalar feature independently (by setting the mean of zero and the variance of 1).</li><li>instead of using the entire dataset to normalize activations, we use mini-batches as <em>each mini-batch produces estimates of the mean and variance</em> of each activation.</li></ul><p>For a layer with d-dimensional inputs x = (x1, x2, .. xd) we obtain the normalization with the following formula (with expectation and variance computed over a batch B):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzI_eDTZJKq1nhh2dbEAvg.png" /></figure><p>However, simply normalizing each input of a layer may change what the layer can represent. For instance, normalizing the inputs of a sigmoid would constrain them to the linear regime of the nonlinearity. Such a behavior is not desirable for the network as it will reduce his representative power (it would become equivalent to a single layer network).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Mi9oJaUEg3rS-hRhj9eklw.png" /><figcaption>Plot of the sigmoid function</figcaption></figure><p>To address this, batch normalization also ensures that the transformation inserted in the network can represent the identity transform (the model still learns some parameters at each layer that adjust the activations received from the previous layer without linear mapping). This is accomplished by introducing a pair of learnable parameters gamma_k and beta_k which scale and shift the normalized value according to what the model learns.</p><p>In the end, the resulting layer’s inputs (based on previous layer outputs x) are given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J1iN40rt4946fmejXgcOQg.png" /></figure><h3>Batch normalization algorithm</h3><h3>During training</h3><h4>Fully connected layers</h4><p>The implementation of fully connected layers is pretty simple. We just need to get the mean and the variance of each batch and then to scale and shift the feature map with the alpha and the beta parameters presented earlier.</p><p>During the backward pass, we will use backpropagation to update these two parameters.</p><pre>mean = torch.mean(X, axis=0)<br>variance = torch.mean((X-mean)**2, axis=0)<br>X_hat = (X-mean) * 1.0 /torch.sqrt(variance + eps)<br>out = gamma * X_hat + beta</pre><h4>Convolutional layers</h4><p>The implementation of convolutional layers is almost the same as before. We just need to perform some reshaping in order to adapt to the structure of the input that we get from the previous layer.</p><pre>N, C, H, W = X.shape<br>mean = torch.mean(X, axis = (0, 2, 3))<br>variance = torch.mean((X - mean.reshape((1, C, 1, 1))) ** 2, axis=(0, 2, 3))<br>X_hat = (X - mean.reshape((1, C, 1, 1))) * 1.0 / torch.sqrt(variance.reshape((1, C, 1, 1)) + eps)<br>out = gamma.reshape((1, C, 1, 1)) * X_hat + beta.reshape((1, C, 1, 1))</pre><p>In PyTorch, backpropagation is very easy to handle, one important thing here is to specify that our alpha and beta are parameters to update them during the backward phase.</p><p>To do so, we will declare them as nn.Parameter() in our layer and we will initialize them with random values.</p><h3>During inference</h3><p>During inference we want the output of our network to depend only on the input and so we cannot consider the statistics made on the batches that we considered previously (they are related to the batch so they change depending on the data). In order to ensure that we have a fixed expectation and variance, we need to compute these values using the whole dataset instead of considering only batches. However, computing these statistics for all the dataset is quite expensive in terms of time and computation.</p><p>The approach proposed in [1] is to use moving statistics that we compute during training. We adjust the importance of the expectation computed on the current batch with a parameter beta (momentum):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZhfqvGMuygAHtAVxaM15WQ.png" /></figure><p>This moving average is stored in a global variable that is updated during the training phase.</p><p>In order to store this moving average in our layer during training, we can use buffers. We initiate these buffer when we instantiate our layer with the method register_buffer() of PyTorch.</p><h3>Final module</h3><p>Then the final module is then composed of all of the previous blocks that we described earlier. We add a condition over the shape of the input data to know whether we are dealing with a fully connected layer or a convolutional layer.</p><p>One important thing to notice here is that we only need to implement the forward() method. As our class inherits from the nn.Module, the backward() function will be automatically inherited from this class (thank you PyTorch ❤️).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2390bda738f3ce73386113636acc4c34/href">https://medium.com/media/2390bda738f3ce73386113636acc4c34/href</a></iframe><h3>Experiments on MNIST</h3><p>In order to see the effect of batch normalization on training, we can compare the convergence rate between a simple Neural Network without batch normalization and another one with batch normalization.</p><p>To keep things simple, we train these two simple fully connected networks on the MNIST [3] dataset without preprocessing (only data normalization is applied).</p><h4>Network architecture without Batch Norm</h4><pre>class SimpleNet(nn.Module):<br>    def __init__(self):<br>        super(SimpleNet, self).__init__()<br>        self.classifier = nn.Sequential(<br>            nn.Linear(28 * 28, 64),<br>            nn.ReLU(),<br>            nn.Linear(64, 128),<br>            nn.ReLU(),<br>            nn.Linear(128, 10)<br>        )<br>        <br>    def forward(self, x):<br>        x = x.view(x.size(0), -1)<br>        x = self.classifier(x)<br>        return x</pre><h4>Network architecture with Batch Norm</h4><pre>class SimpleNetBN(nn.Module):<br>    def __init__(self):<br>        super(SimpleNetBN, self).__init__()<br>        self.classifier = nn.Sequential(<br>            nn.Linear(28 * 28, 64),<br>            CustomBatchNorm(64),<br>            nn.ReLU(),<br>            nn.Linear(64, 128),<br>            CustomBatchNorm(128),<br>            nn.ReLU(),<br>            nn.Linear(128, 10)<br>        )<br>        <br>    def forward(self, x):<br>        x = x.view(x.size(0), -1)<br>        x = self.classifier(x)<br>        return x</pre><h3>Results</h3><p>The following figure shows the distribution of activations obtained after the first layer of our SimpleNet. We can see that the activation distribution with batch norm is still gaussian (with a small scale and shift learned during training) even after 20 epochs of training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*yVXnHtnplmpJzKtC37iFIg.png" /><figcaption>Experiments results (see <a href="https://github.com/sinitame/neural-networks-experiments/blob/master/batch_normalization/batch_normalization.ipynb">https://github.com/sinitame/neural-networks-experiments/blob/master/batch_normalization/batch_normalization.ipynb</a> for details)</figcaption></figure><p>We can also see great improvements in terms of convergence rates. The green curve (with batch normalization) shows that we can converge much faster to an optimal solution with batch normalization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*AYSXXLBaGhMZJfK3gW-_EA.png" /><figcaption>Experiments results (see <a href="https://github.com/sinitame/neural-networks-experiments/blob/master/batch_normalization/batch_normalization.ipynb">https://github.com/sinitame/neural-networks-experiments/blob/master/batch_normalization/batch_normalization.ipynb</a> for details)</figcaption></figure><h3>Conclusion</h3><h4>Advantages of using batch normalization for training</h4><ul><li>The gradient of the loss over a mini-batch is an estimate of the gradient over the training set, whose quality improves as the batch size increases.</li><li>The computation over a batch size can be much more efficient than multiple computations for individual examples due to the parallelism afforded by GPUs.</li><li>Using batch normalization at each layer to reduce the internal covariate shift greatly improves the learning efficiency of the networks.</li></ul><h4>References</h4><p>[1] Ioffe, Sergey, and Christian Szegedy. “Batch normalization: Accelerating deep network training by reducing internal covariate shift.” <em>arXiv preprint arXiv:1502.03167</em> (2015).</p><p>[2] Shimodaira, Hidetoshi. “Improving predictive inference under covariate shift by weighting the log-likelihood function.” <em>Journal of statistical planning and inference</em> 90.2 (2000): 227–244.</p><p>[3] MNIST dataset, <a href="http://yann.lecun.com/exdb/mnist/">http://yann.lecun.com/exdb/mnist/</a></p><h4>Code</h4><p><a href="https://github.com/sinitame/neural-networks-experiments/tree/master/batch_normalization">sinitame/neural-networks-experiments</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cd269786fa6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/understanding-batch-normalization-for-neural-networks-1cd269786fa6">Understanding Batch Normalization for Neural Networks</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[Hardware development on a Mac OSX]]></title>
            <link>https://medium.com/hackernoon/hardware-development-on-a-mac-osx-6ca03d3c0bf0?source=rss-276e6e236aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ca03d3c0bf0</guid>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vhdl]]></category>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[hls]]></category>
            <dc:creator><![CDATA[Emrick Sinitambirivoutin]]></dc:creator>
            <pubDate>Sat, 25 May 2019 17:50:08 GMT</pubDate>
            <atom:updated>2019-05-25T17:50:08.960Z</atom:updated>
            <content:encoded><![CDATA[<h4>Discover all the tools to compile and run VHDL/Verilog designs on OSX with open source tools.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eew2pBegiBxxquct.jpg" /></figure><p>When it comes to hardware development, having a Mac doesn’t seem to be the best choice. Indeed, most of the tools needed to compile, run and simulate VHDL/Verilog are mainly available for Linux and Windows systems. In this article, I will present some of the tools that I found that could be run on OSX and that allows me to do my hardware developments and to simulate my designs.</p><p>In this article, this article you will learn :</p><ul><li>How to install a VHDL/Verilog compiler on OSX</li><li>How to install a waveform viewer on OSX</li><li>How to make all those tools works together in order to work on your projects</li></ul><p>Let’s get started!</p><h3>1. Compile and run VHDL on OSX</h3><p>In order to simulate the design, VHDL code is treated as a software language and it is compiled to run on a CPU as a software program. There are a large number of commercial simulation packages including those included with FPGA design environments. But there is also an Open-Source alternative like <a href="http://ghdl.free.fr/">GHDL</a>. It’s a VHDL compiler built on top of GCC/LLVM (it performs VHDL to C cross-compilation first). When compiled, the code generated can be executed on an x86 processor allowing you to simulate your hardware behavior and how the signals behave at each stimulation of your system.</p><h4>How to install GHDL on OSX</h4><p>Like any other packages or software, GHDL can be installed with a package manager using precompiled sources or can be compiled from sources. We will see both methods here.</p><p><strong>For precompiled sources :</strong></p><ul><li>Download from their repository release: <a href="https://github.com/ghdl/ghdl/releases">https://github.com/ghdl/ghdl/releases</a></li><li>Copy the folder to your usr/local/opt/</li><li>Add the PATH to your .profile:</li></ul><pre>echo &#39;export PATH=&quot;/usr/local/opt/ghdl-release/bin:$PATH&quot;&#39; &gt;&gt; ~/.profile</pre><p>Very simple, but sometimes lastest releases are not available straight away or you might want to rebuild from scratch on your Mac. So here is how you can build GHDL from sources</p><p><strong>To compile from sources :</strong></p><ul><li>Clone their GitHub repository</li></ul><pre>git clone <a href="https://github.com/ghdl/ghdl.git">https://github.com/ghdl/ghdl.git</a><br>cd ghdl<br>git remote rename origin github</pre><ul><li>Generate Makefile</li></ul><pre>cd ghdl/<br>mkdir build<br>cd build<br>../configure --with-llvm-config --prefix=PREFIX</pre><ul><li>Compile sources</li></ul><pre>make<br>make install</pre><ul><li>Add the PATH to your .profile:</li></ul><pre>echo &#39;export PATH=&quot;PREFIX/ghdl/bin:$PATH&quot;&#39; &gt;&gt; ~/.profile</pre><h3>2. Compile and run Verilog on OSX</h3><p>In the world of hardware development, there is VHDL but there is also Verilog. In order to simulate a Verilog design we also need to compile the code in order to run it on a CPU before implementing it into real hardware. <a href="http://iverilog.icarus.com/">Icarus Verilog</a> is a free compiler implementation for the IEEE-1364 Verilog hardware description language that runs on OSX.</p><p><strong>Prepackaged distribution :</strong></p><pre>brew install icarus-verilog</pre><p><strong>Compile from sources:</strong></p><ul><li>Clone their GitHub repository</li></ul><pre>git clone <a href="https://github.com/steveicarus/iverilog.git">https://github.com/steveicarus/iverilog.git</a><br>cd iverilog<br>git remote rename origin github<br>sh autoconf.sh</pre><ul><li>Generate Makefile</li></ul><pre>cd iverilog/<br>mkdir build<br>cd build<br>../configure --prefix=PREFIX</pre><ul><li>Compile sources</li></ul><pre>make<br>make install</pre><ul><li>Add the PATH to your .profile:</li></ul><pre>echo &#39;export PATH=&quot;PREFIX/iverilog/bin:$PATH&quot;&#39; &gt;&gt; ~/.profile</pre><h3>3. Visualize waveforms</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5zjPLKoqUU1mNqfw" /></figure><p>When you have compiled your sources into a GPU executable, you then need to visualize how the signals behave during the execution of your code. To do so, you will need a waveform viewer in order to draw those signals and to navigate the timeline of the program execution. One of the best open source tools that I found to do this is gtkwave. It’ is a fully featured <a href="http://www.gtk.org/">GTK+</a> based wave viewer for Unix, Win32, and Mac OSX.</p><p><strong>Prepackaged distribution :</strong></p><pre>port install gtkwave</pre><p><strong>Compile from sources:</strong></p><ul><li>Un-tar the source code into any temporary directory.</li></ul><pre>cd gtkwave-X.X.X/<br>mkdir build<br>cd build<br>../configure --prefix=PREFIX</pre><ul><li>Compile sources :</li></ul><pre>make<br>sudo make install</pre><h3>An example project using this workflow</h3><p>Now that you have all your tools installed, we are going to use this simple example in order to show you how easy it is to simulate VHDL on your MAC.</p><p>This example is a simple 8-bit adder that adds 2 signed bytes together and gives you the result in output. In order to test our code, we also need to provide a test bench that will apply some signals into our adder design. We can then check if the design is working properly by displaying all signals in a waveform viewer in order to check if we obtain the desired outputs according to the inputs that we applied in the testbench.</p><p>Here is the structure of the project :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AstKaxXm4QxByXXtr09Zgg.png" /></figure><p>I will focus on the Makefile in this part as you are probably already familiar with the VHDL syntax (you can find all the sources of the project on my <a href="https://github.com/sinitame/vhdl-adder-example-medium">GitHub</a>).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9302af207331119756db225d0ba9592/href">https://medium.com/media/f9302af207331119756db225d0ba9592/href</a></iframe><p><strong>Compiling the VHDL files with GHDL require two steps:</strong></p><ul><li><strong>Importing sources:</strong> this step scans all the design units for our top design in the correct order so that GHDL knows which file to compile and in which order</li><li><strong>Make the executable:</strong> this step analyzes and elaborates the top design and generate an executable in the working directory</li></ul><p><strong>Generating the waveform requires one step:</strong></p><ul><li>Running the executable generated in the previous step with the--wave option in order to generate a wave file (.ghw).</li></ul><p>To visualize the waveform generated during execution, you just need to lunch gtkwave with the generated wave file by typing make view .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pIAPHUzwLsEo38-uetIPew.png" /></figure><p>I hope this little article will help you set up your development environment on OSX. When everything is installed and properly configure, this simple example will give you a generic template to create all your project and simulate your HDL designs within a minute.</p><ul><li><a href="https://ghdl.readthedocs.io/en/latest/index.html">GHDL Documentation - GHDL 0.37-dev documentation</a></li><li><a href="http://iverilog.icarus.com/">Icarus Verilog</a></li><li><a href="http://gtkwave.sourceforge.net/">GTKWave</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ca03d3c0bf0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/hardware-development-on-a-mac-osx-6ca03d3c0bf0">Hardware development on a Mac OSX</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to setup a helpful auto-complete UITextField using CoreData in Swift]]></title>
            <link>https://medium.com/free-code-camp/how-to-create-an-autocompletion-uitextfield-using-coredata-in-swift-dbedad03ea3d?source=rss-276e6e236aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbedad03ea3d</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Emrick Sinitambirivoutin]]></dc:creator>
            <pubDate>Wed, 20 Feb 2019 19:27:25 GMT</pubDate>
            <atom:updated>2019-03-06T23:00:33.017Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>All you need to know to build your autocompletion search bar with a UITableView and CoreData.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nzfy7hZivPO7PeN6" /><figcaption>Photo by <a href="https://unsplash.com/@grohsfabian?utm_source=medium&amp;utm_medium=referral">Fabian Grohs</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, I’m going to present how I built a custom search field with an autocompletion feature to retrieve data from CoreData. It’s a component that I needed in one of my apps and that can be very useful in many cases to improve the user’s experience.</p><h4>We will see:</h4><ul><li>How to set up a simple app with a search UITextField</li><li>How to configure a TableView to show the search results</li><li>How to make real-time queries to CoreData collections</li></ul><h3>1. Setting up the project</h3><p>Just create a single view App with the following components (check CoreData at the project creation !). To be more concrete, let’s imagine this is for a travel recommendation App and the user needs to provide a city name to get all the information of the place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*lxJev437cZZQtFP8zQ2few.png" /></figure><p><strong>UILabel : </strong>We will call it <em>topLabel. </em>We won’t need it.</p><p><strong>UITextField:</strong> It’s the field that we will customize to have an autocomplete search field, so let’s call it <em>searchTextField.</em></p><p><strong>UIButton :</strong> It’s the button that will be pressed when the user will find the place that they want. Let’s call it <em>searchButton</em>.</p><p>The tableView will be added programmatically so that you will see how to set it up in any kind of situation.</p><p><em>To have a beautiful render, I added an UIImageView on the background with a wonderful beach image.</em></p><p>To connect all those components to our View Controller, select each of them and drag their reference using (<strong>Control (or Ctrl) ⌃ + Click</strong>) to your main View Controller swift file.</p><h3>2. Configure our CustomSearchTextField class</h3><p>To create our new class, we create a new file called <em>CustomSearchTextField.swift. </em>It’s in this class, that inherits from UITextField, that we will embed all the features that we need to implement our autocompletion search field.</p><h4>Creating the TableView with the results:</h4><p>To be able to show the completion results, we need to instantiate a UITableView that will display the most relevant results as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*Fi0M9cyXLSiMkhZihagKIg.png" /></figure><p>To do so we need to create a tableView object and then add it to the current view. In order to handle this new object, we need to override specific methods as shown below. All of the code needed to build the searchTableView will be handled by this method: <em>buildSearchTableView()</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d488682f1970d0062a0fccd3617bf3db/href">https://medium.com/media/d488682f1970d0062a0fccd3617bf3db/href</a></iframe><p>Instantiating the tableView is as simple as creating a new UITableView object, but in order to access all of the functionalities of this new tableView object, we need to inherit from the TableViewDelegates and the TableViewDataSource methods. It is important to pay attention to two important variables:</p><ul><li><strong>The tableView delegate:</strong> This variable will let us specify which object of the view needs to be informed when some changes occur in the tableView (in our case, this object is our SearchTextField which is in this context the <em>self </em>object)</li><li><strong>The tableView DataSource:</strong> This variable will let us specify how all the components of the tableView will be created and from which data. Here again, we need to set it to <em>self</em>.</li></ul><p>Setting those two variables allows us to handle some actions related to the UITableView within our CustomSearchTextField class.</p><p>Now that the table view is created, we need to add data in it, and more concretely, this data will be stored into cells. We use methods inherited from the TableViewDataSource class to configure our cells and to add them to the tableView. In addition to this, the TableViewDelegates’ method will allow us to trigger where the user clicks and will print the content of the corresponding cell in the console.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16a36bd48d6c1e15d13617e80f6df045/href">https://medium.com/media/16a36bd48d6c1e15d13617e80f6df045/href</a></iframe><p>But if you try to run the code above, nothing will happen because the tableView frame is not set and we didn’t bring the view to the front. In order to fix this, we now need to add a <em>updateTableView() </em>method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b406070c864ed31bbb1d9d3db8fa9365/href">https://medium.com/media/b406070c864ed31bbb1d9d3db8fa9365/href</a></iframe><p>Our TableView is set and is now supposed to work perfectly! But at this time we have to add data in our dataList if we want to display something. To do it simply for now, we will just add dummy data to our list: the text that the user enters in our search bar.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6274ea8f9c642f99d3da78d096a061c/href">https://medium.com/media/e6274ea8f9c642f99d3da78d096a061c/href</a></iframe><p>But the main goal of all of this is to give our users autocompletion results while they are typing in our search bar, so we need to observe when the user types a new letter and to update the tableView data according to that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0226d6244b83e18706ad0f561b7ec120/href">https://medium.com/media/0226d6244b83e18706ad0f561b7ec120/href</a></iframe><p>As you can see above, we modified the <em>willMove()</em> method in order to set how to handle each of the user interactions with the textField. The one that interests us is when the text field changes (when the user is typing). So each time that this action is activated, we add data to our list and we update our tableView.</p><h4>Improving the user experience:</h4><p>Even if our searchField doesn’t search at all, you must have seen that when we type and the results are starting to show up, all of the results are in plain text. This doesn’t look that much like an autocompletion search bar. To be more user-friendly, it would be nice to highlight the part of the text that we already typed in the text field and also to filter the results so that they correspond to what we are actually typing. <strong>Let’s do this</strong> 😜</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*qC1j-oZGtDOy3lYhYaWbHA.png" /></figure><p>It’s time to create our filter method. This method will filter the relevant items from the dataList (the ones corresponding to what the user starts typing). We will use <em>NSMutableAttributedString class </em>to be able to highlight the part of the text that the user typed in the text field<em>.</em></p><p>First, we create a <em>SearchItem</em> class that will represent each of our filtered results. As we are building our wonderful travel recommendation app, we will consider that those items are city names. Here is the <em>SearchItem </em>class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6c2ee936652247f6568bcf04d105774/href">https://medium.com/media/b6c2ee936652247f6568bcf04d105774/href</a></iframe><p>We now need to change our global variable and to add a new one to store our filtered items:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4cb0ef4aee89db4ffa80951e0f7b5c2/href">https://medium.com/media/f4cb0ef4aee89db4ffa80951e0f7b5c2/href</a></iframe><p>Then let’s create our filter method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af896cd83bad2f7f888cbfd3b8c5ab07/href">https://medium.com/media/af896cd83bad2f7f888cbfd3b8c5ab07/href</a></iframe><p>By converting our string to an <em>NSString</em>, we can use the method <em>range() that </em>returns the range of the first occurrence of a given string within the string. By using this method we both know if the string corresponds to what the user is typing and the position of the corresponding string! That’s all we need to highlight this part of our item. We do this using <em>setAttributes</em> methods and we then add our item to the resultsList. Finally, we reload the data in our tableView.</p><p>Let’s create new test data to try our implementation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c42b3a1d8f5e111dfc5bbca3b6fdd3ea/href">https://medium.com/media/c42b3a1d8f5e111dfc5bbca3b6fdd3ea/href</a></iframe><p>Everything should work perfectly, we’re almost done! 😋</p><h3>3. Make queries to CoreData</h3><p>It’s nice to have a beautiful search bar with a custom table view to display our autocompletion filtered results, but without data, it’s not very useful 😅.</p><p>Let’s connect our search text field to CoreData storage.</p><h4>Create a CoreData database:</h4><p>In order to store our persistent data, we will create a new entity (table) in our database with two attributes (rows). To do so we click to the .xcdatamodeld file in the file explorer and create a new entity named Cities, add the two attributes that we need: cityName and countryName.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2fkTUHuGvS0utH3PFAZtw.png" /><figcaption>CustomSearchField..xcdatamodeld</figcaption></figure><p>Then we will modify the type of our dataList in <em>CustomSearchField.swift</em> to be a list of Cities instead of a list of SearchItems:</p><pre>var dataList : [Cities] = [Cities]()</pre><h4>Make queries to the created database:</h4><p>Now we need to create some methods to handle the saving and the fetching of new data in the database. To do so we need to create a context. The context is a specific zone where we will store all of our changing before committing them to the database. If you use git, this is like the staging zone. You first add your file to the staging area, and when you are ready with your changes you commit them to your git.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c26c595c5f46657ef4b7ac57547c66f/href">https://medium.com/media/5c26c595c5f46657ef4b7ac57547c66f/href</a></iframe><p>We change the beginning of our <em>filter()</em> method in order to query the data that corresponds to the user input instead of fetching all the data from the database:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79c21e4998e42aacf96ce811b7e65abe/href">https://medium.com/media/79c21e4998e42aacf96ce811b7e65abe/href</a></iframe><p>The last thing to add is a new <em>addData()</em> method to populate our database. Be careful, this function needs to be called only one time as the data stored will become persistent, so comment the corresponding line in your code (just before the creation of the tableView in <em>buildSearchTableView()</em> ) after the first call! Even if the app is restarted, the data will still be available in the internal memory of the device.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5106f3b1d0b4aa5a1fc807088eb6d53/href">https://medium.com/media/a5106f3b1d0b4aa5a1fc807088eb6d53/href</a></iframe><h3>That’s it ! We’re done ! 😎</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*6XJ4ermJVit_NYHatv6loQ.gif" /></figure><p>I started to dive into Swift programming a few weeks ago with an interesting MOOC that I found on Udemy. After I had acquired the basics of Swift and Xcode development, I began to work on my own projects with all of the useful documentation that I found on the web. This first tutorial is an opportunity for me to share all that knowledge that I acquired, so I hope that it has helped you!</p><p>If you have a question don’t hesitate to tell me in the comments! And don’t forget to give me a clap if you enjoyed the article 😋👏🏽</p><p>All the final project code is available here:</p><p><a href="https://github.com/sinitame/customSearchField-medium">sinitame/customSearchField-medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbedad03ea3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-create-an-autocompletion-uitextfield-using-coredata-in-swift-dbedad03ea3d">How to setup a helpful auto-complete UITextField using CoreData in Swift</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write your first post on Medium]]></title>
            <link>https://medium.com/@e.birivoutin/how-to-write-your-first-post-on-medium-cdb7e8d51f7d?source=rss-276e6e236aa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdb7e8d51f7d</guid>
            <category><![CDATA[first-post]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[blogging]]></category>
            <dc:creator><![CDATA[Emrick Sinitambirivoutin]]></dc:creator>
            <pubDate>Tue, 12 Feb 2019 11:21:26 GMT</pubDate>
            <atom:updated>2019-02-12T11:21:26.675Z</atom:updated>
            <content:encoded><![CDATA[<p><em>That’s a question that I’ve been asking myself for a long time and if you are reading this post you must have the same question in mind 💭</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ptHW0ZrmlMKRxvAO" /><figcaption>Photo by <a href="https://unsplash.com/@nickmorrison?utm_source=medium&amp;utm_medium=referral">Nick Morrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’ve read many articles on the question but even with all the good tips that they were giving me, I couldn’t take the plunge for the first one. So guess what! I decided to write on this topic for my first post 😅.</p><p>Even if those readings weren’t very helpful for giving me the inspiration to write, they gave me some tips about how to organize the process of writing a post and that’s what I’m going to share with you.</p><h3>1. Finding the Big IDEA</h3><blockquote>Writing a post is all about sharing something with others and without a clear idea of what you want to share there is no chance that people understand the message that you try to share.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ivgZYcVmYIqJm2eY" /><figcaption>Photo by <a href="https://unsplash.com/@joszczepanska?utm_source=medium&amp;utm_medium=referral">Jo Szczepanska</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>That’s a good point, but when you are new to blogging you most of the time don’t find that <strong>BIG ONE IDEA </strong>or you have it but just think that without any reputation or credibility on the Web, no one will care about what you say. That’s was my case and to overcome that idea, I decided to write this first post about my self and all the tips that I found to make a great post.</p><p>As an Engineer student specialized in Embedded Systems and Artificial Intelligence (AI), I’m passionate about new technologies and all of the fantastic stuff that we can do with those pieces of code. That’s what I will try to share through my posts to help even non-engineers people understand those amazing technologies.</p><h3><strong>2. Finding what you can share that will benefit others</strong></h3><blockquote>Making a post on an amazing topic is a good start ! But if your post is all about repeating other opinion or sharing the same thing you won’t bring anything to others and they won’t get interested in what you write.</blockquote><p>That one is usually the easiest thing to do! Why? Because we are all different, our studies, our experiences, the people that we met made our way of thinking UNIQUE.</p><p>For example, other engineer students with the same specialization can have a million different expertise fields because of what they’ve learned by themselves and because of their experiences. I also have mine and that’s why I do think that I’ve got a lot to share with others about what I’ve learned that will help them in their projects.</p><h3>3. Work on the presentation</h3><blockquote>Communication is not all about content, your post needs to be attractive and well structure or people won’t read it.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m9Vr1dfOEQ9Bd51P" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=medium&amp;utm_medium=referral">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’m certainly not the best person to give this kind of advice but per experience, I realized that a nice post is not about having incredible images, an original typo and specific fonts everywhere. A good post presentation is more about readability, having well-structured parts and some images to sometimes illustrate some of your ideas.</p><h3><strong>4. Last step: Be ATTRACTIVE!</strong></h3><blockquote>When you have a good topic with good content well presented, your last step is to be read by others. The first thing that people see from your post is your <strong>headline</strong> and <strong>opening image </strong>so you can’t neglect those ones or your work will have been for nothing</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/0*LRt9fzlV3mjkuJdJ.jpg" /></figure><p>I don’t have beautiful charts to show you the benefits of having a good headline and cover image but that’s a recommendation that I read from a bunch of articles that I read about having a good post on Medium.</p><p>However, I’ve got a nice tool to share with you! This <a href="https://coschedule.com/headline-analyzer">Website</a> proposes a headline analyzer that helps you to determine whether or not yours is a good one, here is the score that I obtained for this post :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUNzmeQ9PQLcvuU0TIGAKw.png" /><figcaption>Coschedule headline Analyser results</figcaption></figure><p>I hope that this article will be useful for people like me that want to jump into the world of blogging. These tips are in my opinion the best TOP 4 pieces of advice to start with a good post on your blog or on Medium.</p><p>But remember! As I told you on the beginning, the best way to start is actually to start 😌. It seems to be obvious, but I spent a lot of time looking for the perfect recipes before realizing it was all about practice.</p><h3>See you next time for more technical stories! 👨🏽‍💻</h3><p><em>If you want to thank me for this amazing post (I’m just kidding, I know I still have a lot to learn 😂) please leave me a comment and tell me what you liked or what could be better </em>😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdb7e8d51f7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>