<?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 Abdullah Al Imran on Medium]]></title>
        <description><![CDATA[Stories by Abdullah Al Imran on Medium]]></description>
        <link>https://medium.com/@abdalimran?source=rss-7298f2730ff2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b1jm6RguHI_jiqhVEvZRkA.png</url>
            <title>Stories by Abdullah Al Imran on Medium</title>
            <link>https://medium.com/@abdalimran?source=rss-7298f2730ff2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 25 Jun 2026 01:57:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abdalimran/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[গ্রেডিয়েন্ট ডিসেন্ট নিয়ে বোঝাপরা]]></title>
            <link>https://abdalimran.medium.com/%E0%A6%97%E0%A7%8D%E0%A6%B0%E0%A7%87%E0%A6%A1%E0%A6%BF%E0%A7%9F%E0%A7%87%E0%A6%A8%E0%A7%8D%E0%A6%9F-%E0%A6%A1%E0%A6%BF%E0%A6%B8%E0%A7%87%E0%A6%A8%E0%A7%8D%E0%A6%9F-%E0%A6%A8%E0%A6%BF%E0%A7%9F%E0%A7%87-%E0%A6%AC%E0%A7%8B%E0%A6%9D%E0%A6%BE%E0%A6%AA%E0%A6%B0%E0%A6%BE-71a6a296cef1?source=rss-7298f2730ff2------2</link>
            <guid isPermaLink="false">https://medium.com/p/71a6a296cef1</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[মেশিন-লার্নিং]]></category>
            <category><![CDATA[পাইথন]]></category>
            <category><![CDATA[গ্রেডিয়েন্ট-ডিসেন্ট]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <dc:creator><![CDATA[Abdullah Al Imran]]></dc:creator>
            <pubDate>Wed, 16 May 2018 15:54:13 GMT</pubDate>
            <atom:updated>2018-05-17T04:09:27.909Z</atom:updated>
            <content:encoded><![CDATA[<p>মেশিন লার্নিং নিয়ে যারা কাজ করেন কিংবা শিখছেন তারা অবশ্যই গ্রেডিয়েন্ট ডিসেন্ট ব্যবহার বা এর নাম শুনে থাকবেন। মেশিন লার্নিং এ অন্যতম চ্যালেঞ্জিং পার্ট হল &quot;অপটিমাইজেশন&quot;। আর গ্রেডিয়েন্ট ডিসেন্ট হল মেশিন লার্নিং এ বহুল ব্যবহৃত একটি অপটিমাইজেশন অ্যালগোরিদম। লিনিয়ার রিগ্রেশন,লজিস্টিক রিগ্রেশন, সাপোর্ট ভেক্টর মেশিন, নিউরাল নেটওয়ার্ক সহ আরো অনেক পপুলার মেশিং লার্নিং অ্যালগোরিদমে অপটিমাইজেশনের জন্য গ্রেডিয়েন্ট ডিসেন্ট ব্যবহার করা হয়।</p><p>কিন্তু গ্রেডিয়েন্ট ডিসেন্ট নামটা শুনলেই আমাদের চোখে ভাসে নিচের মতো কিছু ঝাঝালো 3D সারফেস প্লটের ছবি।</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*9sd4Ve9DH-k4EcNba5fGTA.jpeg" /></figure><p>কি ভয়ংকর দেখতে! সাথে আছে এর বিদঘুটে ম্যাথম্যাটিক্যাল ফর্মুলা!</p><p>কিন্তু, জিনসটা দেখতে যতোটাই ভয়ংকর, আসলে ততোটাই সহজ, মজার এবং প্র্যাক্টিক্যাল।</p><p>চলুন প্রথমেই আমরা এই ঝাঝালো প্লটের ছবি ও গ্রেডিয়েন্ট ডিসেন্ট নিয়ে যতো ভয়ানক অভিজ্ঞতা আছে সব ভুলে যাই। আবার নতুন করে শুরু করি চলুন -</p><h3><strong>সাধারণ ও বাস্তব ধারণাঃ</strong></h3><p>ধরুন, আমরা একটি পুকুরের (গ্রীষ্মের কড়া রোদে পানি শুকিয়ে যাওয়া পুকুর) পাড় থেকে একটি ফুটবল ছেড়ে দিলাম। ঠিক নিচের ছবিটির মত। এখন ঘটনাটা কি ঘটবে?</p><p>যেহেতু আমরা জানি যে পৃথিবীতে অভিকর্ষজ ত্বরণ কাজ করে তাই বলটি গড়িয়ে গড়িয়ে পুকুরের ঢালু জায়গার দিকে যেতে থাকবে। যখন পুকুরের সবচেয়ে গভীরে / ঢালু জায়গাটিতে পৌঁছে যাবে তখন বলটি স্থির হয়ে যাবে।</p><p>বিষয়টিকে আমরা এভাবেও বলতে পারি যে, বলটি পুকুরের সবচেয়ে মিনিমাম পয়েন্টে যেয়ে থামবে।</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vR_oR6zPZvrIney6Qk7QCA.gif" /></figure><p>এবার কিছু বাচ্চাকালের ম্যাথেমেটিকাল জিনিস দেখা যাক -</p><p>ধরুন, আমাদের একটি ফাংশন দেয়া হলো <strong><em>f(x) = x² + 5</em></strong>,</p><p>সাথে দেয়া হলো <strong><em>x</em></strong> এর কিছু ভ্যাল্যু, <strong><em>x =−6,−5,−4,−3,−2,−1,0,1,2,3,4,5,6</em></strong></p><p>এখন আমাদের কাজ হলো ফাংশনটার সবচেয়ে মিনিমাম ভ্যালুটা বের করা। অর্থাৎ, আমরা এমন একটি ভ্যালু বের করবো যে ভ্যালুটাকে যদি ফাংশনের <strong><em>x</em></strong> হিসেবে ইনপুট দেই তাহলে ফাংশনটা সবচেয়ে মিনিমাম ভ্যালু আউটপুট দিবে।</p><p>তাহলে এবার ফাংশনে <strong><em>x</em></strong> এর ভ্যাল্যু গুলো বসিয়ে দেখি আউটপুট হিসেবে কি ভ্যালু পাচ্ছি -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/207abb8ec8106bbe31beedda78c1c622/href">https://medium.com/media/207abb8ec8106bbe31beedda78c1c622/href</a></iframe><p>উপরের টেবিল দেখে আমরা সহজেই বুঝতে পারছি যে <strong><em>x</em></strong> এর ভ্যালু <strong><em>0</em></strong> এর জন্য আমরা ফাংশনের সবচেয়ে মিনিমাম ভ্যালু <strong><em>5</em></strong> পাচ্ছি।</p><p>এই জিনিসটুকুকে আমরা পাইথন কোডে নিচের মতো করে লিখতে পারি -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e54513cca2e329474891216b15d2f84/href">https://medium.com/media/5e54513cca2e329474891216b15d2f84/href</a></iframe><pre><strong>Output:</strong><br>[-6 -5 -4 -3 -2 -1  0  1  2  3  4  5  6]<br>[41 30 21 14  9  6  5  6  9 14 21 30 41]</pre><p>এবার চলুন দেখা যাক ভ্যালু গুলোকে গ্রাফে রিপ্রেজেন্ট করলে কেমন দেখায় -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hDtFLWn3ZFu7dcjNiPgXYw.jpeg" /></figure><p>গ্রাফ থেকেও দেখা যাচ্ছে যে <strong><em>x=0</em></strong> এর জন্য আমরা ফাংশনের সবচেয়ে মিনিমাম ভ্যালু <strong><em>y=5</em></strong> পাচ্ছি।</p><p>চমৎকার বিষয়টি হলো আমাদের ফাংশনের গ্রাফটি উপরে পুকুরের ছবিটির সাথে মিলে গেছে। এবার শেখা আরো সহজ হয়ে গেলো।</p><p>এবার আমরা যদি গ্রাফের উপরের কোন একটা পয়েন্টে ফুটবলটা রাখি, তাহলে কি ঘটনা ঘটবে?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*rIAgnyzvvBLyu87_R8ZzSA.png" /></figure><p>কিছুই ঘটবে না!! বলটা যেখানে রাখা হয়েছ সেখানেই থাকবে। কেননা পৃথিবীতে অভিকর্ষজ ত্বরণ কাজ করে তাই পুকুরের পাড় থেকে বলটি গড়িয়ে ঢালু দিকে নামছিলো কিন্তু আমাদের গ্রাফেতো আর অভিকর্ষজ ত্বরণ কাজ করে না।</p><p>তাহলে আমরা কিভাবে বলটাকে গ্রাফের মিনিমাম পয়েন্টে নিয়ে যেতে পারি? এক্ষেত্রে আমাদের ২ টা জিনিস জানা লাগবে -</p><ul><li>গ্রাফের ঢাল কোন দিকে (এই জিনিসটা আমরা জানতে পারবো গ্রেডিয়েন্ট থেকে)</li><li>কতো ইউনিট করে আগাতে হবে (এটা আমরা নিজেরা ঠিক করে নিতে পারবো)</li></ul><p>এবার চলুন গ্রেডিয়েন্ট ডিসেন্ট সম্পর্কে কিছু জেনে নেই। দেখি ইহা খায় না মাথায় দেয়।</p><h3><strong>গ্রেডিয়েন্ট ডিসেন্ট</strong></h3><p>গ্রেডিয়েন্ট ডিসেন্ট হলো একটি ফার্স্ট অর্ডার আইটেরেটিভ অপ্টিমাইজেশন অ্যালগোরিদম যা কোন একটা ফাংশনের মিনিমাম ভ্যালু খুজে বের করে দেয়।</p><p>ফার্স্ট অর্ডার, আইটেরেটিভ এগুলো কি তা একটু পরেই বুঝবো। গ্রেডিয়েন্ট ডিসেন্টে ব্যবহৃত ফর্মুলাঃ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*HLvtt3d7M3lqw4gx5y_wXw.jpeg" /></figure><p>এই ফর্মুলাই আমাদের বলে দিবে বলটি যেখানে আছে সেখান থেকে কোন দিকে কতোটুকু করে আগাতে হবে।</p><p>এই ফর্মুলাকে অনেক জায়গায় ভিন্ন নোটেশনেও লেখা হয়। যেমনঃ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*NA0u850BYI6K3zQToSYBKQ.jpeg" /></figure><p>এবার ফর্মুলার নোটেশন গুলোর অর্থ বুঝে নেইঃ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*ZDGS9Fzkcm5cPdhcVK3GCQ.png" /></figure><p><strong><em>γ</em></strong> (লার্নিং রেট) তো আমরা নিজেরা সেট করে দিতে পারবো কিন্তু আমাদের মাথা ব্যাথা হলো কিভাবে <strong><em>x</em></strong> এর জন্য <strong><em>F</em></strong> ফাংশনের গ্রেডিয়েন্ট বের করবো, অর্থাৎ কিভাবে <strong>∇F(Xn) </strong>বের করবো।</p><p><strong>ফাংশনের গ্রেডিয়েন্ট বের করার নিয়মঃ</strong></p><p>কোন একটা ভেরিয়েবলের জন্য কোন ফাংশনের গ্রেডিয়েন্ট হলো সেই ভেরিয়েবলের সাপেক্ষে ফাংশনটিকে একবার ডিফারেনশিয়েট করলে যা পাওয়া যায় তা।</p><p>অর্থাৎ, <strong><em>x</em></strong> এর জন্য <strong><em>F</em></strong> এর গ্রেডিয়েন্ট হবে <strong><em>x</em></strong> এর সাপেক্ষে <strong><em>F</em></strong> কে একবার ডিফারেনশিয়েট করলে যা পাবো তা।</p><p>ফাংশনটাকে একবার ডিফারেনশিয়েট করলে যা পাবো সেটাকে ওই ফাংশনের ফার্স্ট অর্ডার ডেরিভেটিভ বলে।</p><p>তাহলে চলুন দেখি আমরা <strong><em>x </em></strong>এর জন্য <strong>f(x) = x² + 5</strong> ফাংশনটার গ্রেডিয়েন্ট বের করে ফেলি।</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*UsAfoS7t34tn8H9_CjhhtQ.jpeg" /></figure><p>আমরা যদি ক্যালকুলাস ভুলে যাই তাহলেও কোন ব্যাপার না। পাইথনের <strong><em>sympy</em></strong> প্যাকেজ দিয়ে আমরা কোন একটা ফাংশনের ডেরিভেটিভ বের করতে পারবো।</p><p>যেমনঃ নিচে দেয়া পাইথন কোডে আমাদের ফাংশনটার ডেরিভেটিভ বের করে দেখানো হয়েছে।</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c444b875421c6cd8fdcc37f1726d99d2/href">https://medium.com/media/c444b875421c6cd8fdcc37f1726d99d2/href</a></iframe><pre><strong>Output:</strong><br>2*x</pre><p>প্রশ্ন হতে পারে যে আমরা এখানে কেনো ফার্স্ট অর্ডার ডেরিভেটিভ নিলাম, ২/৩ বার ডিফারেনশিয়েট করে নেয়া যেতো না?</p><p>ফার্স্ট অর্ডার ডেরিভেটিভ নেয়ার কারন হলোঃ</p><ul><li>একটা ফাংশনের ডিরেকশন কোন দিকে, ফাংশনটি ইনক্রিজিং না ডিক্রিজিং সেটা ওই ফাংশনের ফার্স্ট অর্ডার ডেরিভেটিভ থেকে জানা যায়। (এটাই আমার দরকার)</li><li>ফার্স্ট অর্ডার ডেরিভেটিভ দিয়ে ফাংশনের ঢালও প্রকাশ পায়</li></ul><p>গ্রেডিয়েন্ট এবং ফার্স্ট অর্ডার ডেরিভেটিভ বুঝে থাকলে এবার আসি গ্রেডিয়েন্ট ডিসেন্টকে আইটেরেটিভ কেনো বলা হয়। গ্রেডিয়েন্ট ডিসেন্টের যে ফর্মুলাটা আমরা উপরে দেখলাম সেটি আমাদের পরবর্তী এক স্টেপের জন্য কোন দিকে কতটুকু করে আগাবো তা বলে দেয়। কিন্তু আমাদের তো শুধু এক স্টেপ আগালেই হবে না। আমাদের ততোক্ষণ পর্যন্ত আগাতে হবে যতক্ষণ না আমরা সবচেয়ে মিনিমাম পয়েন্টে পৌছে যাই। তাই আমাদের এই প্রসেসটা একটা লুপের মাধ্যমে নির্দিষ্ট সংখ্যক বার চালাতে হবে।</p><p>তাহলে এবার আমরা গ্রেডিয়েন্ট ডিসেন্ট অ্যালগোরিদমটাকে আরেকটু সুন্দর করে গুছিয়ে লিখি -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*mz1bCzoO0hqV7gy_eCdpCg.jpeg" /></figure><p>এখন গ্রেডিয়েন্ট ডিসেন্টের কোড করার জন্য আমাদের যা যা জানা দরকার সব আমরা জেনে ফেলেছি। এবার ঝটপট কোড লিখে ফেলি চলুন -</p><ul><li>আমরা লার্নিং রেট <strong><em>γ (gamma)</em></strong> এর মান ধরবো <strong><em>0.001</em></strong>। আমরা যদি লার্নিং রেটের মান খুব বেশি ধরি তাহলে প্রতি আইটেরেশনে আমরা বেশি ইউনিট করে এগিয়ে যেতে পারি, ফলে আমাদের মিনিমাম পয়েন্টকে ক্রস করে যাওার একটা সম্ভাবনা থাকবে। তাই আমরা লার্নিং রেট হিসেবে <strong>0.001</strong> ধরলাম।</li><li>এবার আমাদের কোন একটা ভ্যলু সেট করতে হবে যেখান থেকে আমরা স্টার্ট করবো। তাই <strong><em>x</em></strong> এর ইনিশিয়াল ভ্যালু <strong><em>6</em></strong> ধরে নিলাম।</li><li>এবার কতগুলো আইটেরেশন চালাবো সেটা ঠিক করতে হবে। আমরা <strong><em>5000</em></strong> বার চালিয়ে দেখবো।</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af1457a502b7ea55238c483241b28f65/href">https://medium.com/media/af1457a502b7ea55238c483241b28f65/href</a></iframe><p>দেখা যাচ্ছে লুপ <strong><em>5000</em></strong> বার চালালেই আমরা <strong><em>x</em></strong> এর ভ্যালু <strong><em>0.00026968555624761565</em></strong> পেয়ে যাচ্ছি যেটা <strong><em>0</em></strong> এর খুবি কাছাকাছি। এটাকে ইন্টিজারে নিলে আসলে আমরা <strong><em>0</em></strong> ই পাবো। তাহলে পেয়ে গেলাম আমাদের কাংক্ষিত <strong><em>x</em></strong> এর মিনিমাম ভ্যালু যার জন্য আমাদের ফাংশনটি সবচেয়ে মিনিমাম আউটপুট <strong><em>5</em></strong> দিবে।</p><p>এবার আমরা গ্রাফে তাকালে দেখবো বলটি ঢালু দিকে গড়িয়ে আগাতে আগাতে মিনিমাম পয়েন্ট <strong><em>0</em></strong> তে গিয়ে পৌছাচ্ছে।</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pmFcmUAjtvRH8_rEDxaDeA.gif" /></figure><p>তো এই হলো গ্রেডিয়েন্ট ডিসেন্টে!!</p><p>এই লেখাটিতে আমার উদ্দেশ্য ছিলো গ্রেডিয়েন্ট ডিসেন্টের খুবি ব্যাসিক ধারনা দেয়া। তাই আমি ম্যাথেমেটিক্যাল বিষয়গুলো নিয়ে খুব বেশি গভীরে যাইনি।</p><p>বোঝার সুবিধার জন্য আমি এখানে খুবি সিম্পল একটি ফাংশন নিয়েছি এবং শুধুমাত্র একটি প্যারামিটার নিয়ে কাজ করেছি। কিন্তু গ্রেডিয়েন্ট ডিসেন্টের আসল অ্যাডভান্টেজ অনুভব করা যাবে যখন আমরা মাল্টিপল প্যারামিটারের জন্য কাজ করবো। পরবর্তী লেখাতে আমরা দেখবো কিভাবে লিনিয়ার রিগ্রেশনের ইরর / কস্ট মিনিমাইজ করতে গ্রেডিয়েন্ট ডিসেন্ট ব্যবহার হয়। সেখানে আমরা মাল্টিপল প্যারামিটার নিয়ে কাজ করবো।</p><p>সেই পর্যন্ত আপনারা যতটুকু শিখলেন তা ব্যবহার করে আরো ভিন্ন কিছু ফাংশন নিয়ে কাজ করে দেখুন।</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71a6a296cef1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intuition of Gradient Descent for Machine Learning]]></title>
            <link>https://abdalimran.medium.com/intuition-of-gradient-descent-for-machine-learning-49e1b6b89c8b?source=rss-7298f2730ff2------2</link>
            <guid isPermaLink="false">https://medium.com/p/49e1b6b89c8b</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Abdullah Al Imran]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 17:27:29 GMT</pubDate>
            <atom:updated>2018-07-12T04:14:41.601Z</atom:updated>
            <content:encoded><![CDATA[<p>The most challenging part of Machine Learning is “<strong>optimization</strong>”. Gradient Descent is one of the most popular optimization algorithms used in Machine Learning. There are many powerful ML algorithms that use gradient descent such as linear regression, logistic regression, support vector machine (SVM) and neural networks.</p><p>Many of us are already familiar with Gradient Descent but have bitter experience in understanding it. When we think about gradient descent, we remember the terrible mathematical formula and see some horrible pictures of the 3D surface plot in our eyes like the following -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*9sd4Ve9DH-k4EcNba5fGTA.jpeg" /></figure><p>How terrifying the picture is as well as it’s formulas! But, it is actually not like how it looks. It is very easy, interesting and very practical concept.</p><p>So, let’s forget the terrifying plots, formulas and the bitter experiences and make a new start.</p><h3><strong>Some Basic Real-World Concept:</strong></h3><p>Let’s say, we put a ball on the upper edge of a pond and give a little push on it, just like the following picture. Now, what will happen?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vR_oR6zPZvrIney6Qk7QCA.gif" /></figure><p>As we know, there is a gravitational force on earth, so the ball will roll towards the lower region of the pond. It’ll keep rolling until it reaches the lowest point of the pond. In other words, we can say that the ball will stop when it reaches the minimum point of the pond.</p><p>Now, let’s discuss some childhood mathematical concepts.</p><p>Let, we have a function, <strong>f(x) = x² + 5</strong> and we also have some values of <strong>x</strong>. <br><strong>x =−6,−5,−4,−3,−2,−1,0,1,2,3,4,5,6</strong></p><p>Now, our task is to find the minimum value of the function. That means, we need to find such an input value for the <strong>x </strong>for which we’ll get the <strong>minimum </strong>output value from <strong>y</strong>.</p><p>Now, let’s put all the given values of x into the function and see the output values of y.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/207abb8ec8106bbe31beedda78c1c622/href">https://medium.com/media/207abb8ec8106bbe31beedda78c1c622/href</a></iframe><p>From the table, we can see that when we put <strong>0 </strong>in x, we are getting the minimum value <strong>5 </strong>from y.</p><p>We can write the above function and generate it’s output in Python code as below –</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e54513cca2e329474891216b15d2f84/href">https://medium.com/media/5e54513cca2e329474891216b15d2f84/href</a></iframe><pre><strong>Output:</strong><br>[-6 -5 -4 -3 -2 -1  0  1  2  3  4  5  6]<br>[41 30 21 14  9  6  5  6  9 14 21 30 41]</pre><p>Now let’s see, for the given values how the function looks like in graphical representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hpameoAFZF8FbQbGh1DSdQ.jpeg" /></figure><p>The most interesting fact here is, the plot looks same as the picture of the pond we’ve used above.</p><p>That’s great! Our learning has become much easier. 🤘</p><p>Now, if we put a ball on the upper edge of the plot and give a little push on it, as we done before in the pond picture. What will happen?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*rIAgnyzvvBLyu87_R8ZzSA.png" /></figure><p>Nothing will happen. Because the gravitational force works on earth, not on our plot. The ball will remain in the same position where it was put before. Then, how can we take the ball to the minimum point of the graph?</p><p>To do this, we need to know 2 things-</p><p>👉 The direction of the slope (We can know this from the gradient.)</p><p>👉 By how many units we need to roll. (We can set this value by our own.)</p><p>Now, it’s time to know about the Gradient Descent. Let’s see how can it help us.</p><h3><strong>Gradient Descent:</strong></h3><p>Gradient Descent is a first order iterative optimization algorithm that finds the minimum value of a function.</p><p>We’ll know what it means by “first order” and “iterative” later.</p><p><strong>The formula used in Gradient Descent:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*rmLrqGp9BnUqsS0Ye-1WWg.jpeg" /></figure><p>The formula will tell us the next position of the ball. It’ll tell us the direction of the downward slope with the number of units to roll.<br>You’ll find this formula written with different notation as follows –</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*iCmDi06j9E33SnT9sSkkdg.jpeg" /></figure><p>Now, let’s learn the meaning of the notations used in the formula-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*0xflNgjX3c9_m-s7H59lQQ.jpeg" /></figure><p>As we told before, we can set the value of <strong>γ</strong> (Learning rate) and we can also set the current position of <strong>x</strong>. The thing we need to think about is how to find <strong>∇F(Xn)</strong>.</p><h3>Finding the gradient of a function:</h3><p><em>If we want to find the gradient of a function for a point x, we need to differentiate the function for once with respect to x.</em></p><p>The result we’ll get by differentiating the function once is called the first order derivative of that function.</p><p>So, let’s differentiate our function <strong>f(x) = x² + 5</strong> and see what we get-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*kgfW0VEuKs1Ip8nf83eL5w.jpeg" /></figure><p>If we’ve forgotten calculus, nothing to worry. The <strong><em>sympy </em></strong>package of Python can find the derivative of a function for us.</p><p>In the following python code, the <strong><em>sympy </em></strong>package will find the derivative for our function <strong>f(x) = x² + 5</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c444b875421c6cd8fdcc37f1726d99d2/href">https://medium.com/media/c444b875421c6cd8fdcc37f1726d99d2/href</a></iframe><pre><strong>Output:</strong><br>2*x</pre><p>You can ask, why do we need to take the first derivate?</p><p><strong>Reasons to take the first derivative:</strong></p><p>👉<strong> </strong>The first derivative tells us the direction of the function, whether the function is increasing or decreasing.</p><p>👉<strong> </strong>The first derivative also tells us about the slope of the function.</p><p>Now, let’s understand why we call the gradient descent algorithm iterative. The formula for gradient descent we discussed above tells us the direction and number of units to roll for the next position. But we can’t reach the minimum point by rolling the ball once. We need to roll the ball for a certain number of times. We need to repeat the process until we achieve the convergence. That’s why we need to use a loop to repeat the process.</p><p>Let’s write the formula of the algorithm in a bit more nice way-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*ZFblZ4YEPZbC_lg1Umsl9w.jpeg" /></figure><p>Finally, we’ve known all the concepts that we need to write the code for gradient descent.</p><p>Let’s code the gradient descent quickly-</p><p>👉 We’ll set <strong>0.001</strong> as the value of <strong>γ </strong>(gamma). If we set the value of learning rate larger, there is a chance to overtake the minimum point. That’s why we’ll take a good value for <strong>γ </strong>which is <strong>0.001</strong>.</p><p>👉 Now, we need to set our starting point. That means we need to set an initial value for <strong>x</strong>, from where we’ll start rolling the ball. <br>We’ll set the initial point <strong>x = 6</strong>.</p><p>👉 Finally, we need to set the number of iterations for the repeating process. We’ll set it to <strong>5000</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af1457a502b7ea55238c483241b28f65/href">https://medium.com/media/af1457a502b7ea55238c483241b28f65/href</a></iframe><pre><strong>Output:</strong><br>iterations = 5000 <br>x =  0.00026968555624761565</pre><p>Here we see that after <strong>5000 </strong>iterations we get a value of <strong>0.00026968555624761565</strong> for x which is very close to <strong>0</strong>. Actually, if we convert it to an integer, it’ll turn into <strong>0</strong>. So, we’ve got out expected minimum value <strong>0 </strong>for <strong>x </strong>which will cause the function output the minimum value 5<strong>.</strong></p><p>Now if we look at the plot, we’ll see the ball is rolling down and reaches the minimum point of the plot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pmFcmUAjtvRH8_rEDxaDeA.gif" /></figure><p>This is the intuition behind the gradient descent algorithm.</p><p>In this article, I’ve used a simple function with one parameter. But to feel the real advantage of gradient descent, we need to work with multiple parameterized<strong> </strong>function. In the next article, I’ll show how can we use gradient descent to minimize the error of Linear Regression. There we’ll work with multiple parameters.</p><p>Till then practice what you’ve learned from this article. 😀</p><p><strong>** Constructive criticism will be appreciated.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49e1b6b89c8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s the best way to learn algorithms for programmers?]]></title>
            <link>https://abdalimran.medium.com/whats-the-best-way-to-learn-algorithms-for-programmers-fc4df4075135?source=rss-7298f2730ff2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc4df4075135</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Abdullah Al Imran]]></dc:creator>
            <pubDate>Mon, 21 Nov 2016 08:19:48 GMT</pubDate>
            <atom:updated>2017-01-18T12:58:33.449Z</atom:updated>
            <content:encoded><![CDATA[<p>Once I was asked this question on <a href="https://www.quora.com/Whats-the-best-way-to-learn-algorithms-for-programmers">Quora</a>. My answer got 17.7k Views and many upvotes. The person who asked the question needed some specific learning path &amp; resources. When I was used to do competitive programming and learn algorithms, I followed some steps to learn algorithms. Those steps were best fit for me. May be those steps can be helpful for you also. So, here I am sharing my learning steps -</p><p>Reading a book is very essential because every topic is described in detail into a book, but in videos/tutorials everything is described in short.</p><p><strong>For books</strong> I will recommend — <br>1: <a href="http://www.amazon.com/Introduction-Algorithms-Second-Edition-Thomas/dp/0262032937">Introduction to Algorithms: Charles E. Leiserson, Clifford Stein, Ronald Rivest, and Thomas H. Cormen </a><br>2: <a href="http://www.amazon.com/Algorithms-4th-Edition-Robert-Sedgewick/dp/032157351X">Algorithms (4th Edition): Robert Sedgewick, Kevin Wayne</a><br>3: <a href="https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena/dp/1848000693">The Algorithm Design Manual: Steven Skiena</a></p><p><strong>Some online resources:</strong><br><a href="https://www.topcoder.com/community/data-science/data-science-tutorials/">Data Science Tutorials</a><br><a href="http://www.geeksforgeeks.org/fundamentals-of-algorithms/">Algorithms — GeeksforGeeks</a></p><p><strong>Resources to practice:</strong><br>1:<a href="http://%20http://lightoj.com/volume_problemcategory.php"> http://lightoj.com/volume_problemcategory.php</a><br>2:<a href="http://www.comp.nus.edu.sg/%7Estevenha/methodstosolve.html"> World of Seven — Methods to Solve</a><br>3: <a href="http://a2oj.com/Categories.jsp">A2 Online Judge</a><br>4: <a href="https://www.hackerrank.com/domains">HackerRank</a><br>5: <a href="http://codeforces.com/problemset">CodeForces</a></p><p><strong>Now come to the steps:</strong><br>I follow “<strong>Learning by doing</strong>” philosophy.</p><p><strong>Step 1:</strong> At first you should learn the theory of any particular algorithm from your books/resources.</p><p><strong>Step 2:</strong> Try to implement the algorithm(theory) you’ve learnt into code without looking at others implementation. After much trying if you can’t implement then take help of others.</p><p><strong>Step 3:</strong> Now pick up a link from <strong>Resources to practice</strong> and solve some problems related to the algorithm you’ve learned recently.</p><p>To me this my best way to learn algorithms.</p><p>Best of luck. :)</p><p>This article was also posted in <a href="https://abdalimran.github.io/algorithms/what-s-the-best-way-to-learn-algorithms-for-programmers">my personal blog</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc4df4075135" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart World through the eyes of “The Internet of Things (IoT)”]]></title>
            <link>https://abdalimran.medium.com/smart-world-through-the-eyes-of-the-internet-of-things-iot-60d89b933df8?source=rss-7298f2730ff2------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d89b933df8</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Abdullah Al Imran]]></dc:creator>
            <pubDate>Sat, 16 Jul 2016 05:44:49 GMT</pubDate>
            <atom:updated>2016-07-29T20:15:41.939Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine a day when you come out in a hurry from your home, go to your office or market and you forget whether you’ve locked the door or not. You forget to switch off the lights of your room or to extinguish the oven. Now what will happen? Would you like to come back to your home? No! It’s not a smart idea in the world of IoT. Just take your smartphone out of your pocket, open an app and lock the door, switch off the lights and extinguish the oven. And obviously you can do the same from anywhere in the world. The IoT technology has made this amazing scenario possible in our daily life and that’s why the Internet of Things is a buzzword at the present.</p><p>Now let’s know what IoT actually is — “The Internet of Things (IoT) is a scenario in which objects, animals or people are provided with unique identifiers and the ability to transfer data over a network without requiring human-to-human or human-to-computer interaction. IoT has evolved from the convergence of wireless technologies, micro-electromechanical systems (MEMS) and the Internet.”</p><p>There was a time when we were used to use the internet only through the computer. But now we use internet in our mobile, smartphone or in many other smart devices. What if we can provide the connectivity of internet into every objects in our real world? This is the concept from where IoT was originated. It’s all about connecting the physical world to the internet and perform any action as we want.</p><p>Although the concept wasn’t named until 1999, the concept of a network of smart devices was discussed as early as 1982, with a modified Coke machine at Carnegie Mellon University becoming the first internet-connected appliance, able to report its inventory and whether newly loaded drinks were cold. Afterwards the term “Internet Of Things”/”IoT”was first proposed by Kevin Ashton in 1999.</p><p>Now let’s discuss how the IoT technology works. There are 4 basic steps that makes IoT working. These are shortly described below-</p><p><strong>1. Unique Identity of “Things” :</strong> Provide an unique identity to every “thing” that needs to be connected. It may be an IP address. However, due to the limited address space of IPv4 (which allows for 4.3 billion unique addresses), objects in the IoT will have to use IPv6 to accommodate the extremely large address space required.</p><p><strong>2. Ability to Communicate:</strong> Provide these “things” with the ability to share information. It should be the wireless internet, which is keeping the world connected.</p><p><strong>3. Senses:</strong> Provide these “things” with senses to gather information as required. These are the sensors which are getting smaller and cheaper day by day.</p><p><strong>4. End User Interface:</strong> An interface that allows us to share the information with these “things”. These may be mobile/smartphone app, TV-Monitor, Laptop etc.</p><p>Now let’s think of your chair. Consider your chair as a thing in the IoT. You want to know from anywhere in the world, is this chair occupied and who is sitting on the chair?<br> So, at first you will provide it an unique id (IPv6). You will use sensors like Pressure sensor which will measure the pressure upon the chair, RFID tag reader which will identify the person who is sitting on the chair. Then you will communicate with the chair with your smartphone and you will be known who is sitting on your chair. So, your chair will become a smart chair! Isn’t it amazing?</p><p>Let’s discuss about some sectors where IoT may play some amazing role in near future.</p><p><strong>1. Reality Search Engine:</strong> Will you find the expected result if you ask Google, “Where is my keys?”, “Where is my shoes” or “Where is my child whom did I lose yesterday in the market?” ? IoT may make it easy for you!</p><p><strong>2. e-Health:</strong> There will be available smart T-Shirts like “D-Shirt” which will record your heart rate, GPS location, route, speed and altitude. BodyGuardian, A wearable sensor system that can remotely read a patient’s biometrics (ECG, heart rate, respiration rate and activity Level) to keep people out of a hospital monitoring setting.</p><p>Here is an infographic of year 2040 in the eyes of IoT:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*M3odyN5tRgyPlGqmheojkg.png" /><figcaption>(The picture was taken from internet, all rights reserved to its owner.)</figcaption></figure><p>There are already some fascinating IoT products as Apple Watch, Philips Lighting, Smart TV, Refrigerators, Washing machine etc. There also exist a smart city named Songdo in South Korea, the world’s first smart city.</p><p>Security and privacy are major concerns in IoT — and addressing these concerns is a top priority. These are legitimate concerns. New technology often carries the potential for misuse and mischief, and it’s vital to address the problem before it hinders personal privacy and security, innovation or economic growth. Manufacturers, standards organizations and policy-makers are already responding on several levels.</p><p>Now, what do you think about the future of IoT?</p><p>The technologist assumes that by 2032 each person will be surrounded by 3000–5000 smart things in our everyday life. And the Tech experts also estimate that the IoT will consist of almost 50 billion objects and 25 billion devices by 2020.</p><p>So, let’s wait for the smart world of IoT.</p><p>This post was originally written into my personal blog.<br>Link: <a href="http://www.abdullahalimran.com/english/smart-world-through-the-eyes-of-the-internet-of-things-iot/">http://www.abdullahalimran.com/english/smart-world-through-the-eyes-of-the-internet-of-things-iot/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d89b933df8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>