<?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 ade sueb on Medium]]></title>
        <description><![CDATA[Stories by ade sueb on Medium]]></description>
        <link>https://medium.com/@adesueb?source=rss-d49416d414d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Rm_cUIh8yz6OHp21qM_evw.png</url>
            <title>Stories by ade sueb on Medium</title>
            <link>https://medium.com/@adesueb?source=rss-d49416d414d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 22:04:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adesueb/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[Jetpack Compose Remember inside LazyColumn]]></title>
            <link>https://adesueb.medium.com/jetpack-compose-remember-inside-lazycolumn-68c89d74323c?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/68c89d74323c</guid>
            <category><![CDATA[recomposition]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[lazycolumn]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 16:52:31 GMT</pubDate>
            <atom:updated>2022-07-07T17:01:44.329Z</atom:updated>
            <content:encoded><![CDATA[<p>How to maintain remember (inside) Lazy Column, and not being destroyed after scroll back.</p><blockquote>Well,, why I created story about Android? because this is who I am! Android and ML Engineer.</blockquote><h3>Remember</h3><p>I will explain a little bit about remember. i hope this will help you.</p><p>Simple, if you have a state is in internal to a composable, then you can use <em>remember</em>.</p><p>In this example 1 is the value of the state that you want to maintain, the state can change it to 2 or another number in the future.</p><p>simply you can create inside compose function</p><pre>// inside compose function<br>@Composable<br>fun ThisCompose() {<br>   Column() {<br>       var name by remember { mutableStateOf(1) }<br>   }<br>}</pre><p>and if you want to outside compose function, in this case outside Column()</p><pre>// outside compose function<br>@Composable<br>fun ThisCompose() {<br>   var name by remember { mutableStateOf(1) }<br>   Column() {<br>       <br>   }<br>}</pre><p>Both of them works well and easy to maintain.</p><h3>Remember inside Lazy column</h3><p>But what if you want to use remember within the item inside lazy column?</p><p>actually you can simply just create inside LazyColumn,</p><pre>// inside LazyColumn<br>@Composable<br>fun ThisCompose() {<br>   LazyColumn(){<br>        items( items = names ) { name -&gt;<br>            val state = remember{ mutableStateOf(1) <br>        }   <br>   }<br>}</pre><p>but.. remember inside lazy column will destroy and re-initiate when you scroll away from the item (until you can’t see the item) and scroll back to the item (see again).</p><p>Then,, how to remember the remember even you scroll awaayyy? :P</p><p>you must initiate the remember outside LazyColumn.</p><pre>// outside LazyColumn<br>@Composable<br>fun ThisCompose() {<br>   var name by remember { mutableStateOf(1) }<br>   <br>   LazyColumn(){<br>        items( items = names ) { name -&gt;<br>        }   <br>   }<br>}</pre><h3>rememberSaveable</h3><p>or you can use <em>rememberSaveable</em></p><pre>// use rememberSaveable<br>@Composable<br>fun ThisCompose() {<br>   LazyColumn(){<br>        items( items = names ) { name -&gt;<br>            val state = rememberSaveable{ mutableStateOf(1) <br>        }   <br>   }<br>}</pre><p>what is this?</p><blockquote>While remember helps you retain state across recompositions, the state is not retained across configuration changes. For this, you must use rememberSaveable. rememberSaveable automatically saves any value that can be saved in a Bundle.</blockquote><p><strong>not only retained across configuration or rotation changes but also retained from scroll away from the item.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68c89d74323c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Hybrid Recommender System (Ys-Mean)]]></title>
            <link>https://adesueb.medium.com/ys-mean-recommender-system-d4b6755ca79f?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4b6755ca79f</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[softmax]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[recommender-systems]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 01:16:03 GMT</pubDate>
            <atom:updated>2022-07-18T01:56:08.420Z</atom:updated>
            <content:encoded><![CDATA[<p>Long time no write stories.. A lot of stories i wanna tell about my journey in Machine Learning in past 2 years.</p><p>And i wanna start with the Machine i created for Recommender System in Vidio recently (the company i work at). Ys-Mean Recommender System. The very simple Hybrid Recommender System.</p><p>This i created by my self, my idea, you won’t found this at internet or papers. But i can guaranty, this Technic is very easy to understanding and effective for Recommender System.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/0*xrcqo4MLXQL_3W6A" /><figcaption>ys-mean architecture</figcaption></figure><h3>Benefit</h3><h4>Fill each other’s gaps</h4><p>Every each of Recommender System has some minus parts or we can say cons. such as:</p><p>Collaborative Filtering cannot cover cold start, Collaborative Filtering only see user behavior (sometimes when we have not enough user, it cannot be applied to our Recommender System).</p><p>Content Based just looking at the metadata of the contents that you want to recommend. And the metadata mostly provided by human, actually it can be provided by machine. When the human or the machine provides wrong metadata then it will gives wrong recommendation. Also this method doesn’t see user behavior.</p><p>And when we combine those Recommender Systems into 1 Recommender System, it will fill each other’s gaps.</p><h4>Can control or maintain the proportional</h4><p>With Using simple combine using mean or average, we can control the proportional of model. Let’s say we want to give more value on Content based score, then simply we can make double of content based score then average them.</p><h3>Explanation</h3><h4>Softmax</h4><p>First of all you must have a good understanding about Softmax. Basically Softmax is one of Activation Function. <a href="https://medium.com/swlh/usability-of-activation-function-on-deep-learning-6b7efe8aec18">Here</a> a story that i created about activation function including Softmax.</p><blockquote>“get confused about Softmax! and after that, get a good understanding about Softmax is!”. Because this is the basic that helping us a lot in building Machine Learning Model.</blockquote><p>Softmax is the main player in this Ys-Mean Recommender System. Before you calculate the average or mean of ‘Y’s <strong>you have to make sure the Y’s are the result that come from softmax activation function</strong>.</p><h4>Use Softmax for Recommender System? Seriously?</h4><p>Yes, of course i am serious!. y not? ups.. why not?.</p><p>Usually we use softmax for categorical Model, like to define it is a cat, cow, bunny or dog. But how can i use softmax for recommender system?</p><p>Softmax gives us probability values, for example (0.3, 0.1, 0.4, 0.2). If we sum the values it will be 1. the values represents of scores of each categories.</p><p>Let’s say we have a <em>model</em> that has softmax activation function at the last layer and also we have this picture. “oh God,, this is so cute! ♡”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54Tolm62HIpIUGNVfu3dmA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@paige_cody?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Paige Cody</a> on <a href="https://unsplash.com/images/animals/bunny?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Let’s say we predict this picture using the <em>model</em> and the <em>model</em> gives us some scores. Scores of this picture are: the cat is 0.3, cow score is 0.1, bunny is 0.4, and dog is 0.2. Then we can say it is a Bunny. Aaaaaand based on the scores we can say it is more like cat than dog and it is more like dog than cow. And of course it is not more like cat than bunny.</p><p>Okay, that’s not about recommendation right? oh.. you are wrong.. from the <em>model</em> result scores, i can recommend to you that the picture is the picture of a bunny, if you don’t like that this is a bunny, then i recommend to you that this is a cat.</p><p>Seee,,, we can say the model gives us the recommend of name or kind of animal based on the picture.</p><p>Now we can say, the model is just like Recommender System Model. Then we also can say we can use softmax for Recommender System.</p><h4>Recommender System with Softmax</h4><p>i will not tell the detail about how to create recommender system with softmax in this story, at least not this time. but i promise i will create another story that telling you about how to create recommender system with softmax. the stories will include Collaborative Filtering Recommender System with softmax, Content Based Recommender System with softmax and also Knowledge Based Recommender System with softmax.</p><p>This is an very simple example code, 1 of Recommender System i created (collaborative filtering/user behavior), using softmax activation function:</p><pre>model = Sequential()<br>model.add(Embedding(classes_size, 1024, input_length=5))<br>model.add(Flatten())<br>model.add(Dense(1024, activation=&quot;relu&quot;))<br>model.add(Dense(1024, activation=&quot;relu&quot;))<br>model.add(Dense(classes_size, activation=&#39;softmax&#39;))</pre><h4>Wider Deep Learning</h4><p>If we say deep learning, it has a depth. If we say wider deep learning, it has depth and also width.</p><p>At this picture you see not only deep but also wide.</p><p>Simple, you just make sure every Network (collaborative, content based, knowledge based) using softmax for the last activation function And also return the same format, same format what i mean is the Y scores every each Network represents the same list of categories, in recommendation case is list of contents that you want to recommend.</p><p>And at the end, combine the result scores by calculate the average. why calculate the average? because we want to maintain the sum of all of the scores not higher than 1. To make it fast when we want to proceed then present to the users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/0*iDEKzp8_7EPUXXpG" /><figcaption>ys-mean architecture</figcaption></figure><h4>The Result</h4><p>I used Tensorflow whenever created every single Recommender System model in Vidio. Also the Ys-Mean Recommender System i use Tensorflow</p><p>The model summary just like this picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9Gj6K1Ftm9_x2jauiBjvA.png" /><figcaption>Summary of Ys-Mean Recommender System</figcaption></figure><p>To achieve Ys-Mean Recommender System i created some custom layer, including the last layer.</p><p>The last layer just like this:</p><pre>class YsMeanLayer(tf.keras.layers.Layer):<br>  def __init__(self):<br>  super(YsMeanLayer, self).__init__()</pre><pre>def call(self, inputs):<br>  return tf.reduce_mean(inputs, axis=0)</pre><p>i use simply reduce_mean because i don’t want to changed the proportional. But if you want to change the proportional you can doubled the scores that you want to give more value.</p><h3>Finally</h3><p>I hope this story gives you more value, and helping you to create Recommender System.</p><p>This is Ys-Mean,, and you can called it “Wise Man” :P</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4b6755ca79f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Story of Long Short-term Memory (RNN)]]></title>
            <link>https://adesueb.medium.com/the-story-of-long-short-term-memory-rnn-7d57dd551f90?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d57dd551f90</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[lstm]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[training]]></category>
            <category><![CDATA[rnn]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Sat, 24 Oct 2020 07:00:02 GMT</pubDate>
            <atom:updated>2020-11-20T04:43:35.003Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If the Sequence is matter, then LSTM is good for your Machine Learning Layer.</em></p><h4>The Purpose of Recurrent neural network (RNN)</h4><p>When we want to Predict sequential series of data. For examples sentences, cryptocurrency or stock. We can train the datasets using RNN.</p><h4>LSTM on RNN</h4><p>And then the layer that used to RNN training usually we use LSTM.</p><h4>What is LSTM</h4><p>We take a look at <strong>Sequential</strong> Series of data. Because it’s a Sequential so the <strong>Sequence </strong>of the series data is very important. And each of the series of data influence each other data.</p><p>It’s like a Fibonacci Sequence number, every number influence to other number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*uxjoqHx2Pe_Xz1KramDy0A.png" /><figcaption>Fibonacci Sequence Numbers</figcaption></figure><p>In Fibonacci the previous of number affect the next of number. We can say Fibonacci can’t have 8 without 3 and 5. Also can’t have 13 without 5 or 8. <strong>So the 8 bring the 5 to get the 13</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*l2zBNx3HTI589pNYv9IzKg.png" /></figure><p>To bring previous number into the next number we need a more than just short-term memory, we need longer short-term memory. Maybe that’s why it called Long Short-term Memory.</p><h4>But Why LSTM for RNN?</h4><blockquote>A recurrent neural network is a class of artificial neural networks where connections between nodes form a directed graph along a temporal sequence. (source: wikipedia)</blockquote><p>Obviously LSTM can handle the sequence of series data. Because LSTM have a longer short-term memory than other layers :P</p><p>Simple example : Let’s say we want to predict a word after a sentence “I know you loved me, so am i, I love you …” simply we can put word “too” because the sequence of words before, explain about that. And How machine put word “too”?</p><p>Let’s say we have a machine or program that simply put “too” after “I know you love me, so am i, I love you …”. That’s because the machine has be trained by some sentences before. On training process machine learn if it got “so am i” also have another sentence after that, it will put word “too”.</p><p>Yeaahh,, the Sequence training is very important for that. And this kind of training need more longer short-term memory, which is LSTM has that.</p><h4>Speeed up LSTM with using CuDNNLSTM</h4><p>Tensorflow provides CuDNNLSTM. If you use <a href="https://medium.com/swlh/use-gpu-for-programming-on-linux-case-tensorflow-b79e15f25351">GPU</a> for your training process, it’s better using CuDNNLSTMthan using LSTM. Using CuDNNLSTM instead, will speed up the training process, also the predict and evaluate process.</p><p>Since Tensorflow 2.0, LSTM layer automatically take the CuDNN version if you specify no activation function.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d57dd551f90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Basic Weights Calculation Behind of DeepLearning]]></title>
            <link>https://adesueb.medium.com/the-basic-weights-calculation-behind-of-deeplearning-4ae0edf95d74?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ae0edf95d74</guid>
            <category><![CDATA[weight-loss]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[dot-product]]></category>
            <category><![CDATA[bias]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Wed, 23 Sep 2020 11:46:37 GMT</pubDate>
            <atom:updated>2021-05-20T03:45:22.494Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding the weights calculation with dot product and biases behind of Deep Learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*oO32DM3zMX_KjY2Hn2cY0A.png" /><figcaption>X = feature, w = weight, b = bias and Y is label</figcaption></figure><h4>Weight</h4><p>First of all if you use Keras as library, Keras provides some random weights. These weights will be the multiplied by features given from training parameter. And sum all the results.</p><p>The value of the weight will be optimized during training process, with optimizer, depends on the result of each epoch.</p><h4>Dot Product</h4><p>The calculation between weights and features uses dot product.</p><p>Why dot Product? because this calculation much simply to get similarity from some values (equation of vector).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*7_myHguAYVRummYbZi0oYA.gif" /></figure><p>As we can see in the image above, if two vector is similar, then the result of dot product is between 0 and 1, and the opposite is between 0 and -1.</p><p>The more similar of two values, then the number will be higher. And if the two values is the same, then the value will be 1.</p><p>Also, the basic is from best fit linear, or we call it regression linear. When we have multiple dimension of regression linear, so the simple formula from mx+b become Dot Product formula.</p><h4>Biases</h4><p>Since the weight values are random, so that sometimes the weights calculation (<a href="https://medium.com/@ade.sueb/the-basic-weights-calculation-behind-of-deeplearning-4ae0edf95d74">dot poduct</a>) gives result with the very high number (outside the range). After that the next epoch will gives us more and more wrong values. And the training will be failed. And Biases can help to fix that.</p><p>Some reasons why we use Bias values :</p><ul><li>Make the error value not getting higher.</li><li>Make calculation not linear.</li><li>And to make the calculation back on track.</li></ul><p>On Keras Library, the default initiate value is zero. and will be changing during training process depends on training result.</p><p>As we can see the first image on the above, the bias values will be added up after dot product calculation.</p><p><em>Biases move the line of vector, not changing the line.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ae0edf95d74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Over Fitting on Deep Learning]]></title>
            <link>https://adesueb.medium.com/over-fitting-on-deep-learning-e423ea3239e4?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e423ea3239e4</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[overfitting]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Thu, 17 Sep 2020 00:10:43 GMT</pubDate>
            <atom:updated>2020-09-17T00:10:43.082Z</atom:updated>
            <content:encoded><![CDATA[<h3>Over Fitting</h3><h4>When is it happened?</h4><ul><li>When the delta from your Train Accuracy and Test Accuracy is too much.</li><li>When Test Accuracy value is larger than Train Accuracy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwhl3WIZiK85rFBL-BFyow.png" /></figure><h4>Why is it Happened?</h4><p>Usually overfitting occurs when you have too much Layer or too much training for your model.</p><h4>How can we reduce OverFitting?</h4><ul><li>Making more simple training model, like remove some layer. Or use DropOut.</li><li>Make Augmentation from our current dataset. (do pivot, flip or resizing)</li><li>Adding more training data set.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e423ea3239e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TFLite Converter, Easy Converter?]]></title>
            <link>https://adesueb.medium.com/tflite-converter-easy-converter-4ece5c38c472?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ece5c38c472</guid>
            <category><![CDATA[tensorflow-lite]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 02:08:12 GMT</pubDate>
            <atom:updated>2020-09-14T06:59:21.571Z</atom:updated>
            <content:encoded><![CDATA[<p>It looks easy when you read the tutorial about convert model, with 2 lines of codes.</p><pre>converter=tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)<br>tflite_model=converter.convert()</pre><p>Yes <strong>it works,</strong> but in <strong>some conditions.</strong></p><h4>Three things that you must know about TFLite Converter before you use the converter:</h4><h4>1. Consider the <a href="https://www.tensorflow.org/lite/guide/ops_compatibility#supported_types">Supported types</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*mmuelIrbAnmrNoMJhnOP3Q.png" /></figure><p>At that article, we know that TFLite converter doesn’t support string and float16, at least not yet.</p><p>There are some tutorials about text classification that use String for the input shape parameter at input layer, for example <a href="https://www.tensorflow.org/tutorials/keras/text_classification_with_hub">this tutorial</a> provided by tensorflow. For now, you cannot convert the model from that tutorial into TFLite.</p><p>But actually you can make the text classification by encoding the text string into float or int.</p><h4>2. You Can Use Tensorflow Lite Model Maker, for not Supported Input Type</h4><p>If you don’t wanna make your hands dirty by encoding the text input into float or integer to make the model supported by the converter, you can create TFlite model for text classification with <a href="https://www.tensorflow.org/lite/guide/model_maker">Tensorflow Lite Model Maker.</a></p><p>Tensorflow provides Some Model Makers that you can use: <a href="https://www.tensorflow.org/lite/tutorials/model_maker_image_classification">Image Classification</a>, <a href="https://www.tensorflow.org/lite/tutorials/model_maker_text_classification">Text Classification</a> and <a href="https://www.tensorflow.org/lite/tutorials/model_maker_question_answer">Question Answer</a>.</p><h4>3. Quantization Integer Only</h4><pre>import tensorflow as tf<br>converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)<br>converter.optimizations = [tf.lite.Optimize.DEFAULT]<br>def representative_dataset_gen():<br>   for input_value in tf.data.Dataset.from_tensor_slices(train_images).batch(1).take(100):<br>    # Get sample input data as a numpy array in a method of your choosing.<br>    yield [input]<br>converter.representative_dataset = representative_dataset_gen<br><strong>converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]</strong><br><strong>converter.inference_input_type = tf.int8</strong>  # or tf.uint8<br><strong>converter.inference_output_type = tf.int8</strong>  # or tf.uint8<br>tflite_quant_model = converter.convert()</pre><ul><li>This results in a smaller model and increased inferencing speed, which is valuable for low-power devices such as <a href="https://www.tensorflow.org/lite/microcontrollers">microcontrollers</a>. This data format is also required by integer-only accelerators such as the <a href="https://coral.ai/">Edge TPU</a>.</li><li>This converts input and output type float 32 to uint_8.</li><li>Cannot use float 64 to convert to uint_8.</li><li><a href="https://firebase.google.com/products/ml">Firebase ML</a> use uint_8 for produce tflite model.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ece5c38c472" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step by Step Train Model using Tensorflow (CNN)]]></title>
            <link>https://medium.com/analytics-vidhya/step-by-step-train-model-using-tensorflow-cnn-2f243b847c8?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f243b847c8</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[training]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Wed, 09 Sep 2020 01:57:49 GMT</pubDate>
            <atom:updated>2020-11-23T01:36:02.694Z</atom:updated>
            <content:encoded><![CDATA[<p>Step by Step to Train your own Image Dataset for Deep Learning Using Tensorflow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*lCunSvgQBQx34gwfJECAxw.png" /></figure><p>Actually there is an easiest way to train you own Image. You can use <a href="https://firebase.google.com/docs/ml">Firebase Machine Learning</a>. You only have to upload your images and define the labels. But if you still wanna train a model by your hands, you can continue read this blog.</p><p><em>Anyway.. you can find the full </em><strong><em>source code</em></strong><em> and the datasets </em><a href="https://github.com/adesueb/nurhadiml"><em>in here</em></a></p><h3>Prepare the Data Set</h3><p>Prepare as many as possible sample images. Put them into each folders by the classification/labels.</p><p>For this i will use <a href="https://github.com/adesueb/nurhadiml/tree/master/dataset">mine</a> from <a href="https://medium.com/@ade.sueb/simple-tflite-running-on-android-phone-2b03ab4c2e2e">this story</a>. You can use cat and dog or mnist dataset for this.</p><h3>Load the Data Set</h3><h4>Create features (X) and labels (Y) variable</h4><p>Create variable X_TRAIN and Y_TRAIN. Both of them as array.</p><p>Create variable arrays called labels that contains the name of labels or classifications of your model.</p><p>Save the index of variable labels into variable Y_TRAIN. We implicitly encoding that labels into number. So that we can pass it to model.</p><p>Load the image folders. Iterate 1 by 1 the files and adding including the index of label name into variable array. For this variable X_TRAIN.</p><pre>DATADIR = &quot;dataset&quot;<br>TESTDIR = &quot;test&quot;<br>LABELS = [&quot;indosiar&quot;, &quot;indosiar_iklan&quot;, &quot;sctv&quot;, &quot;sctv_iklan&quot;]</pre><pre>X_TRAIN = []<br>Y_TRAIN = []</pre><h4>Augment the data, if you want (optional)</h4><p>This needed when you don’t have enough dataset. You can do flip or resize the image. So that you adding multiple data.</p><h4>Make sure the input shape is correct</h4><p>You have to know what your data shape variable X_TRAIN . Because that shape must be the same with the input layer.</p><pre>for label in LABELS:<br>        path = os.path.join(DATADIR, label)<br>        class_num = LABELS.index(label)<br>        for img in os.listdir(path):<br>            try:<br>                img_array = cv.imread(os.path.join(path, img))<br>                new_array = cv.resize(img_array, (IMG_SIZE, IMG_SIZE))<br>                X_TRAIN.append(new_array)<br>                Y_TRAIN.append(class_num)<br>            except Exception as e:<br>                pass</pre><p>Also we need to reshape the X_TRAIN .</p><pre>X_TRAIN = np.array(X_TRAIN).reshape(-1, IMG_SIZE, IMG_SIZE,3)</pre><p>First parameter is determine how many features do you have, we put -1 so that we can use number of feature whatever we want. And the last parameter is for whether the dataset is RGB or Gray. 1 for Gray and 3 for RGB.</p><h3>Build the Model (Sequential)</h3><h4>Input Layer</h4><p>We can just using the layer what we want for this, and specify the input on parameter. We put the shape of variable X_TRAIN for the input parameter.</p><pre>model.add(Conv2D(32, (5,5), input_shape = X_TRAIN.shape[1:]))</pre><h4>Hidden Layer</h4><p>Because we want to train using CNN, so we use Conv2D layer for this.</p><p>How many hidden layer do we need? Depends on the training result. We do training not once. we can do many time until we have the right composition (number of hidden layer and parameter that we use to the layer) for the best result.</p><pre>model.add(Conv2D(32, (5,5)))<br>model.add(Activation(&quot;relu&quot;))<br>model.add(MaxPooling2D(pool_size=(2,2)))</pre><pre>model.add(Conv2D(32, (5,5)))<br>model.add(Activation(&quot;relu&quot;))<br>model.add(MaxPooling2D(pool_size=(2,2)))</pre><h4>Output or final Layer</h4><p>For the output we used Dense Layer. Because we want to convert multi dimensional array into 1D array, so that we used Flatten before Dense Layer.</p><pre>model.add(Flatten())<br>model.add(Dense(4))</pre><h4>Also choose the right activation</h4><p>since our labels are 4, it’s better we used Softmax for the Activation Function.</p><pre>model.add(Activation(&quot;softmax&quot;))</pre><h3>Compile Model</h3><h4>Loss Function</h4><p>Because our labels is categorical (more than 2 labels) and our final activation function is Softmax, then the right Loss Function is categorical_crossentropy.</p><h4>Optimizer</h4><p>For optimizer we used adam instead of SGD. adam faster then SGD , even though SGDis more accurate than adam .</p><h4>Metrics</h4><p>This for log, we choose accuracy .</p><pre>model.compile(optimizer=&#39;adam&#39;, loss=&#39;sparse_categorical_crossentropy&#39;, metrics=[&#39;accuracy&#39;])</pre><h3>Train Model</h3><h4>Passing X and Y train</h4><p>Just passing X_TRAIN and Y_TRAIN to model.fit at first and second parameter.</p><h4>Batches</h4><p>For batches we can use 32 or 10 or whatever do you want. This batches makes the training process faster, specially if you use <a href="https://medium.com/swlh/use-gpu-for-programming-on-linux-case-tensorflow-b79e15f25351">GPU for your training</a>. This batches for how many number of data process in 1 epoch do at the same time, and this number affect to calculation of accuracy and loss percentage.</p><h4>Epochs</h4><p>Every each epochs is 1 training process. And after 1 training normally will calculated with loss function and optimizer. So that after training the model getting better. But if we have too many epochs, then it will cause overfitting.</p><h4>Validation Data</h4><p>You don’t have to have validation data. You can just split from training data set, by just specify the validation parameter.</p><pre>model.fit(X_TRAIN,Y_TRAIN, epochs=10, validation_split=0.1)</pre><h3>Test Model</h3><p>Use Images that are not contains on training Dataset. And use predict function for this.</p><pre>for img in os.listdir(TESTDIR):<br>    try:<br>        img_array = cv.imread(os.path.join(path, img))<br>        new_img = cv.resize(img_array, (IMG_SIZE, IMG_SIZE))<br>        new_shape = new_img.reshape(-1, IMG_SIZE, IMG_SIZE, 3)<br>        predictions = model.predict(new_shape)<br>        plt.imshow(new_img)<br>        print(predictions)<br>        print(LABELS[np.argmax(predictions)])<br>    except Exception as e:<br>        pass</pre><h3>Full Source Code</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17d8bb2ddb759077b5eeb4729a5b1bfa/href">https://medium.com/media/17d8bb2ddb759077b5eeb4729a5b1bfa/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f243b847c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/step-by-step-train-model-using-tensorflow-cnn-2f243b847c8">Step by Step Train Model using Tensorflow (CNN)</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Usability of Activation Function on Deep Learning]]></title>
            <link>https://medium.com/swlh/usability-of-activation-function-on-deep-learning-6b7efe8aec18?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b7efe8aec18</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[softmax]]></category>
            <category><![CDATA[relu]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[activation-functions]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Sun, 06 Sep 2020 15:14:38 GMT</pubDate>
            <atom:updated>2020-09-22T00:28:40.790Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Explanation of 3 common activation functions on Deep learning by usability.</em></p><h4>Why Activation Function so Important?</h4><p>We can imagine activation Function is a thing that firing our brain (in this case neuron) to think. Maybe that illustration makes you more confuse :P</p><p>Anyway.. Without activation Function every calculation in each layer doesn’t have a meaning. Why? because the calculation is linear, which is input value has the same value with output value, implicitly. Activation function makes this is not(n) linear anymore.</p><h4>Sigmoid</h4><p>Sigmoid function is used together with binary_crossentropy for loss function. And we used this on final or output Layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*xqbKX163KWlwvmwPA6bBBw.png" /></figure><p>As we can see on the image above, Sigmoid will produce value between 0 and 1. If the (x) value is negatif, so the return (y) will be near to 0. If positif will be near to 1. This behavior makes Sigmoid better use for model with 2 labels.</p><pre>model.add(Dense(<strong>1</strong>))<br>model.add(Activation(&#39;<strong>sigmoid&#39;</strong>))</pre><pre>model.compile(loss=&#39;<strong>binary_crossentropy&#39;</strong>, optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001),              metrics=[&#39;accuracy&#39;])</pre><p>Better use Sigmoid when your model consists of 2 labels. So that can produce 1 output, which is 0 or 1.</p><h4>Softmax</h4><p>Usually used for model that consists of more than 2 labels. And produce the same number as the size of labels. This Activation function for categorical type. That’s why it’s common using softmax with categorical_crossentropy for loss function. And we used this on final or output Layer.</p><pre>model.add(Dense(<strong>4</strong>))<br>model.add(Activation(&#39;<strong>softmax&#39;</strong>))</pre><pre>model.compile(optimizer=&#39;adam&#39;,loss=&#39;<strong>categorical_crossentropy</strong>&#39;, metrics=[&#39;accuracy&#39;])</pre><p>We call this probability activation function. Because let’s say we have these values [2.0, 1.0, 0.1] then those values will be convert to probability values[0.7, 0.2, 0.1]. If we sum the probabilities then the result must be 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*poV881KAj918vMD4YtZ6bw.png" /><figcaption>Softmax Formula</figcaption></figure><h4>Relu</h4><p>Popular activation function on Deep Learning. Usually we used Relu on Input Layer input and hidden layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*TBIkFs0vOjh-LdGNvurOIg.png" /></figure><p>The result of Relu activation function is always positive. Because when the (x) value is negative, so that the (y) value will be 0. And if positive, relu never change the value.</p><p>So then if the result is 0 then this value never fired, this means this value never pass forward to the next layer.</p><p>Another reason why Relu is common used in hidden layer is because the calculation is so fast.</p><pre>model.add(Conv2D(32, (5,5)))<br>model.add(Activation(&#39;relu&#39;))</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b7efe8aec18" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/usability-of-activation-function-on-deep-learning-6b7efe8aec18">Usability of Activation Function on Deep Learning</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NVIDIA RTX 3090 will be a Damn Good GPU for Machine Learning]]></title>
            <link>https://adesueb.medium.com/nvidia-rtx-3090-will-be-a-damn-good-machine-for-machine-learning-6702d1435726?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6702d1435726</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[cuda]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[gtx]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Wed, 02 Sep 2020 08:45:37 GMT</pubDate>
            <atom:updated>2020-09-13T09:06:38.850Z</atom:updated>
            <content:encoded><![CDATA[<p>Yesterday, NVIDIA has released a new series for RTX… 3090.</p><p>We know that GPU makes training process for machine learning faster than use CPU. Because GPU consists of hundreds of core.</p><p>did you know, Nvidia is using <strong>10,496 CUDA</strong> <strong>cores</strong> on the <a href="https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3090/"><strong>RTX 3090.</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*i82D2xdGss1nRcRY1UC2_g.png" /></figure><blockquote>WOW!!! it’s not hundreds man!!!</blockquote><p>I cannot imagine how fast my train execution with this machine.</p><p>Actually i don’t have this stuff yet, not yet released on my country :(</p><blockquote>If you want to use GPU for your machine learning, you can follow <a href="https://medium.com/swlh/use-gpu-for-programming-on-linux-case-tensorflow-b79e15f25351">this tutorial</a>.</blockquote><p>Next time, once i have this GPU.. i will compare the training execution time. <em>cheers..</em></p><p>Anyway,, If you want to learn how to <strong>train</strong> model with <strong>easy steps</strong>, you can <a href="https://medium.com/@ade.sueb/step-by-step-train-model-using-tensorflow-cnn-2f243b847c8"><strong>read this</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6702d1435726" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 3 Basic Layers of Deep Learning]]></title>
            <link>https://adesueb.medium.com/dummy-explanations-to-some-tensorflow-popular-questions-c26a387d3dc8?source=rss-d49416d414d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c26a387d3dc8</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <dc:creator><![CDATA[ade sueb]]></dc:creator>
            <pubDate>Tue, 25 Aug 2020 02:30:00 GMT</pubDate>
            <atom:updated>2020-09-27T00:03:25.338Z</atom:updated>
            <content:encoded><![CDATA[<p>If you want to train your data set, then at least you must know these 3 Layers.</p><h3>Layers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*-3Cj1eEsM6T6KwS1rxVa6g.gif" /></figure><h4>Dense Layer</h4><p>We called this “the most well-known type of the Layer”. You can use this layer if you want to adding more Layer because your model need to more memorize some values.</p><p>Too much Dense Layer will causing Overfitting training.</p><p>Too less Dense Layer will causing your training is far from the best result.</p><p>And usually we added Dense Layer at the end of sequence of layers for fitting the number of output to number of classes.</p><h4>Convolution Layer</h4><p>This layer for training image datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*1okwhewf5KCtIPaFib4XaA.gif" /></figure><p>We can pass the dimension of window you need to capture the group of pixels. Lets say 3 by 3. Capture to create a feature (on that maybe the model found some symbol or pattern like circle or square or other things). Stride and capture until the end of pixel.</p><h4>Flatten Layer</h4><p>This can convert the output of Conv2D to DenseLayer. From 2D value to single value layer</p><p>And if you use this for input layer, then you don’t need to specify the input. Because the input will be flattened.</p><h4>MaxPooling</h4><p>For me it’s not a layer. This use with Convolution Layer. To pooling the max value from Convolution Layer.</p><p>After create Convolution layer we add this. This optional. Maxpooling will get the max value from features by the size of pooling pool_size.</p><h4>Why we need Max Pooling?</h4><p>Because max pooling can reduce the amount of pixels, so that can make training faster. Also max pooling can reduce the over fitting. Because only the max value will be stored, not the exact of all the value of pixel.</p><h4>DropOut (additional layer)</h4><p>For me Dropout is not a Layer. If your training result is overfitting, then you can use Dropout.</p><p>In some cases drop out very useful, since the behavior is different with just reduce neurons number or reduce layers number.</p><p>In random way Dropout remove some neurons as many as number given at parameter. Random per each epoch process. And will ignored in test or predict processing.</p><blockquote>Don’t ever forget to add activation function every time you added a new layer</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c26a387d3dc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>