<?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 Syahrul Hamdani on Medium]]></title>
        <description><![CDATA[Stories by Syahrul Hamdani on Medium]]></description>
        <link>https://medium.com/@syahrulhamdani?source=rss-9d681d4f8193------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pt3PodGYdgoNjIGgLw3ReQ@2x.jpeg</url>
            <title>Stories by Syahrul Hamdani on Medium</title>
            <link>https://medium.com/@syahrulhamdani?source=rss-9d681d4f8193------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:17:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@syahrulhamdani/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[Extracting Daily YouTube Trending Video Statistics]]></title>
            <link>https://medium.com/geekculture/extracting-daily-youtube-trending-video-statistics-5de5f9fdc1b7?source=rss-9d681d4f8193------2</link>
            <guid isPermaLink="false">https://medium.com/p/5de5f9fdc1b7</guid>
            <category><![CDATA[youtube-api]]></category>
            <category><![CDATA[data-gathering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[deepnote]]></category>
            <dc:creator><![CDATA[Syahrul Hamdani]]></dc:creator>
            <pubDate>Wed, 13 Oct 2021 14:33:59 GMT</pubDate>
            <atom:updated>2021-10-13T14:33:59.865Z</atom:updated>
            <content:encoded><![CDATA[<h4>using YouTube Data API and a scheduled notebook in Deepnote</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cvAhMjXkXsehPFW1" /><figcaption>Photo by <a href="https://unsplash.com/@christianw?utm_source=medium&amp;utm_medium=referral">Christian Wiediger</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>“YouTube is much more than TV”</blockquote><p>We may have heard someone said this somewhere. Well, at least, in Indonesia, this statement is overheard. I personally think so… before I check the trending list.</p><p>Most of the videos that go on the trending list are basically from TV, I presume. Then, why don’t I track the list by myself?</p><h4>About The Article</h4><p>Inspired by the <a href="https://www.kaggle.com/datasnaek/youtube-new">similar work of others</a>, I’d like to share how I built a python script to automatically extract the trending video using YouTube Data API and schedule the run from a notebook hosted in Deepnote.</p><h3>What You Need</h3><p>First, since we want to retrieve YouTube video statistics, we need to follow some “getting started” steps to acquire an <strong>API key</strong> needed to interact with YouTube Data API. Basically, we need to create a project in Google Developer Console, obtain a credential with access to YouTube Data API, and get an API key. Check the docs <a href="https://developers.google.com/youtube/v3/getting-started#before-you-start">here</a> for further detail.</p><p>Next, make sure to have Python and <strong>2 main libraries </strong>installed, requests and Pandas. I didn’t do fancy analysis after the data is collected, so only those 2 libraries are installed. Also, kaggle since I stored all the data collected to Kaggle Dataset.</p><h3>Understanding YouTube’s Resources</h3><p>YouTube has a lot of resources and resources types. Quoting from the <a href="https://developers.google.com/youtube/v3/getting-started#resources">documentation</a>, “<em>a resource is an individual data entity with a unique identifier</em>”. In this case, we only care about the video resource, which represents a single YouTube video.</p><p>In each resource, there are some methods in which we can use to do what we want. Video resource itself has methods such as getRating, reportAbuse, list, etc. In our case, since we want to extract <strong>a list of trending videos</strong>, so we go with the list method.</p><p>The list method will return a list of videos that match what we requested. So, <strong>we need to tell the API what kind of videos we are requesting</strong>. The resulting resource representation is categorized into some sections, called part, each has its own properties, wrapped in a JSON format.</p><p>For example, snippet part consists of properties such as publishedAt, channelId, title, description, etc. While statistics part consists of properties like viewCount, likeCount, dislikeCount, etc.</p><h3>The Script</h3><p>The script I created follow a modular code, which means I don’t write all the codes in one large file main.py. Instead, I divided it into several parts:</p><ul><li>a repository code defined in theYouTube class</li><li>some utility functions in thecommon directory</li><li>other chores like a logging setup, exception handler, etc.</li></ul><p>All those modules are used in the main script, main.py. The full directory structure looks like this.</p><blockquote>I used <a href="https://github.com/pypa/pipenv">pipenv</a> and <a href="https://github.com/pyenv/pyenv">pyenv</a> to manage python version and virtual environment, hence there are Pipfile files.</blockquote><pre>.<br>├── Pipfile<br>├── Pipfile.lock<br>├── README.md<br>├── common<br>│   ├── __init__.py<br>│   ├── utils.py<br>│   └── video.py<br>├── data<br>├── last_retrieved_trending.py<br>├── main.py<br>├── storage<br>│   └── trending.csv<br>└── ytid<br>    ├── __init__.py<br>    ├── config.py<br>    ├── exceptions.py<br>    └── logger.py</pre><h4>YouTube API Class</h4><p>I defined a YouTube class as for interacting with YouTube API. We can consider this as our python API for YouTube.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90d0d12e7321778b403310cdf431172f/href">https://medium.com/media/90d0d12e7321778b403310cdf431172f/href</a></iframe><p>As we see there, the method get_trendings will iterate through the response item until no cursor is found. It’s our main method.</p><p>In the main.py, we can then import the class and write</p><pre>youtube = YouTube(url=config.URL, api_key=config.API_KEY)<br>videos = youtube.get_trendings()</pre><h4>Video</h4><p>For each video collected from the response item, we define it as Video which represents a YouTube <a href="https://developers.google.com/youtube/v3/docs/videos">video resource</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15835397c6a6701976cf91ff4c911af0/href">https://medium.com/media/15835397c6a6701976cf91ff4c911af0/href</a></iframe><p>Since we ask YouTube to return snippet, contentDetails, and statistics resources, we first provide necessary properties for each part. You can check other part resources on the <a href="https://developers.google.com/youtube/v3/docs/videos#properties">YouTube Data API docs</a>.</p><h4>Chore Modules</h4><p>There are also some chores modules. Some secrets like API Key are stored as environment variables, and by using pipenv, we can access read them using os.getenv function which lives in config.py. We also define some custom exceptions and a logging format.</p><h3>Scheduling Notebook</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hB8bvkEqxMjkTcm9DZDlTg.png" /><figcaption>Pict from <a href="https://analyticsdrift.com/data-science-real-time-collaboration-tool-deepnote-is-now-open-for-all/">https://analyticsdrift.com/data-science-real-time-collaboration-tool-deepnote-is-now-open-for-all/</a></figcaption></figure><p>After the code is ready, it’s time to run and get the trending data. Since I want to collect daily trending data, then it needs to be run daily. My first attempt is to run manually every day. Until I forget to run it at some points and hence some trendings data aren’t collected properly.</p><p>In May 2021, I received a product update through email, announcing that Deepnote now supports scheduling a notebook! At that time, I knew this is the place where I can run the YouTube trending code automatically and by schedule.</p><blockquote>Quoting from <a href="https://deepnote.com/">deepnote.com</a>, “Deepnote is a new kind of data science notebook. Jupyter-compatible with real-time collaboration and running in the cloud.”</blockquote><p>Below is a snapshot of the published article where the code is scheduled to run daily at 1 PM UTC+7. If you are curious, check the article <a href="https://deepnote.com/@syahrulhamdani/Indonesia-YouTube-Trending-Video-Statistics-pcmUcnRkQB-WGzIcdWQ8_g">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jO6ksnbyWUOwAHshR3hRlw.png" /><figcaption>Pict by author</figcaption></figure><p>If you want to use the scheduling features on Deepnote, read through the documentation <a href="https://docs.deepnote.com/features/scheduling">here</a>.</p><h4>Push to Kaggle Dataset</h4><p>After retrieving the trending data, the next step is to upload it to Kaggle Dataset. Again, since I want to automatically embed the upload/update step in the scheduled notebook, I use kaggle API and run it as a bash command in a notebook cell, just like the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dunFJN_Gw7rlJxXjq1XvbQ.png" /><figcaption>Pict by author</figcaption></figure><h3>To close this…</h3><p>Thank you for reading until the final section here. So far, you’ve known my approach to retrieve YouTube trending data, both the codes and the “deployment”. I encourage you to take a look at the code repository for full detail below.</p><p><a href="https://github.com/syahrulhamdani/ytid-trends">GitHub - syahrulhamdani/ytid-trends: Indonesia YouTube Trending Video Statistics</a></p><p>Thank you and stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5de5f9fdc1b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/extracting-daily-youtube-trending-video-statistics-5de5f9fdc1b7">Extracting Daily YouTube Trending Video Statistics</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How You Should Learn Data Science]]></title>
            <link>https://medium.com/analytics-vidhya/how-you-should-learn-data-science-b657977841f9?source=rss-9d681d4f8193------2</link>
            <guid isPermaLink="false">https://medium.com/p/b657977841f9</guid>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[indonesia]]></category>
            <dc:creator><![CDATA[Syahrul Hamdani]]></dc:creator>
            <pubDate>Fri, 01 Jan 2021 02:32:44 GMT</pubDate>
            <atom:updated>2021-01-03T16:44:43.680Z</atom:updated>
            <content:encoded><![CDATA[<h4>3 Findings From 2020 Kaggle Data Science &amp; Machine Learning Survey for Aspiring Indonesia Data Talents</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gO747cQbEvGcbhcF" /><figcaption>Photo by <a href="https://unsplash.com/@mufidpwt?utm_source=medium&amp;utm_medium=referral">Mufid Majnun</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Motivation</h3><p>This whole year we are forced to adapt without ceasing due to the pandemic. Especially for some of us, who have to undertake a career shifting or even lose our job. Students, especially in Indonesia, who aren’t used to do online learning for a lot of reasons, are struggling to learn at the same pace.</p><p>This pandemic also teaches us, in reality, most government decision-making processes are based on <strong>data</strong>. We are now more mindful of data.</p><p>In contrast, people who are in charge of extracting insights and contributing to those decision-making processes are still wanted.</p><p>So…</p><p>Is Indonesia lack data scientist, or generally speaking, data talents <strong>a lot</strong>?</p><p>Over and above that, how are exactly Indonesian data scientists or machine learning engineers’ state?</p><p>For aspiring data scientists, how should they learn data science, driven by (post-)pandemic circumstances?</p><p>By exploring the <a href="https://www.kaggle.com/c/kaggle-survey-2020/data"><em>2020 Kaggle Machine Learning &amp; Data Science Survey</em></a>, we will try to uncover the answers to those questions.</p><h3>The Survey At A Glance</h3><p>First, let’s take a glance at the survey data.</p><ul><li>The survey was live for 3.5 weeks in October. After cleaning the data, it consists of 20,036 responses with more than 39 questions.</li><li>The questions are comprised of <strong>multiple-choice questions</strong> and <strong>multiple-selection questions</strong>.</li><li>Respondents with the least experience were asked the least questions than the most experience.</li><li>Some questions are asked if only respondents meet certain criteria(s).</li><li>Hence, there is a lot of missing values by nature.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*zn7cwmiC48WVgzHo8AHtdw.png" /><figcaption>Where is Indonesia?</figcaption></figure><p>Indonesia is at 15th with less than 500 respondents. India is at the top with 10x more than Indonesia’s. Looking at the bright side, we are the only South-east Asia country that sits on the top 15 contributions to the Kaggle survey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*WxQpXlopS0Hbnjb4bCYUDQ.png" /><figcaption>Advanced degrees, like master and doctoral, are in the top 3</figcaption></figure><p>Most of the respondents have higher degrees. Precisely, more than 50% of respondents have bachelor’s and master’s degrees combined. Does this mean we need to take a master’s degree to be a data scientist? We will see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*SJhueI0ROh8amNCrYx11QA.png" /><figcaption>Python is (still) recommended</figcaption></figure><p>Well, Python is, by far, the most recommended programming language for an aspiring data scientist to learn first.</p><h3>Limitation</h3><blockquote>Of all 20,036 respondents, after removing irrelevant respondents (those who only answer the first 3 questions), we only get 280 respondents who reside in Indonesia</blockquote><p>As a comparison, we decided to create 3 subgroups, which are <strong>Indonesia</strong>, <strong>Southeast Asia</strong>, and <strong>Global</strong>. For reference, Southeast Asia and Global contribute 498 and 18791 respondents, respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R11B9cDgRpfcPtCNOH4tig.png" /><figcaption>Image from <a href="https://en.wikipedia.org/wiki/Southeast_Asia">Wikipedia</a></figcaption></figure><blockquote>We found 9 countries exist in the dataset that belongs to the Southeast Asia subgroups, excluding Indonesia, they are Brunei, Cambodia, Laos, Malaysia, Philippines, Myanmar, Singapore, Thailand, Timor-Leste, and Vietnam.</blockquote><h3>Data Talents in Indonesia</h3><p>We refer to <strong>data talents</strong> as anyone who deals with data in their day-to-day work or anyone who are learning and want to work that relies on data to a great extent, e.g. data engineer, data analyst, or any titles that exist in the survey data.</p><p>To be able to understand the state of data talents in Indonesia, we inspect their job titles and educational backgrounds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwZR3x6BZ5dsRDMo7dufWw.png" /></figure><p>My first expectation was that Data Scientist is the most popular role selected in the survey (well, it’s a survey from Kaggle). But, as we can see, Student is the most popular role. In fact, it’s the most selected role for all subgroups.</p><blockquote>This signifies a lot of respondents are in the middle of their learning path.</blockquote><p>Another similar character between those 3 subgroups is that the bottom 3 roles selected are Data Engineer, Statisticianand DBA/Database Engineer.</p><p>It seems like respondents from other SEA countries are more of non-professional aspiring data scientists compare to Indonesia’s and global’s. Data Scientist is in the top 5 roles in Indonesia and Global. It’s even the second most selected job title in Indonesia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*szxy79BDNrbfJ9kmhhgheA.png" /></figure><p>Consider the formal educational background for professional or non-professional respondents plans to attain within the next 2 years above.</p><p>Although Master&#39;s Degree is the most educational background overall respondents have, the case is different from Indonesia. Most background Indonesian respondents have is Bachelor&#39;s Degree. One deviation would be Machine Learning Engineerwhose most background is Master&#39;s Degree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxxpSAapow1Wc_mNjUfKGQ.png" /></figure><p>If we compare to the global’s state, Master&#39;s Degree is the most common educational background. In fact, Research Scientist requires a higher degree, Doctoral or Master’s, while in Indonesia there is an only slight difference between a bachelor, master, and doctoral. It’s not so much though compare to global.</p><h3>Most Used Data Science Tools and Platform</h3><p>There are so many tools, library, or platform that can help in doing data science projects. Most of them are open-source, some are paid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*EBNpsF86f1aBMU6PvAbDXQ.png" /><figcaption>All-red bar plot means it’s a multiple-choice question and the colourful ones are multiple-selection questions</figcaption></figure><p>Of course, Python is the main programming language used regularly in Indonesia and for other 2 subgroups, along (maybe, parallel) with SQL and R. This gives rise to the most used IDE that, still, belongs to the Jupyter family (Lab, Notebook, etc.).</p><blockquote>One interesting is that in Indonesia, Julia hasn’t been used at all, for either learning or in a data science project. While in other SEA countries and globally, some respondents have tried to use Julia.</blockquote><p>While for hosted notebooks, Colab and Kaggle notebooks took the first and second place, respectively. In my case, I started to use <a href="https://deepnote.com/">Deepnote</a> and some of my notebook projects was turned into interactive notebooks using Binder. But, seems other respondents don’t use it, compare to other subgroups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*WQVECFu_OiBfDBJRk-QqNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*yG9jxprj6X7XxY6Cuw0I6Q.png" /><figcaption>Hosted notebook products for other SEA countries (left) and global (right)</figcaption></figure><p>In terms of libraries, the combination of Matplotlib and Seaborn is the most used visualization libraries. The same story applies to machine learning libraries where Scikit-learn, TensorFlow, Keras, and PyTorch in decreasing order.</p><p>What surprised me is that <em>local development environment</em>, like JupyterLab, RStudio, etc., is the primary tool used in 2 other subgroups, while most respondents in Indonesia are still using basic software such as Excel or Google Sheets as their primary tool to analyze data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*bTySWFdbNld4ObJkxdHLdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*V8HWlu9VNIcCeN_0xtIJww.png" /><figcaption>The primary tool to analyze data for other SEA countries (left) and global (right)</figcaption></figure><h3>How Aspiring Indonesia Data Scientist Should Learn</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oZav4bcNQOTyZP7JUgdn1Q.png" /></figure><p>For an aspiring data scientist, especially those who reside in Indonesia, it’s very recommended to learn Python as your first programming exposure. Or if not, at least you should focus on Python first.</p><p>Basic methods such as linear or logistic regression are the most frequently used algorithm. Since it constructs a vital foundation for more complex models, you may want to start digest those basics first.</p><blockquote>There’re still few respondents who use evolutionary approaches on their regular basis, in all subgroups. Huge respect for evoluationary approaches!</blockquote><p>In computer vision world, downstream tasks like image classification and object detection may become a routine for professional or research scientist. Hence, methods which deal with that kind of tasks are among the 3 most used methods, along with other general-purpose vision tools, like PIL, cv2, skimage, etc.</p><p>At the same time, in the NLP world, word embedding like word2vec or fastText is among the most used NLP methods. This is because word embedding/vectors are required to apply other advance methods, like encoder-decoder models or Transformers language models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*WW9B00x0GfXYT14zOVA5cg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*TU7i5ZKjOO2DFVeix70D4Q.png" /><figcaption>Core activities at work for SEA countries (left) and global (right)</figcaption></figure><p>Now, if we inspect the above visualization about core activities at work for SEA countries and global, they have the same level of urgency in what they do at work. As we all can see, <strong>analyzing and understanding data to influence products and business decisions</strong> become a regular thing yet the most important one.</p><p>While in Indonesia, analyzing data to influence products is still the most selected core activities, but <strong>data infrastructure</strong> still the second have-to-do activity. Only then, they focus on <strong>prototyping</strong>, <strong>deploying model</strong>, and then <strong>research</strong>. Even <strong>iteration to improve the existing model</strong> is the lowest citizen in the work if you compare with other 2 subgroups.</p><h3>Key Takeaways</h3><ul><li>Most data professionals in Indonesia are bachelor graduate compare to data professionals globally which are master graduate. We can’t say whether this is a lack, though.</li><li>Python is still, by far, irreplaceable programming language to use for data science.</li><li>Traditional software like Microsoft Excel or Google Sheets is the main statistical tools to analyze and exploring data. While globally, the local development environment like JupyterLab or RStudio is the main tools, as well as in other SEA countries (almost the same with traditional software)</li><li>Vital foundational methods like linear or logistic regression still worth to learn first. Besides it’s foundational, they are still used either as a first model iteration or it’s just the right model to use with the lowest cost and good performance.</li><li>Although Coursera is the most popular MOOC in other 2 subgroups, respondents from Indonesia mostly use Kaggle Learn Courses to learn data science.</li><li>Data pipeline may be still an issue in Indonesia since most respondents state it as second important work after analyzing and understanding data.</li><li>Data talents in Indonesia could be still <strong>in the development phase</strong> where they try to connect all important end-to-end data pipeline while they also learn to apply fancy machine learning models.</li></ul><p><em>All codes to generate the visualization are available in a notebook at </em><a href="https://github.com/syahrulhamdani/how-you-should-learn-data-science/tree/main"><em>my GitHub</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b657977841f9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/how-you-should-learn-data-science-b657977841f9">How You Should Learn Data Science</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[Keyword-only Arguments in Python]]></title>
            <link>https://medium.com/analytics-vidhya/keyword-only-arguments-in-python-3c1c00051720?source=rss-9d681d4f8193------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c1c00051720</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Syahrul Hamdani]]></dc:creator>
            <pubDate>Tue, 09 Jun 2020 15:50:06 GMT</pubDate>
            <atom:updated>2020-06-09T15:50:06.029Z</atom:updated>
            <content:encoded><![CDATA[<h4>The magic of asterisk in Python — Part II</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0EMvUcdait7uEorP" /><figcaption>Photo by <a href="https://unsplash.com/@cedericx?utm_source=medium&amp;utm_medium=referral">Cederic X</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So, you’ve read the <a href="https://medium.com/analytics-vidhya/the-magic-of-asterisks-in-python-aed3538deef9">basic magic of asterisk in python</a> and now want more? Sure. Time to enter the castle. If you’re not ready yet, feel free to visit that previous article, and come back when you feel you’re ready. Or at least, you’ve tried your own.</p><p>In this article, we will talk mostly about <a href="https://www.python.org/dev/peps/pep-3102/">PEP3102</a> which proposed <strong>keyword-only</strong> <strong>arguments</strong> for python.</p><h3>Keyword Arguments</h3><p>In the <a href="https://docs.python.org/3.8/glossary.html">python glossary</a>, you’ll find a section defining what <em>argument</em> means in python. Just like any other programming language, an argument is a value passed into the function (or method) when doing function calls. In python, there are <strong>2 kinds of argument</strong>:</p><ol><li>Keyword Argument<br>A keyword argument is an argument preceded by an identifier (named arguments). Notice that the value here is passed in a function call and not the <strong>default value</strong> when defining function parameters.</li><li>Positional Argument<br>A positional argument, simply, is all argument that is not a keyword argument.</li></ol><p>One example is when using requests.get, we often pass the URL in a string directly. In this scenario, we just give the function a positional argument for parameter url. But, if we pass a value something like requests.get(url=&#39;https://your-url.com/&#39;) , then we’re passing in a keyword argument.</p><blockquote>Don’t make yourself confused with <strong>required</strong> and <strong>optional</strong> argument. These 2 are due to when we define a function with its parameter(s). If we include a parameter with default value, later the argument become optional. Otherwise, we are required to pass an argument, hence required positional argument.</blockquote><p>Now, when we make a function call, it’s up to us to pass arguments as a positional or keyword argument. But, as python upholds readability, the consideration is if the arguments are obvious to be passed in, then we just pass the value as a positional argument. In contrast, also most likely, we want other users to know what value we pass into what parameter. So, keyword argument.</p><h3>Keyword-only Arguments</h3><p>Using asterisks when defining a function, gives us a higher level of magic. It’s called <strong>keyword-only arguments</strong>. This type of argument has a similar behavior as that vanilla keyword argument, but it <strong>forces</strong> users to pass keyword arguments rather than positional or direct arguments.</p><pre>def generate_username(*users, separator, length=None):<br>    users = [user.lower().split() for user in users]<br>    username = [separator.join(user) for user in users]<br>    if length:<br>        username = [user[:length] for user in username]<br>    return username</pre><p>Let’s use the above function as an example. The function will generate usernames in a simple way, with users’ custom separator. Notice that it uses packing arguments there. So, we can call it like</p><pre>&gt;&gt;&gt; generate_username(&quot;John&quot;, &quot;Mr Smith&quot;, &quot;Mrs Smith&quot;, separator=&quot;_&quot;)</pre><p>and will result [&#39;john&#39;, &#39;mr_smith&#39;, &#39;mrs_smith&#39;].</p><p>Now, where’s the magic you ask? Try passing &quot;_&quot; as a positional argument like below.</p><pre>&gt;&gt;&gt; generate_username(&quot;John&quot;, &quot;Mr Smith&quot;, &quot;Mrs Smith&quot;, &quot;_&quot;)<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>TypeError: get_username() missing 1 required keyword-only argument: &#39;separator&#39;</pre><p>Take that error! You’re missing 1 <strong>required keyword-only argument: separator</strong>. What’s that? That, actually, is the effect of using an asterisk in a function followed by a required parameter, separator.</p><p>As PEP 3102 stated, every parameter defined after an asterisk in a function needs to be passed <strong>keyword-only arguments</strong>. That is, by specifying the parameter name. This allows us to define additional parameters after asterisks that won’t be packed together. Since we embed the asterisk with parameter users, it becomes an <strong>optional positional packing argument</strong>.</p><blockquote>The <strong>optional positional packing argument</strong> is a packing argument just like described in the <a href="https://medium.com/analytics-vidhya/the-magic-of-asterisks-in-python-aed3538deef9">previous article</a>.</blockquote><p>The above function will suck up any positional arguments before we pass a keyword argument for separator. Now what if we don&#39;t want to capture any positional arguments, in the above example, for parameterusers. We can just use the magic, just a single asterisk. Let’s redefine the above function.</p><pre>def generate_username(users, *, separator, length=None):<br>    users = [user.lower().split() for user in users]<br>    username = [separator.join(user) for user in users]<br>    if length:<br>        username = [user[:length] for user in username]<br>    return username</pre><p>The difference here is we can’t pass any number of positional arguments, instead we pass it into the parameter users as a collection (list or tuple).</p><pre>&gt;&gt;&gt; list_users = [&quot;jhonny&quot;, &quot;Jadon Smith&quot;, &quot;Mr Smith&quot;, &quot;Mrs Smith&quot;]<br>&gt;&gt;&gt; generate_username(list_users, separator=&quot;_&quot;)<br>[&#39;jhonny&#39;, &#39;jadon_smith&#39;, &#39;mr_smith&#39;, &#39;mrs_smith&#39;]</pre><p>If we pass a &quot;_&quot; as a positional argument, it will throw an error like below.</p><pre>&gt;&gt;&gt; generate_username(list_users, &quot;_&quot;)<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>TypeError: generate_username() takes 1 positional argument but 2 were given</pre><p>This is because any leftover parameters after the asterisk * will require a keyword to pass the arguments, as stated in the PEP 3102 below.</p><blockquote>Since Python requires that all arguments be bound to a value, and since the only way to bind a value to a keyword-only argument is via keyword, such arguments are therefore “required keyword” arguments.</blockquote><h3>Takeaways</h3><p>Using the asterisks in python, we have <a href="https://treyhunner.com/2018/10/asterisks-in-python-what-they-are-and-how-to-use-them/#Positional_arguments_with_keyword-only_arguments">2 options</a> to define a function with keyword-only arguments:</p><ol><li>Keyword-only arguments with a positional argument</li><li>Keyword-only arguments without positional argument</li></ol><p>These 2 scenarios are proposed first in the PEP 3102, you can read more about the rationale why this magic exists.</p><h3>References</h3><p>[1] Trey Hunner, <a href="https://treyhunner.com/2018/10/asterisks-in-python-what-they-are-and-how-to-use-them/#Positional_arguments_with_keyword-only_arguments">Asterisks in Python: what they are and how to use them</a> (2018)</p><p>[2] <a href="https://www.python.org/dev/peps/pep-3102/">PEP 3102</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c1c00051720" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/keyword-only-arguments-in-python-3c1c00051720">Keyword-only Arguments in Python</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[The Magic of Asterisks in Python]]></title>
            <link>https://medium.com/analytics-vidhya/the-magic-of-asterisks-in-python-aed3538deef9?source=rss-9d681d4f8193------2</link>
            <guid isPermaLink="false">https://medium.com/p/aed3538deef9</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Syahrul Hamdani]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 08:01:01 GMT</pubDate>
            <atom:updated>2020-04-02T16:05:34.437Z</atom:updated>
            <content:encoded><![CDATA[<h4>Packing and Unpacking</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FDVi6dqpo1hFcT_Q" /><figcaption>Photo by <a href="https://unsplash.com/@art_maltsev?utm_source=medium&amp;utm_medium=referral">Artem Maltsev</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Python right now is the most popular programming language based on <a href="https://pypl.github.io/PYPL.html">PYPL</a>. This below graph tells all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*wPS2lIgBdGe4j7VfE_SMkw.png" /><figcaption>Programming language popularity based on PYPL per March 2020.</figcaption></figure><p>Now, how does python can be so much popular nowadays? It’s because of magic! Yes, python’s magic offers a handful of features for developers. Asterisk (*) is one of the magic.</p><h3>1. Magic 1: Packing</h3><p>We often use print to display objects to the stream file output. If you look at the documentation of the <a href="https://docs.python.org/3.7/library/functions.html#print">print function</a>, the parameter *objects is a <strong>packing argument</strong>. Say, you want to print a variable text = &quot;Work From Home&quot; and add a prefix sentence: . You can just write:</p><pre>&gt;&gt;&gt; text = &quot;Work From Home&quot;<br>&gt;&gt;&gt; print(&quot;sentence:&quot;, text)<br>sentence: Work From Home</pre><p>This is because your arguments passed into print are all packed in variable objects. The asterisk (*) prefix in the variable objectis used to tell python that it’s a packing argument, “Dear python, accept all arguments!”. You do this the same way as you pass multiple arguments. So, you actually can pass any number of arguments into the function.</p><pre>&gt;&gt;&gt; print(&quot;this&quot;, &quot;could&quot;, &quot;work&quot;, &quot;too.&quot;, &quot;But,&quot;, &quot;a&quot;, &quot;waste&quot;, &quot;of&quot;, &quot;time&quot;)</pre><blockquote>How could this be possible?</blockquote><p>Now, let’s create our own function to demystify this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c60d1341a7f6de2a731f2a93b9a7425/href">https://medium.com/media/2c60d1341a7f6de2a731f2a93b9a7425/href</a></iframe><p>This function will take any number of arguments you pass. We print the whole objects, we will see what type it is, and we will do a looping (wait, what?). If you pass these long arguments into the function,</p><pre>demystify_single_asterisk(a, text, [&quot;text one&quot;, &quot;text two&quot;], {&quot;your&quot;, &quot;set&quot;}, 100, .30, {&quot;this&quot;: &quot;is&quot;, &quot;your&quot;: &quot;dict&quot;}, (&quot;tuple&quot;, &quot;too&quot;))</pre><p>We will have an output below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xl8i7-2y_FvQv2pv2Ww1zQ.png" /><figcaption>Very cool magic!</figcaption></figure><p>It turns out that Python treats our packing arguments as a tuple. So, we can perform any operation just like any other tuple, such as indexing or looping.</p><p>This single asterisk (*) gives us cool magic. How about we add another asterisk to be a double asterisk (**)?</p><p>If you ever use Matplotlib <a href="https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html#matplotlib.pyplot.plot">plot function</a>, you may have encountered a parameter called **kwargs. This is also a packing argument, as a complement to packing argument *args. You may have tried to pass a keyword argument label into the function, but you can’t find it in the parameters list. This is handled by double asterisks packing argument. Let’s create another function similar to the previous one to demystify this.</p><blockquote><a href="https://docs.python.org/3.7/glossary.html"><strong>Keyword argument</strong></a><strong> </strong>is an argument preceded by an identifier (e.g. <em>name=</em>)</blockquote><p>Now, try to call this function with the below arguments.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b79d27d986c436102233ab790f78da61/href">https://medium.com/media/b79d27d986c436102233ab790f78da61/href</a></iframe><pre>demystify_double_asterisk(name=&quot;Tony&quot;, job=&quot;Hero&quot;, quotes=&quot;I love you tons&quot;)</pre><p>We will get output like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*kh6TFi8OGc4DtIGxYdgC8g.png" /></figure><p>So, by preceding a parameter with double asterisks (**) will treat it as a packing argument that yields a Python dictionary. The keyword name will act as a dictionary key and the argument will act as a dictionary value. Hence, as we pass name=&#39;Tony&#39;, Python will treat it like a dictionary {&#39;name&#39;: &#39;Tony&#39;}. The full dictionary of our arguments above is like below.</p><pre>{&#39;name&#39;: &#39;Tony&#39;, &#39;job&#39;: &#39;Hero&#39;, &#39;quotes&#39;: &#39;I love you tons&#39;}</pre><p>An example of how useful this magic is by creating our own function, say to make an HTML tag (heavily inspired by T<a href="https://treyhunner.com/2018/10/asterisks-in-python-what-they-are-and-how-to-use-them/#Asterisks_for_packing_arguments_given_to_function">rey Hunner</a>).</p><pre>def make_tag(tag_name, **attr):<br>    attributes = [f&quot;{name}={value}&quot; for name, value in attr.items()]<br>    return f&quot;&lt;{tag_name} {&#39; &#39;.join(attributes)}&gt;&quot;</pre><p>If you want to make an image tag, you can just type below syntax.</p><pre>make_tag(&quot;img&quot;, width=100, height=100, href=&quot;&#39;img/example.png&#39;&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*d4SqbaglWioUN6QsRF50KQ.png" /></figure><h3>2. Magic 2: Unpacking</h3><p>The opposite magic of packing argument is, of course in a grammatical manner, <strong>unpacking</strong>. Unpacking will well, unpack, all python iterable. Let’s use the print function again. If you define a list my_list like below and then print it, you will get</p><pre>&gt;&gt;&gt; my_list = [&quot;write&quot;, &quot;from&quot;, &quot;home&quot;]<br>&gt;&gt;&gt; print(my_list)<br>[&#39;write&#39;, &#39;from&#39;, &#39;home&#39;]</pre><p>Now, if you prepend an asterisk (*) before my_list inside the print function, you will get</p><pre>&gt;&gt;&gt; print(*my_list)<br>write from home</pre><p>Magic!</p><p>The asterisk (*) beforemy_list will unpack items in my_list into separated arguments passed into the print function, hence it will behave as we pass arguments like print(&#39;write&#39;, &#39;from&#39;, &#39;home&#39;). Let’s dive in!</p><p>Here, I created a simple function demystify_unpack that accepts any number of arguments packed in iterables. This function just prints the arguments and the data type.</p><pre>def demystify_unpacking(*iterables):<br>    print(iterables, type(iterables)</pre><p>We then pass my_list and *my_list as an argument. The output of these two experiments, respectively, are:</p><pre>&gt;&gt;&gt; ([&#39;write&#39;, &#39;from&#39;, &#39;home&#39;],) &lt;class &#39;tuple&#39;&gt;<br>&gt;&gt;&gt; (&#39;write&#39;, &#39;from&#39;, &#39;home&#39;) &lt;class &#39;tuple&#39;&gt;</pre><p>As we know, any number of arguments will be packed by iterables hence the type is always a tuple. The difference is my_list passing a list, but *my_list will unpack it first and pass multiple arguments just like we pass &#39;write&#39;, &#39;from&#39;, &#39;home&#39; into the function.</p><p>Another utility using this magic when it’s used to unpack iterable in an assignment (first introduced in <a href="https://www.python.org/dev/peps/pep-3132/#id8">PEP 3132</a>). Here are some examples.</p><pre>&gt;&gt;&gt; seq = [&quot;write&quot;, &quot;and&quot;, &quot;work&quot;, &quot;from&quot;, &quot;home&quot;, &quot;is&quot;, &quot;awesome&quot;]<br>&gt;&gt;&gt; a, b, c, *d = seq<br>&gt;&gt;&gt; print(a)<br>write<br>&gt;&gt;&gt; print(b)<br>and<br>&gt;&gt;&gt; print(c)<br>work<br>&gt;&gt;&gt; print(d)<br>[&#39;from&#39;, &#39;home&#39;, &#39;is&#39;, &#39;awesome&#39;]</pre><p>The left side of the operator will be assigned items from seq with a is the first item, b is the second, and c get the third item. For the variable d, we will get all remaining items thanks to the magic of unpacking. You may want to try another assignment such as *k, l, m = seq which results k equals to [&#39;write&#39;, &#39;and&#39;, &#39;work&#39;, &#39;from&#39;, &#39;home&#39;].</p><h3>That’s It!</h3><p>We only cover packing and unpacking in this article, but there are other magics which still exist such as asterisk in a list or dict literals and the usage in keyword-only arguments and positional arguments with keyword-only arguments. We will cover them in the next article.</p><h3>References and Resources</h3><p>[1] Trey Hunner, <a href="https://treyhunner.com/2018/10/asterisks-in-python-what-they-are-and-how-to-use-them/#Positional_arguments_with_keyword-only_arguments">Asterisks in Python: what they are and how to use them</a> (2018)</p><p>[2] <a href="https://www.python.org/dev/peps/pep-3132/#id8">PEP 3132</a> (2007)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aed3538deef9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/the-magic-of-asterisks-in-python-aed3538deef9">The Magic of Asterisks in Python</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[Data Science: An Introduction]]></title>
            <link>https://syahrulhamdani.medium.com/data-science-an-introduction-a60a1a6fb066?source=rss-9d681d4f8193------2</link>
            <guid isPermaLink="false">https://medium.com/p/a60a1a6fb066</guid>
            <category><![CDATA[apa-itu-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[intro-to-data-science]]></category>
            <category><![CDATA[what-is-data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Syahrul Hamdani]]></dc:creator>
            <pubDate>Sat, 11 May 2019 12:08:27 GMT</pubDate>
            <atom:updated>2019-05-11T12:08:27.431Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s get to know with data science, from what until how to master it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*J48jVBadDG1-Tj7lEia7gg.jpeg" /></figure><blockquote>So, you are curious about data science? Medium is a platform recommended by Thor and Loki. Let’s start the discussion.</blockquote><h3>What is Data Science?</h3><p>Many articles define data science distinctly. <a href="https://medium.com/u/2fccb851bb5e">Cassie Kozyrkov</a> has written an article about the <a href="https://hackernoon.com/what-on-earth-is-data-science-eb1237d8cb37">journey of finding a simple yet meaningful definition</a>. <a href="https://en.wikipedia.org/wiki/Data_science">Wikipedia</a> defines it clearly,</p><blockquote>Data science is a multi-disciplinary field that uses scientific methods, processes, algorithms and systems to extract knowledge and insights from structured and unstructured data</blockquote><p>There are a lot of diagrams that visualize what skills need to master data science. <a href="https://www.kdnuggets.com/2016/10/battle-data-science-venn-diagrams.html">The battle of Venn Diagrams in KDnuggets</a> will show you some of the well-known diagram, if not all. Choosing among those diagrams, I am stating that the last diagram (not so Venn Diagram) is more suited. It’s like telling us to ignore all the boundaries of each discipline, make a whole new data science disciplinary, then create other supporting skills for data science outside data science circle and aim an arrow for each those skills to data science circle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*BFTJ-_4ifsbvwZnLCMa3rw.png" /><figcaption>Data science Venn diagram of the future from KDnuggets</figcaption></figure><p>Actually, it’s not a problem of defining what data science means. Well, when I was taking <em>Fundamentals of Mathematics II </em>class, my teacher told us that we fully understand the definition of a concept <strong>if and only </strong>we are able to point out what is and what is not the example of that concept. So, in my opinion, it’s up to you to define what data science actually means as long as we are capable of pointing out what is and what is not.</p><h4>It’s more about science and collaboration</h4><p>I just want to revise a phrase <em>multi-disciplinary</em> and replace it with a phrase, <strong>collaborative</strong>. Yes, data science is a collaborative field. A data scientist may, even most of the time, require help from other people (beyond those 3 domains — assuming those domains are what an aspiring data scientist need to master).</p><p>There is “science” in data science. Data is the object and science is the “how”, how to make the data useful, how to get insights from data, how to infer using the data, most of them are about science. Data science is always related to <em>machine learning</em> to use the data and make an inference about the future.</p><blockquote><a href="https://medium.com/u/2a2ae028a675">Yufeng G</a> wrote an article about <a href="https://towardsdatascience.com/what-is-machine-learning-8c6871016736">what machine learning is</a> and you can dive in directly with him and Google Cloud.</blockquote><h3>Why does Data Science exist?</h3><p>Everyone knows that data is ubiquitous. Every day we generate data, on purpose and/or accidentally. This <em>big</em> data has grown into a massive data that conventional strategy and research can’t handle. Then, data science is born. We can argue with this background but, surely data science exists because of the needs of modern process or method to handle it. Hence, we need a computer to help us to do computation. So, it&#39;s not overstated if someone says<em> </em>data scientist is a statistician who can code. In fact, these people already exist even before data science term exists.</p><p>Also, <em>machine learning</em> has become a major part of data science. All data science job postings require candidates to possess <em>machine learning </em>knowledge, from traditional machine learning like <em>linear regression </em>or SVM, etc. until deep learning like CNN or LSTM.</p><blockquote>Data science exist because of needs. It means if you (your company) doesn’t need data science yet, then don’t hire data scientist yet.</blockquote><h3>Things you need to know</h3><p>I consider myself as an aspiring data scientist, still aspiring. My experience real-world data science is still less than other people who call themselves as a data scientist. So, I want to share what things or skills, you (we) need to be a (real) data scientist.</p><ol><li><strong>Mathematics</strong>: Calculus, Linear Algebra, Multivariable Calculus, Optimization, etc.</li><li><strong>Statistics</strong>: Probability, Hypothesis Testing, Distribution, etc.</li><li><strong>Programming</strong>: Python, R, Matlab, Octave, C++ (choose one or take all)</li><li><strong>Machine Learning</strong>: Linear Regression, SVM, Decision Tree, Random Forest, etc.</li><li><strong>Deep Learning (optional)</strong>: CNN, RNN, LSTM, GAN, etc.</li></ol><p>It seems too much to be learned, but, once you have learned the basic, the intuition beyond, it’s so much easier. Even, we can learn recent development in data science research faster and apply it by ourselves.</p><h3>Learning Resources</h3><p>There are so many resources on the internet you can browse by yourself. You can type “data science learning resources” or other queries, then you will get what you want. Although, some publications in medium mention have their own top resources version. But, here are resources I have learned from.</p><ol><li><a href="https://kaggle.com/">Kaggle</a></li><li><a href="https://www.udacity.com/">Udacity</a></li><li><a href="https://www.udemy.com/">Udemy</a></li><li><a href="https://medium.com/">Medium</a></li><li><a href="https://www.kdnuggets.com/">KDnuggets</a></li><li><a href="https://elitedatascience.com/">Elite Data Science</a></li></ol><p>This is my first post about data science. I hope I can continuously write articles related to data science more frequently. See you in the next article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a60a1a6fb066" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My “Real” Internship as an AI Engineer at Nodeflux]]></title>
            <link>https://syahrulhamdani.medium.com/my-real-internship-as-an-ai-engineer-at-nodeflux-1d07aa43252a?source=rss-9d681d4f8193------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d07aa43252a</guid>
            <category><![CDATA[summer-internships]]></category>
            <category><![CDATA[ai-engineer]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Syahrul Hamdani]]></dc:creator>
            <pubDate>Wed, 19 Sep 2018 12:31:02 GMT</pubDate>
            <atom:updated>2018-09-19T12:31:02.127Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Scn5evzMI3uPqYWB" /><figcaption>Pict by <a href="https://unsplash.com/@marvelous?utm_source=medium&amp;utm_medium=referral">Marvin Meyer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Kebanyakan orang saat ini mungkin akan setuju bahwa pendidikan formal bukanlah satu-satunya jalan untuk memperoleh ilmu. Di dunia yang serba digital, semua tersedia secara gratis dan bisa diakses kapan saja dan di mana saja. Sebagai contoh, banyak <strong>MOOC</strong> yang layak untuk diikuti selain pendidikan formal. Bahkan, banyak juga perusahaan yang lebih memilih lulusan MOOC dibanding lulusan pendidikan formal karena alasan ilmu yang lebih praktis dan penerapannya. <em>My choice, is to have an internship in a startup!</em></p><h3>An opportunity to do internship as AI Engineer</h3><p>Selama 8 minggu sejak Agustus 2018 kemarin, saya berkesempatan untuk “mencicipi” bagaimana rasanya bekerja di sebuah <em>startup</em>, <a href="https://nodeflux.io/">Nodeflux</a>, sebagai AI Engineer Intern.</p><h4>Why AI Engineer?</h4><p>Sejujurnya, lowongan pada saat itu berjudul <em>Software Engineer</em>. Meski begitu, <em>Alhamdulillah</em>, saya diberi kesempatan untuk magang sebagai <em>Data Science</em> (sesuai judul yang tertera di <em>email</em> konfirmasi waktu itu). <em>Although, people in Nodeflux name “that kind of person” as </em><strong><em>AI Research Scientist</em></strong>. Ya, hanya judul saja.</p><p><em>Well</em>, alasan utama mengikuti program <em>internship</em> ini adalah karena saya sangat tertarik dengan dunia AI, lebih spesifiknya <em>Data Science </em>dan <em>Machine Learning</em>. Mulai mengenal dan belajar secara intens sejak 2017 kemarin, lalu kemudian diberi kesempatan untuk belajar secara nyata sebagai AI Engineer, <em>that feeling is just amazing!</em></p><blockquote>You know you did great when you got the appreciation, although the small one, but it will boost you 10x!</blockquote><p>Sekarang, saya ingin bercerita tentang pengalaman selama 2 bulan magang. Mulai dari ekspektasi, <em>challenge</em>, pencapaian, dan hal lainnya.</p><h3>Induction</h3><p>Minggu pertama dimulai dengan perkenalan apa itu Nodeflux dan bagaimana mereka memberikan <em>value</em> melalui AI dan <em>Computer Vision</em>. Sedikit <em>company profile</em>, Nodeflux adalah sebuah startup yang menawarkan Platform <em>Intelligence Video Analytics </em>berbasis AI, seperti <em>Face Recognition</em>, <em>License Plate Recognition, Traffic Measurement</em>, dan sebagainya.</p><p>Di minggu pertama ini saya belajar tentang pentingnya <em>project environment</em>. Bagi kebanyakan orang yang terbiasa menggunakan Python, salah satu cara tuntuk membuat <em>project environment </em>adalah dengan menggunakan <em>Anaconda Environment</em> ataupun <em>venv</em>. Di sini, saya belajar tentang <strong>Docker</strong> dan bagaimana mengkonfigurasi semua <em>requirements</em> yang diperlukan dalam sebuah <em>Docker Container</em>. Mulai dari konfigurasi awal seperti instalasi, konfigurasi Caffe dan Protobuf dalam <em>Docker Container </em>melalui <em>Dockerfile</em>, dan <em>Dockerfile </em>lainnya dengan spesifikasi <em>requirements</em> dan <em>library</em> tertentu yang dibutuhkan <em>project </em>kita. <em>Awesome, right?</em> Dari saat itu, sampai saat ini, saya mulai menggunakan Docker untuk kebanyakan <em>project</em> saya, terutama untuk tesis nanti.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jhL4hSfOYBdZJpQTZ_pgQA.png" /><figcaption>Caffe in Docker</figcaption></figure><p>Karena <em>background </em>saya yang lebih ke matematik dan sedikit bersentuhan dengan <em>computer science</em>, memang ada sedikit kesulitan dalam membiasakan diri dengan Docker, seperti mencari <em>dependencies</em>, cara kerja <em>Dockerfile</em>, <em>compatibility </em>antar <em>dependencies</em>, dan sebagainya. Tapi ini semua memang proses yang harus dilalui, karena mungkin seperti inilah yang akan saya lakukan nanti ketika bekerja. <em>80% of our time is not to do our exact work, instead we try to configure it so that it can works in any platform as company real products or features.</em></p><h3>The Internship</h3><p>Setelah minggu pertama, saya mendapat tugas untuk membantu salah seorang AI Research Scientist di Nodeflux, <a href="https://www.linkedin.com/in/indrango/">Indra</a>, untuk melakukan riset tentang <em>Anomaly Detection</em> pada <em>Surveillance Videos and here’s the truth</em>.</p><h4>My Deep Learning skills is still at its foundation</h4><p>Ada sedikit rasa khawatir sebenarnya. Baru sekitar setahun saya mempelajari Machine Learning, tapi saya harus sudah berkutat dengan Deep Learning. <em>Like something is still missing in the beginning</em>. Dengan pengalaman yang masih minim ini, saya sudah harus mengaplikasikan dalam riset <em>Anomaly Detection</em>. Jadinya, saya harus belajar 2 kali lebih banyak, belajar tentang <em>Anomaly Detection</em> sambil belajar ulang teori-teori <em>Deep Learning</em>, terutama <em>Computer Vision dan </em>CNN.</p><blockquote><strong><em>But, it turns out that this is the most exciting time to be proud of</em>.</strong></blockquote><p>Saya memang sangat senang belajar, membaca hal-hal baru, mengkoneksikan dengan hal-hal yang sudah dipelajari sebelumnya, lalu membuat generalisasi.</p><p>Mulai dari membaca <em>paper </em>tentang <strong>C3D</strong>, bagaimana ia berbeda dengan CNN 2D, arsitektur seperti apa yang digunakan untuk mengekstrak fitur generik dari sebuah video, sampai bagaimana hasil yang didapat dibandingkan dengan model lain yang telah dikembangkan. <em>Paper</em> yang dimaksud adalah “<a href="https://research.fb.com/c3d-generic-features-for-video-analysis/"><em>C3D: Generic Features for Video Analysis</em></a>” dan “<a href="https://arxiv.org/abs/1412.0767"><em>Learning Spatiotemporal Features with 3D Convolutional Networks</em></a>”. Meski pemahaman yang saya dapat tidak terlalu dalam karena faktor “<em>something is still missing</em>” itu tadi, paling tidak saya mendapatkan benang merah apa dan bagaimana C3D berbeda dengan model lain.</p><p>C3D merupakan model yang digunakan dalam <em>paper</em> <a href="http://crcv.ucf.edu/cchen/"><strong><em>Anomaly Detection on Surveillance Videos</em></strong></a>. Jadi, selama minggu ke-2 sampai minggu terakhir, saya sebenarnya berkutat dan mencoba memahami topik ini melalui <em>paper </em>tersebut serta <a href="https://github.com/WaqasSultani/AnomalyDetectionCVPR2018"><em>GitHub Repo</em>-nya</a>, terutama <em>Matlab script</em> untuk mengkonversi hasil ekstraksi fitur C3D menjadi 32 <em>segments </em>sesuai <em>workflow</em> dalam <em>paper</em>, lalu mengkonversi <em>script</em> tersebut ke dalam versi <em>Python</em>.</p><h4>My favorite one</h4><p>Mungkin ini adalah bagian favorit saya selama <em>internship</em> 2 bulan di Nodeflux. Bagian di mana saya bisa saling bertukar pikiran dengan <em>AI Research Scientist</em> Nodeflux, berbagi ide, mengalami masalah yang serupa, sampai menemukan solusinya. Romantis. Bukan, bukan itu maksudnya. Ada saat di mana hasil yang didapat tidak sesuai dengan apa yang dicontohkan dalam <em>repository</em>, kami pun cemas. Tapi ternyata, alasannya cukup sederhana, yaitu karena dalam <em>Matlab script</em> pola pemanggilan <em>file</em> yang digunakan berbeda dengan pemanggilan <em>file</em> dalam <em>Python</em>. Dalam <em>Python</em>, <em>file </em>dipanggil secara acak, sedangkan <em>Matlab </em>terurut sesuai abjad. Pastinya ini menghasilkan konversi yang berbeda.</p><p>Selain itu, dari pengalaman ini juga saya belajar satu hal yang tidak pernah diajarkan selama kuliah, membaca <em>code</em> orang lain. Bahkan tidak masuk kurikulum. Padahal, dari sini saya belajar untuk menganalisis logika dari <em>script </em>yang ditulis orang lain, sehingga kemudian dapat diadaptasi sesuai kebutuhan.</p><h3>Lesson to Learn</h3><p>Dari 2 bulan magang sebagai AI Engineer di Nodeflux, ini adalah <em>the real internship</em> jika dibandingkan dengan pengalaman magang pertama saya. Ya, memang <em>internship</em> pertama saya dilatarbelakangi untuk memenuhi mata kuliah wajib saja saat itu. Jadi, ini memang <em>internship </em>yang lebih baik dari sebelumnya.</p><p>Dari 8 minggu magang ini juga saya belajar banyak terutama dalam bidang AI dan Deep Learning. Tidak hanya itu, dari 2 bulan magang ini juga saya mendapat pengalaman tambahan bahwa meskipun kita tertarik dan fokus pada bidang AI atau Deep Learning, apapun <em>title</em> kita (<em>Data Science, Machine Learning/Deep Learning Engineer</em>), sebenarnya hampir 80% pekerjaan kita bukanlah pada bidang itu. Tetapi bagaimana caranya agar hasil “kerjaan” kita dapat digunakan dalam produk <em>company </em>tersebut dan siap untuk digunakan oleh <em>partner</em> ataupun <em>user</em>.</p><p>Dari 40 hari ataupun kurang ini, <em>the most important lesson to learn, for me,</em> <em>is how to do practical research</em>. Mungkin ini hanya istilah yang saya pakai atau memang benar ada sebutan “<em>Practical Research</em>”. Bagi saya, <em>practical research</em> adalah riset yang tujuan utamanya adalah lebih pada produk yang akan di-<em>deliver</em>. Umumnya, bagi akademisi, riset-riset dilakukan karena untuk keperluan jurnal atau kepentingan akademik lainnya. Tapi <em>practical research</em> dilakukan memiliki tujuan akhir yang siap pakai, dalam bentuk dan <em>platform</em> apapun, <em>with agile and fast workflows</em>, <em>and full of repetition</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uV90Bm5wpdisWVtON3dEXQ.jpeg" /><figcaption>“I’ll be back” — Arnold Schwarzenegger</figcaption></figure><blockquote>One day, I hope I can return to this company as a “real” AI Research Scientist and together with people in it deliver impactful values and goodness through AI</blockquote><p><em>Thank you so much for the opportunity to be part of the family and for the unforgettable memories.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d07aa43252a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>