<?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 Lazuardi Al-Muzaki on Medium]]></title>
        <description><![CDATA[Stories by Lazuardi Al-Muzaki on Medium]]></description>
        <link>https://medium.com/@lazuardy.almuzaki?source=rss-c80d742946c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-eKYbCbzvni8QnCuIqwWng.jpeg</url>
            <title>Stories by Lazuardi Al-Muzaki on Medium</title>
            <link>https://medium.com/@lazuardy.almuzaki?source=rss-c80d742946c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 16:26:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lazuardy.almuzaki/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[Why Zohran Mamdani’s recent official statement is one great decralation]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/why-zohran-mamdanis-recent-official-statement-is-one-great-decralation-6969bb237518?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6969bb237518</guid>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 05:46:21 GMT</pubDate>
            <atom:updated>2026-07-22T10:29:38.265Z</atom:updated>
            <content:encoded><![CDATA[<h4>And how Mamdani’s ‘Benjamin Netanyahu is a War Criminal’ might hold significant importance to our fights</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bxPRKWDJSpeza0kVwE5sXA.png" /></figure><p>Just around 5 hours ago, New York Mayor Zohran Mamdani just released a short but massive public statement via his administrative account into multiple platform about another stage of his stance towards Israel PM Benjamin Netanyahu.</p><p>He’s been doing that more or less, yes, however this one I took massive respect for I think it might be one of the greatest monologue which encapsulated so many and so thorough just within a short — which then enhance hugely its accessibility over greater audiences — video now airing in Instagram, You Tube and surely many more.</p><p>The title already is a big declaration: Benjamin Netanyahu is a war criminal. This alone just effectively put Mamdani’s unafraid attitude also that he is being absolutely clear about the Israel PM. It’s been long long time I hear about politician (especially from US which has been Israel ally) that able to speak so outspokenly, and not only outspoken, but with such enormous clarity. It’s not another politican whose sitting on fence, using cowardice words of ‘but’ or ‘despite’ as they reluctantly call out Israel.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8ZuV5L0QL04%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8ZuV5L0QL04&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8ZuV5L0QL04%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcde2ee42fe0c6d792814036c743364a/href">https://medium.com/media/fcde2ee42fe0c6d792814036c743364a/href</a></iframe><p>Let’s breakdown how his video is a strong demonstration on how officials all should properly address the situation. Let’s do it chronologically:</p><h4>1. It opens with a properly emphasized crimes of Netanyahu</h4><p>Mamdani knew exactly the PM impact directly or indirectly towards Palestine and Palestinian. He wrapped it from the suffering perspective of the victims and emphasize sufficiently what Netanyahu did which has resulted in effect into the misery of civilians particularly childrens. He said that Israel PM has been “<em>the architech of horrific genocide</em>”. Mamdani courageous selection of words makes it impossible to undermine what Israel has been doing.</p><p>In Mamdani words: <em>He is responsible for the killing of more than 73,000 people, for the maiming of tens of thousands of children as those who survive undergo amputation without anesthesia.</em></p><h4>2. It did not forget that America has got to do with the atrocities</h4><p>Mamdani, obviously position himself as representative of US Government, did not forget to put the blame, and not in just slight manner, towards America which has been funding directly the atrocities in Palestine.</p><h4>3. Perfectly put his intention and how it is legitimately backed up not only with morality but clear legal aspect.</h4><p>The video main idea is resounding and re-amplifying that Netanyahu still has an arrest warrant on him. it thus, perfectly put the subjectivity and bias towards his very action and attitude. It is clever since politicians are very easy to be accused of many things due to their action, and by stating this lucidly, he is not only ask us in being rational, but also lawful.</p><h4>4. The call to action: asking federal to perform further act</h4><p>This is what I love the most. He knew exactly that calling Netanyahu out is not enough. Condemning him only, does not effective (despite the fact that we collectively still unable to do it properly and consistently). He encourages a call to action. Clearly outlines that his position is not strong enough to proceed the potential arrest, he effectively invites the stakeholder to wake up and doing their job instead.</p><p>In Mamdani words: <em>It is clear that we do not have the independent legal authority to enforce this warrant. The federal government, however, does — and I call on them to join the ICC and execute this warrant.</em></p><h4>5. Close the speech while reminding us about our collective stance</h4><p>Mamdani wrap his 2-minutes video saying “<em>Benjamin Netanyahu is not welcome in New York City</em>”. This is a serious note. Again, no politician has been brave and this is the manner of the bravery we sought.</p><p>Mamdani extends the boundary of the speech subject into something that now accessible for all of us, asking the collective power of the people at the end of the video. In Mamdani words: <em>While we cannot end the genocide on our own, we can decide whether our silence will become another weapon, and we can examine every tool we have to defend the humanity and dignity of all people.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6969bb237518" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Year A Lecturer Reflection — To Teach is To Learn To Teach Better]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/a-year-a-lecturer-reflection-to-teach-is-to-learn-to-teach-better-dad77adba56b?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dad77adba56b</guid>
            <category><![CDATA[reflections]]></category>
            <category><![CDATA[teaching]]></category>
            <category><![CDATA[lecturer]]></category>
            <category><![CDATA[higher-education]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 07:45:25 GMT</pubDate>
            <atom:updated>2026-07-19T13:53:33.365Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dZmvjO-dll-umN7xvG-0Og.jpeg" /></figure><h3>Contemplating a profession full of profound humility</h3><p>Yes, to teach is to learn to teach better; that is something I believe, something I am persistent about, and it has served me well as this mantra has indeed proven true in the case my own experience. One year and a few months in, I find that being a lecturer is the most enjoyable, and it actually makes the most sense as I ground myself in the most basic necessity of human beings: building upon a state where they can feel their life is meaningful; and to me, that is because they allow themselves to keep learning.</p><p>And “learning” is an understatement. I find that learning must be epitomized through teaching what we learn. Why? Because unlike the way we learn in order to perform our jobs (or my previous job) — like using specific computer software, which often demands only an independent understanding — learning to teach is learning so that, in effect, others can learn rightly and better. It requires more process, art, and competence in the doing. And most importantly, it carries a much, much bigger responsibility.</p><p>Teaching has been a humbling encounter for me, outside in and inside out. Straightaway, we realize that we are fools; we realize our limited capacity, providing only a speck of dust of an example rather than the whole context, and, at best, perhaps the one with not the best of relevance. We realize we need to come up with something more useful, to which we say, “Okay, let’s do better next time,” by doing, or not doing, something that would have made the class session better, only to realize that we will still say the same promise anyway as we learn something even more. The pursuit of perfection in every piece of material we deliver becomes a standard. It becomes mandatory not because of our personal love of the game (I mean, that can rightly be the reason), but the high bar is also set because everything has evolved to a point where what we learn gets outdated in a flash. Learning is a process of iteration. Like a film that people keep praising only after watching it a couple of times: we unravel new insight on every occasion.</p><p>The outside-in humbling might be far funnier. Funny, but a realization regardless: being told by your student that you are wrong. It is actually nice to be able to learn from these students, and the fact that students would, and can, correct you is a relief, an acknowledgment of their mental and cognitive quality. Obviously, we still need to be someone they can learn from for the most part at present, but you can see that their ceiling is way higher.</p><p>The age of AI is expected to gradually reduce our students’ reliance on us the lecturers. That is true, but the truth is we still need to keep teaching. We don’t stop teaching because everything has become more convenient and accessible for our students; we keep teaching so that we can keep up with them. We learn not to make them fit our old-fashioned way of perceiving almost everything, but to stay relevant to their unafraid way of perceiving things now, with intelligence nearer than their fingertips.</p><p>But our students are, in the end, still students. These technological luxuries are powerful, but sometimes they don’t come in handy for them. They still need to be taught. And since the world is evolving more rapidly than ever, merely keeping up has never been this hard. And that is not enough anyway, because we still need to prepare them for their future. Without that, it won’t be enough for them to conquer what comes next, a next in which we would be mere remnants. But at least we are remnants who happened to anticipate it for them. A responsibility bigger than ever before. And our students are waiting for us up front. We should keep running, and keep pushing them to run, for they are not aware of the force pulling them back like a strong wind that of all the hurdles ahead, or of the fact that the running lane will keep elongating faster than we can run, should we lack determination.</p><p>And that is why we need to keep teaching</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dad77adba56b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fuzzy Logic Engine: What is it and How to Build it — Part 2]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/fuzzy-logic-engine-what-is-it-and-how-to-build-it-part-2-083026194d9f?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/083026194d9f</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[mcdm]]></category>
            <category><![CDATA[defuzzification]]></category>
            <category><![CDATA[decision-modeling]]></category>
            <category><![CDATA[fuzzy-logic]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Thu, 28 May 2026 02:59:34 GMT</pubDate>
            <atom:updated>2026-05-28T02:59:34.634Z</atom:updated>
            <content:encoded><![CDATA[<h4>An extensive tutorial, no-code walk-through in building your own engine</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5QF-SmDyg3aausdpYkoeeg.png" /></figure><blockquote>Note: This article is a follow-up of the previous part which you can read first <a href="https://medium.com/@lazuardy.almuzaki/fuzzy-logic-engine-what-is-it-and-how-to-build-it-part-1-9789800d01a9">HERE</a>.</blockquote><h3>Building Fuzzy Logic Engine for Human Resource Recruitment</h3><p>Picking up where we left off, imagine that all HR representatives, as respondents, are surveyed comprehensively through a questionnaire composed of the question structure we discussed prior.</p><p>As a reminder, the questions must cover every fuzzy class except one — the lowest tier of each variable — and this applies to every variable, both input and output.</p><p>For our case, you can see how the questionnaire is designed below. The rows indicate the questions posed to respondents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J1J0D5zS68D4mmmp4NXoqw.png" /><figcaption>The survey questionnaire design</figcaption></figure><p>As we collect answers from all respondents, the imported spreadsheet will display each question as a column. If you have already reached this stage, and I am assuming you have come up with your own business case, we can start the fun part: developing the engine.</p><h4>Playground for Building the Engine</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*z6UIYFMBvd6d8c0gpS_5FA.png" /><figcaption>Architecture of Fuzzy Logic (courtesy of GeeksforGeeks.com)</figcaption></figure><p>For learning purposes, we have done our best to provide a convenient environment for building a fuzzy logic engine. We have taken the no-code route and built a user-friendly Streamlit app to guide you through the process following above architecture. Please click the link below to get started.</p><p><a href="https://fuzzy-logic.streamlit.app/">https://fuzzy-logic.streamlit.app/</a></p><p><strong>Step 1: Upload your Survey Result Data</strong></p><p>First things first, you need to upload your survey result data, or the spreadsheet exported from whichever form builder platform you used. To keep things smooth, converting the spreadsheet — normally an xlsx file — into CSV format is encouraged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A9Hx39FyDXY28sOg_6n1rQ.png" /></figure><p>For our case of HR Recruitement, you could find the CSV and download it <a href="https://github.com/Lazuardis/fuzzy_logic_engine/blob/main/hr_dataset.csv">here</a></p><p><strong>Step 2: Configure the Model Setup</strong></p><p>Moving on to next tab of Model Setup, you will be asked to name the model first. After that, define the number of variables in total. For our purpose, we will be having 4 variables (3 input and 1 output)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tK1XPJZ7fqcujlROl8_ugA.png" /></figure><p>Pay attention to example above. Examine for we need to fill out handful of input fields here.</p><ul><li><strong>Variable Name:</strong> For instance, <em>gpa</em>. A clean, lowercase name is preferable.</li><li><strong>Type:</strong> Input or Output. Since we are configuring GPA, it is Input.</li><li><strong>Min and Max:</strong> The allowable minimum and maximum values for that variable. For GPA, this will be 0 to 4.</li><li><strong>Step:</strong> The increment that governs the granularity of the value. In this case it is 0.1, meaning any GPA value expressed to one decimal place is valid.</li><li><strong>Number of Fuzzy Levels:</strong> For GPA, this is 4 as defined earlier.</li><li><strong>Level Name:</strong> From Bad to Exceptional.</li><li><strong>Survey Column:</strong> The mapping step, where you specify which column — that is, which question — from the loaded CSV corresponds to each level name. For the lowest-tier level, Bad in this case, no mapping is needed since there is no representing column for it. Simply select <em>(inferred edge)</em>, and the app will derive the value range for that level automatically.</li></ul><p>Repeat this for all remaining variables. Note that when configuring the output variable, an additional field will appear called <em>Defuzzification</em>, which sets the defuzzification method to be used later. For now, stick with the default value of <em>centroid.</em></p><p>After that click button <em>‘Generate Membership from Mapping’</em></p><p><strong>Step 3: Examine the Membership Graph of Fuzzification</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPG8Sou0occuxOk9FgII8g.png" /></figure><p>Now the membership graph is ready for you to observe and examine. Notice that you will have a graph for every variable. What do you think? is there any interesting pattern happening?</p><p>And one thing worth noting is about a table you can see below all those graphs. Understand that we have two columns called Shape and Points. Shape explain how each level membership is established given the nature of survey data. Some are trapezoidal and some are triangular. And Points column define what you might learn about TFN (Triangular Fuzzy Number for Triangular shape, and Trapezoidal Fuzzy Number for Trapezoidal shape). It is a set of number that express the degree of subjectivity and vagueness of the value by defining a range with number of points.</p><p><strong>Step 4: Determine the Rules</strong></p><p>Now determining the rules is an activity to which all HR representative need to be in accordance. Some example of rules would expressed as something like this:</p><ul><li><em>If a candidate has a Bad GPA and Rare organizational experience, then their selection chance would be Very Low.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RnfZ-7yKh--gu82XLPvf4Q.png" /></figure><p>Ideally, one rule is never enough — even two or three would fall short. Develop as many rules as possible, because we need to cover every combination of fuzzy levels across all three input variables, as well as the output.</p><p>For instance, if no rule is defined in a way that allows a candidate to achieve a Very High selection chance, then no candidate will ever be computed and plotted within that membership region during defuzzification. Likewise, if we fail to define rules that account for a scenario where GPA is Good, the fuzzy logic engine will break when it attempts to compute a score for a candidate whose GPA falls squarely within the full membership of ‘Good.’</p><p><strong>Step 6: Simulate Candidates as you do Defuzzification</strong></p><p>Defuzzification is the final step of building the engine. Basically, it is where everything goes full circle. Whilst in fuzzification we convert crisp input into fuzzy values, here we do the opposite. We want the output that of crisp value as we do this step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_mjL9K56rf4tjPdpOkqQg.png" /></figure><p>Play along with this part of the app as you imagine how a candidate would be. Or perhaps you could try with your own gpa, organization experience and graduate status. Fill them up as the crisp input for this Fuzzy Logic Engine. Click the ‘Generate defuzzification graph’ and see the percentage of your own selection chance!.</p><p>And that is that. The Fuzzy Logic Engine and how it is capable to cater stakeholder humane language which is fuzzy and imprecise, but somehow still manage to process the crisp input into crisp output. Amazing, isn’t it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=083026194d9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fuzzy Logic Engine: What is it and How to Build it — Part 1]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/fuzzy-logic-engine-what-is-it-and-how-to-build-it-part-1-9789800d01a9?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9789800d01a9</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[fuzzy-logic]]></category>
            <category><![CDATA[mcdm]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Wed, 27 May 2026 11:37:04 GMT</pubDate>
            <atom:updated>2026-05-27T17:11:59.037Z</atom:updated>
            <content:encoded><![CDATA[<h4>Concept illustration and case study demonstration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYJLg-cG6fswSgkOdyIp6g.jpeg" /><figcaption>Illustration courtesy of Freepik</figcaption></figure><p>Imagine you are about to work on an assignment. Worried about the possibility of being sleepy, you decide to order a coffee. It will be a cappuccino, and as usual, with less sugar. You wait until the coffee is served, and once you take a sip the feeling is just right. It is perfect.</p><p>Now thinking about the illustration above, it seems normal, yes. But from a mathematical perspective — well, maybe not really. Let’s break it down. First, what do you mean by less sugar? How much less than normal, and by the way, how sweet is the normal in the first place? And suppose the coffee turns out arriving with significantly reduced sugar — to what extent would you start saying, “Yes, I ordered less sugar, but this is far less sweet than I expected”?</p><p>And there you go, you just realized how imprecise we have probably been all this time, possibly throughout our lives.</p><p>Well, of course, for you as a customer it would not be a major problem even if you find the less-sugar coffee still too sweet. You would just drink it. But let’s switch roles — imagine you are now the seller. Suddenly you are exposed to risks you never imagined. You start receiving complaints that the coffee is too sweet for the normal sugar, too bland for the less sugar. Apparently, not all customers are as tolerant as you when dealing with this. Your customers begin leaving for other coffee shops, and all because of impreciseness.</p><p>Now here’s the thing, human being, us people, will always be imprecise. As a coffee seller, you cannot ask your customers exactly how many grams of sugar they want in their coffee, just to avoid complaints about sweetness levels. And conversely, as a customer you cannot expect the coffee seller to craft a cappuccino with the exact amount of sugar you have in mind. That is simply not how buying coffee works. We are still going to live with this impreciseness of “less” and “normal” sugar — the question is how well we, as a business, can accommodate that.</p><h4>Fuzzy Logic: A way to accommodate impreciseness</h4><p>One way to address this problem is to leverage what is called fuzzy logic. In a nutshell, it is a mechanism that could cater to discrepancies across relevant stakeholders, or at least representation of them, so that we could make them effectively involved. In our previous case, this means that before you do the selling of the coffee, you select sample of volunteer customer and ask them specifically which sugar in gram that will be the boundary between ‘less’ and ‘normal’ sugar. We call this precise numerical of the sugar in gram as crisp input.</p><p>As you conduct these surveys across a number of sample customers, you will find that, for example, some people say 10g of sugar qualifies as less sugar, whereas others say it can still be considered normal. Because of that, 10g in this case carries partial membership — it belongs to more than one sugar level category. For a sugar content of 5g, meanwhile, everyone agrees it should belong to “less sugar.” In this case, you have full membership.</p><p>Now conducting survey is just one alternative. Suppose that you have stakeholder who are coffee experts, you could also benefit their expertise in the process.</p><p>So that is basically the surface on how fuzzy logic handle impreciseness. But that is just the very beginning. We will provide you more palpable demonstration how a fuzzy logic engine can be built addressing a more relevant business case</p><h3>Building Fuzzy Logic Engine for Human Resource Recruitment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Led4VJfe3IEuuM1wC_zFg.jpeg" /><figcaption>again, illustration is courtesy of Freepik</figcaption></figure><p>Imagine you are a human resource representative at one branch of a big, big multinational company in Indonesia. All around 40 HR representatives from 40 branches are invited to Headquarters, where the aim is to gather each representative’s opinion on employee candidate selection through the lens of fuzzy logic.</p><p>After discussion, all of you agree you will based candidate over three variables:</p><ul><li>GPA</li><li>Organizational Experience</li><li>Graduation Status</li></ul><p>In an attempt to define these variables in such a way that they carry a crisp measure, all of you agree that GPA will be scored on a scale out of 4. Organizational Experience will be measured by the number of organizational involvements throughout college years — this can include being a committee member, staff, speaker, and so forth. And as for graduation status, it calculates how long in years has elapsed since the candidate graduates.</p><p>Now, in Fuzzy Logic, one of the first processes is <strong>fuzzification</strong> — essentially mapping crisp values to fuzzy classes that resonate better with how we understand things. In our linguistic way of perceiving the world, these are the fuzzy classes we typically come up with to describe the aforementioned variables:</p><ul><li><strong>GPA</strong>: Exceptional, Good, Average, Bad</li><li><strong>Organizational Experience</strong>: Often, Normal, Rare</li><li><strong>Graduation Status</strong>: Fresh Graduate, Not Fresh Graduate</li></ul><p>So you, along with other HR representative are being asked with these kind of question:</p><ul><li><em>What is the minimum GPA score so that it can be said as ‘Exceptional’</em></li><li><em>What is the minimum GPA score so that it can be said as ‘Good’</em></li><li><em>What is the minimum GPA score so that it can be said as ‘Average’</em></li></ul><p>Suppose that responding to this, your answer: at least 3.6 to be ‘Exceptional’, at least 3.3 to be ‘Good’, minimum 2.8 to be ‘Average’. And since there’s one level left which is ‘Bad’, we can conclude lower than 2.8 must be categorized as such.</p><p>Below is the membership graph of your decision logic. As you can see, all lines are aligned in y-axis percentage of HR Representatives value of 100% because well, of course we yet only take you into account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aNLupKmjlzIcVjRJp1Ueag.png" /></figure><p>Your colleague who happen to sit next to you has different say, despite not that contrast. Their answer: at least 3.8 to be ‘Exceptional’, at least 3.5 to be ‘Good’, at least 3 to be ‘Average’ and lower than it must be ‘Bad’.</p><p>Now the graph does not look quite the same as before. The trapezoidal function begins to take shape. Notice how at a GPA score of 3.7, the y-axis value is 50% for the ‘Exceptional’ line (colored in orange). This makes sense — you would still consider 3.7 exceptional, while your colleague would not. At the same time, the ‘Good’ GPA line in blue also sits at 50%, since your colleague — but not you — would categorize 3.7 as a good GPA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJ2rMNJcvSxDxduU0DjD3Q.png" /></figure><p>With that, the membership graph for both of you is complete. However, it is not sufficient — we need to account for all HR representatives, as well as the remaining variables (Organizational Experience and Graduation Status). This means designing questions in a similar fashion to those for GPA. The rule remains the same: start from the highest fuzzy tier (the one defined by the highest threshold value among all levels) — for example, from Exceptional down to Bad — and ask each respondent for the minimum threshold value at each level. Likewise, you do not need to inquire about the lowest level’s threshold, as its value can be inferred from the rest.</p><p>As addition, but not less important, another crucial variable needs to be defined. Whilst previously we dealt with three variables of input, we need to define one variable output. In this case, it will be ‘Selection Chance’, a variable that express the probability of a candidate being accepted given the three variables input. And similarly, selection chance is as well has its own linguistic fuzziness which are: Very High, High, Medium, Low, Very Low. And just the same, all HR representatives need to be questioned about the crisp value they believe could act as threshold boundary between level. Basically something like <em>“What is the minimum percentage for a candidate so that it is said they have a very high selection chance?”</em></p><p>Now imagine you try to design your own business case experiment leveraging Fuzzy Logic, what kind of case so interesting you would like to examine?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9789800d01a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[22 Years A Fan Memoir — Part 1]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/22-years-a-fan-memoir-part-1-9ee8d11b2306?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ee8d11b2306</guid>
            <category><![CDATA[arsenal]]></category>
            <category><![CDATA[memoir]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Sat, 23 May 2026 03:37:53 GMT</pubDate>
            <atom:updated>2026-05-23T03:37:53.458Z</atom:updated>
            <content:encoded><![CDATA[<h4>The day we became champions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JNNu8squNBaE6Ep07I6o8g.jpeg" /></figure><p>The date was May 20th, Indonesia time, in London, though, it should besometime around when evening had just crawled in. It was one of the last games to wrap up the penultimate round of the Premier League, Matchweek 37. The ever-lasting unbeaten record of Bournemouth faced the must-win of Manchester City. We had clocked it and were aware by that time that we, Arsenal fans, might have our fate sealed by a game not played by us at all.</p><p>The time was around three in the morning, almost half an hour past it. Earlier, I had been working until midnight, and somehow didn’t manage to set my alarm — for I clearly understood that if I were ever to wake up in the middle of the night to watch a non-Arsenal game, this match had to be it. But somehow, before the dawn, I awoke. My head and my thoughts snapped into anxiety before the rest of me even awake: <em>what time is it, has the game already finished, did I just miss something really important?</em> That was one of those moments when my heart rate must have escalated quickly, right after waking up.</p><p>I reached for my phone, which had always been next to me. Livescore was the app I checked straightaway. It was minute 90, entering extra time, the score was 1–0 to Bournemouth!. Now it’s something I indeed wished but not expect to come about like this — my whole body and mind tried to process everything. Somehow I felt my brain unlocking the most likely possibility of something it had never quite experienced before. Arsenal was about to win the league.</p><p>I shrieked a little, waking my wife beside me but luckily not my daughter. She was startled, asking what was going on. While trying to get the livestream up on my screen, I said to her in an autonomous sappy tone: “Arsenal will win the league — the league after 22 years.”</p><p>Now, people say that life is bigger than mere football. It’s true. But that mere football, per se, is still an instance so immense. It’s baffling how it could dictate people’s lives into moments stranger than fiction. I sobbed in my profound solitude witnessing those moments, but my thoughts were flying, roaming free with the fellow supporters who were jubilant — at the Emirates thereabouts and all around the world, whom I know and haven’t met yet. Arsenal fans, this is for you.</p><p>Obviously I sustained the joy throughout the rest of the day (well, technically I should still be overjoyed, perhaps for much longer than this, I still am now), coming to work wearing the Arsenal jersey — which people would normally not permit, but I had submitted the plea well in advance so that I was scold-free. I gave lectures in front of my students and then asked for photos for personal memories. I decided to bring in a couple of boxes of pizza for my colleagues, just because. I was perfectly aware this was not me at all — to make a fool of myself for what people might think, on the surface, is such a silly reason, and to be asked the same question over and over about what it was all about despite having already answered. They thought I was joking, but it really was because of Arsenal. Fair play — I have never even rated any of my own birthdays, let alone anything coming close to this.</p><p>Easily one of the bestest time of my almost three decades of life. This one is for the books, the books which I will be keeping forever.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ee8d11b2306" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step-by-Step Tutorial — TOPSIS]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/step-by-step-tutorial-topsis-1786feb780e1?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1786feb780e1</guid>
            <category><![CDATA[mcdm]]></category>
            <category><![CDATA[topsi]]></category>
            <category><![CDATA[intuitive-intelligence]]></category>
            <category><![CDATA[decision-model]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Sun, 10 May 2026 15:44:54 GMT</pubDate>
            <atom:updated>2026-05-10T15:44:54.450Z</atom:updated>
            <content:encoded><![CDATA[<h4>Comprehensive review to make the most of one intuitive MCDM tool</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YOzAup-sWFIK4upXzOyWEw.png" /></figure><h4><strong>What is Intuitive Decision Model</strong></h4><p>In the field of machine learning, the necessity of an algorithm being intuitive remains a relevant criterion, though not a strict requirement. Being intuitive means it is easy for users and stakeholders, who are mostly non-technical people, to understand the way an algorithm makes its prediction or decision. For instance, imagine a model embedded in your financial technology (fintech) app, specifically designed for investment management like Bibit or Stockbit, and you set an in-app feature that governs a decision wherein every time a stock you bought reaches a specific target price you personally set, it triggers an automatic sell. That is what it means to be intuitive, you understand the rule upon which the machine bases its decision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*GhG4mpH1-EECM-sm.png" /><figcaption>One algorithm called Decision Tree is one of the most intuitive model. Above is an example of a decision tree model of deciding transportation mode (source: Displayr)</figcaption></figure><p>Well, the prior example might depict a function not complex enough compared to the abundant use cases out there, and that underlines the challenge. Mathematicians and scientists keep working on initiating rules and algorithms robust enough to handle far more sophisticated problems, while still retaining sufficient intuitiveness. And believe me, the more intuitive your model is, the easier it becomes to get your boss’s or stakeholders’ consent, should you want to apply that specific model within your business.</p><h4>TOPSIS: An intuitive alternative in the realm of MCDM</h4><p>In operations research, specifically in the subset of Multi-Criteria Decision Making (MCDM), being intuitive is also quite important. MCDM is composed of many methods that are in essence prescriptive tools. And unlike predictive tools that only convey what <em>will</em> happen, prescriptive tools tell users what <em>to do</em> — mostly with precision. Therefore, the need to be communicable and interpretable naturally becomes a requirement to some extent.</p><p>We are about to learn TOPSIS, or <strong>Technique of Ordering Preference by Similarity to Ideal Solution</strong>. Despite being far from a new technique, its adoption has not slowed over the decades. Thanks to many studies that keep proposing modifications and enhancements to the method, like AHP-TOPSIS or P-TOPSIS, which have clearly kept the approach preferable. That said, one other thing I am absolutely certain about regarding TOPSIS’s popularity is that it must be owed to its intuitiveness.</p><p>Similar to numerous machine learning algorithms — k-Means Clustering, for instance — TOPSIS adopts a geometrical philosophy in defining how similar or dissimilar entities are from one another. Borrowing reliable distance measures like Euclidean, TOPSIS ensures its interpretability remains accessible even for beginners.</p><h4>Step-by-Step: TOPSIS, and the make the most out of it</h4><p>For the tutorial section onwards, we will guide you to try our sandbox to make the learning process more effective and efficient. Please refer to the link below:</p><p><a href="https://topsis-demo.vercel.app/">https://topsis-demo.vercel.app/</a></p><p>The web app is essentially a TOPSIS calculator. However, I have also equipped it with some interesting analytics that may deepen our understanding of the results, since TOPSIS can appear tricky to new learners as the number of criteria grows.</p><p>Once you’ve successfully accessed the sandbox, let’s begin the step-by-step as follows.</p><h4>Study Case: Cloud Provider Selection</h4><p>You are a promising entrepreneur venturing into one of the most saturated fields in today’s landscape: digital business. As your business grows, you need a cloud provider to help you scale. Suppose you have narrowed it down to three options: Cloud A, Cloud B, and Cloud C.</p><p>After discussing with key stakeholders , such as the CEO and COO, you collectively decide on six criteria to consider:</p><ul><li><strong>Cost:</strong> Can be per month or per year</li><li><strong>Uptime:</strong> The historical percentage indicating how often the cloud server was up and active</li><li><strong>Security:</strong> Measured on an ordinal scale of 1–10. Higher means better</li><li><strong>Support:</strong> The average time in minutes a cloud provider typically takes to respond to a support request. Higher means a worse experience</li><li><strong>Integration:</strong> Measured between 1–5. A higher score means the cloud service integrates well with many external tools</li><li><strong>Long-Term Discount:</strong> Indicates whether the cloud provider guarantees a discount upon service extension</li></ul><p>The objective is simple: which among the three is the best option? Behold, for TOPSIS is about to take action.</p><p><strong>Step 1: Describe the Decision Matrix</strong></p><p>Establish a decision matrix where number of alternatives are evaluated against number of criteria. Below is example of a decision matrix following above study case. Three alternatives, with six criteria.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*AMTJH--5XObg7CRukKzktg.png" /><figcaption>Our decision matrix for the study case</figcaption></figure><p>Note that we have an interesting variety of criterion values here: numerical (cost), percentage (uptime), ordinal (security and integration), duration in minutes (support), and even Yes/No for Long-Term Discount, which we need to transform into binary 0 and 1, since the algorithm cannot take text values as-is. This situation affirms just how robust TOPSIS is for handling such diversity.</p><p><strong>Step 2: Normalization</strong></p><p>Transform the various units of measurement into a dimensionless scale (usually using vector normalization):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*R6vIb1CK_XQ3lGzX-4ehSw.png" /><figcaption>normalization equation</figcaption></figure><p>Normalization ensures that the previously varying units of measurement will no longer pose a problem going forward. The dimensionless scale produced by this process makes the new numbers comparable on an apple-to-apple basis.</p><p><strong>Step 3: Weight Application</strong></p><p>Apply weights to each criterion to reflect its relative importance. But since we have not defined it yet. Suppose this is the agreed upon weight amongst stakeholder:</p><ul><li>Cost: 30%</li><li>Uptime %: 15%</li><li>Security: 20%</li><li>Support: 10%</li><li>Integration: 15%</li><li>Long-Term Discount: 10%</li></ul><p>The formula in which weights being impelemented goes like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/125/1*OVTQFXvJG423SmNOIt1ung.png" /><figcaption>weighted equation over normalized value</figcaption></figure><p><strong>Step 4: Compute PIS and NIS</strong></p><p>For each criterion, take the best value from all alternatives and place it in a set defining the <strong>PIS (A+)</strong>, or Positive Ideal Solution. Likewise, take the worst value to compose the <strong>NIS (A−)</strong>, or Negative Ideal Solution. PIS and NIS essentially serve as hypothetical best- and worst-case solutions, against which each alternative will be compared in the next step.</p><p><strong>Step 5: Compute Distance for each Criterion</strong></p><p>Calculate each alternative distance from ideal PIS and negative ideal NIS. We will employ Euclidean here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/1*1La6ygySm_uMdO5l3inZDA.png" /><figcaption>distance from PIS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*9ba-Fx2OvYBFGcv8kcPg0w.png" /><figcaption>distance from NIS</figcaption></figure><p><strong>Step 6: Compute Closeness Coefficient</strong></p><p>Last but not least, the final score we will use as a decision reference is derived through a variable called the <strong>relative closeness</strong>, or closeness coefficient. Theoretically, the score ranges between 0 and 1, and the best candidate alternative is the one whose value is closest to 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/112/1*NOgOWJBYSFqi-lllOtQ5oQ.png" /><figcaption>closeness coefficient equation</figcaption></figure><h4>Additional Analytics for Discussion</h4><p>Technically, the TOPSIS computation wraps up at Step 6. However, we extend the sandbox with additional descriptive analytics that I believe will further reveal the method’s interpretability.</p><p>In the first section, we have a horizontal bar chart that orders each alternative’s final score given a selected criterion. You can choose different criteria via a dropdown and examine how a specific alternative may dominate others across a couple of criteria — which in turn explains why that alternative ranks higher in the final TOPSIS ordering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*W3qaPqXGo8rMLgI187rtvg.png" /><figcaption>First analytics: Alternative 2 has the highest value of criterion Security</figcaption></figure><p>In the second section, we have a scatter plot where our alternatives are placed across two criteria simultaneously, selectable via another dropdown. Given the method’s inherently geometric nature , along with the normalization and weight multiplication performed earlier, reading the scatter plot is as straightforward as it looks: the best alternative is the one whose representative point lies closest to the Positive Ideal Solution (PIS) and farthest from the Negative Ideal Solution (NIS), were a line drawn to connect them. That said, bear in mind that the result here is only applicable when considering those two selected criteria.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vnKaJr-krmHigMHoaMv6w.png" /><figcaption>Alternative 2 (denoted by blue dot) is the best amongst alternatives over two criteria of Integration and Cost. Alternative 2 edges other alternatives since it’s both closer to PIS A+ and farthest from NIS A-</figcaption></figure><p>Obviously, we cannot draw an overall TOPSIS conclusion from the bar chart or scatter plot alone, but these two visualization tools are, I believe, more than sufficient to demonstrate the degree of intuitiveness this method offers, and to help us truly make the most of it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1786feb780e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Examining Business Cost of AI Chatbots: A Simple LLM API Experiment]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/examining-business-cost-of-ai-chatbots-a-simple-llm-api-experiment-dd21304cdc61?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd21304cdc61</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 09:49:38 GMT</pubDate>
            <atom:updated>2026-04-29T09:49:38.403Z</atom:updated>
            <content:encoded><![CDATA[<h4>As business leveraging AI now is almost a mandatory due diligence, let’s understand how its adoption affects business cost structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bIqdARtSUhucDYvJCrpl2g.png" /></figure><p><strong>Business and Chatbots..<br></strong>….they are like an inevitable match these days. Corporations, through their digital touchpoints, are trying to make their users aware that they too are adopting the rapid tech that exists today. Integrating oneself with AI is almost like a necessity, an obvious textbook play, especially for those companies that exist particularly via application. They now provide chatbots, which can take the form of a full page or as a pop-up appearing from a fancy button with typical AI labelling. Helping the staff as well as helping visiting internet users or new users just installing the app. Mostly imposing a specific personality with a name. They say it is their brand mascot, virtual assistant, or digital customer service representative. A new norm.</p><p>Years ago, chatbots were merely a combination of simple Natural Language Processing (NLP) with functional integration into a local information database. However, the AI revolution drives and makes possible high expectations from the customer’s perspective, perhaps. They want something that can provide a different answer even when asked the same question. Less and less robotic, becoming more humane, as context understanding increases. And with that, Large Language Models take charge.</p><p><strong>API Call LLM Services<br></strong>In order for a company to put this significant change into realization, it would obviously be utterly naive for them to develop their own LLM. OpenAI, Anthropic, Google, and a few other LLM developers spend millions of dollars to train and equip models as we currently know them. And these corporations are also not naive enough to limit their revenue stream to just letting their users use and pay for their product via their own personalized apps such as ChatGPT or Claude — these corporations commercialize their models as well via other seamless way: API calls.</p><p>Basically, an API call allows us to send a prompt and get the answer to that prompt indirectly, not as if we are using their front-end interface (like when you use Gemini). This way, we can sort of engineer it as if we own the model by putting this mechanism as the back-end of our own brand’s tool. We have been seeing a lot of this happening everywhere: Canva, Samsung, or the United States Government. They leverage API calls with these service providers for internal or external uses.</p><p><strong>Sandbox Playground: Understanding Cost of its Adoption<br></strong>This exercise is intended to help you — who will mostly be business people in the future — understand how much money needs to be allocated in adopting chatbots like these, leveraging a mechanism like this.</p><blockquote>Beforehand, I would like to inform you that this article is intended to be a course demonstration for undergraduate students. Hence, its implementation complexities and nuances may be simplified for educational purposes. Nonetheless, of course, we try to be as realistic and as useful as possible.</blockquote><p>You can access our designated Sandbox Playground here:<br><a href="https://llm-powered-chatbot.streamlit.app/">https://llm-powered-chatbot.streamlit.app/</a></p><p><em>Note: please wake the app up just in case, because it is deployed within Streamlit cloud services.</em></p><p>Let’s get in touch, step by step</p><p><strong>Step 1: Selecting Model<br></strong>We will be using a free service provided by Google, which is Gemini 2.5 Flash-Lite. This model, perhaps to some extent, may no longer be the most relevant given the ever-saturating landscape of LLM models out there. But for the sake of demonstration, I strongly feel that this model is good enough.</p><p>Different corporations may opt for other better, faster options (of course with higher cost). You can check the many other commercial models here: <a href="https://pricepertoken.com/">https://pricepertoken.com/</a> where it bases its pricing on Token. We will explain it shortly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*_GncqnIdgB0m_FW4jLkTWA.png" /><figcaption>For the moment, I disabling any other options (because they are paid)</figcaption></figure><p><strong>Step 2: Setting Business Example<br></strong>This step is not actually a real step you need to explicitly in the chatbot interface, but something internally you need to set. What kind of case are we about to use the tools for. In this case, we will proceed by selecting <strong>“Customer Service”</strong> as our business example. Basically due to our intention to adopt chatbot in helping us doing communication with our customer autonomously (by not using human). This is again, just an example.</p><p><strong>Step 3: Setting Model Instruction<br></strong>Setting a model instruction is technically no different from writing a prompt itself. But best practices indicate — which I believe many models adopt — that chatbot users are usually willing and prefer being detailed about how they want the AI chatbot to carry out the forthcoming prompt session. So it is basically setting its belief, role, and boundaries so that it can mitigate the risk of answers being out of context, hallucinations, and staying as consistent as possible. This is a prompt designed to be lasting. In our case, you could simply write:</p><p><em>“You are a friendly customer support assistant from company named ‘Bees Knees’. Answer clearly and politely.”</em></p><p><strong>Step 4: Writing the User Prompt<br></strong>Now this is where you decide what case-by-case prompt you want to send — for when you need something faster, sufficiently good, but still reliable from the AI. I will give you a case example: suppose that we need to run a prompt every time we receive a customer complaint. You could run this prompt:</p><p><em>“A customer named Mita Laila says their order arrived late and asks for compensation. This is her email of complaint:<br>“I bought a vase from your company under order id of AAIK567 and the vase is broken upon arrival. I want you to provide me new vase, but if not possible, refund is welcome”</em></p><p><em>Draft a reply.”</em></p><p>Click ‘Run API Call’ button afterwards</p><p><strong>Step 5: Viola, examining and get the Model Response</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*Jdkl3_FcGYJ6bu6-2fsw7Q.png" /></figure><p>Now you have the response ready. And mostly, given the prompt you inputted earlier (both the model instruction and the user prompt), it is very unlikely the response will give you anything less than satisfactory — though on many occasions, people will prefer to recheck before using and sending it to the customer</p><p><strong>The Business Relevance of Prior Chatbot Simulation<br></strong>Every single time you send a prompt and therefore you receive answer to that, cost does incur. And the cost varied, many service providers has mechanized this through term <em>Token</em>. A token is basically the measure that reflects how high or low the API call costs are. In most cases, it may be translated into a word. One token is roughly one word (though common agreement and practice usually translates to about a few words per token). And these service providers charge us per token of input AND output combined.</p><p>That means if your prompt is long, you need to pay more. And if you get a long answer, you will be charged more as well. Images, sounds, or files are usually equivalent to hundreds of tokens, given the more complex nature of their content. So every time you use Gemini and upload your files (photos or videos) as an input modality, they actually need to spend more resources than just processing text.</p><p>In the sandbox, you could see that there is a counter for input and output tokens and their corresponding equivalent cost (I use an actual, more or less, estimation of commercial API call costs, so these numbers are not just made up!). Given that, you could simulate a scenario where you someday deploy this AI, mechanized through API calls, within your application — estimating the number of users of the app, multiplied by the average API calls per user, and multiplied by the number of effective days — and voilà, you now have an estimation of the monthly operating cost for deploying an AI chatbot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*ZOd6gPCi40F5EqFokVQodw.png" /><figcaption>The Business Scaling Calculator</figcaption></figure><p><strong>Closing Remark: Understand that this is not complete applicable steps<br></strong>We’ve learned a lot (hopefully), but of course these steps we provide you, along with the sandbox, are not necessarily a prototype for a usable tool in a corporation. They just demonstrate how API calls of LLM models incur costs. In reality, corporations would integrate this function into a more robust, scalable pipeline — for example, so that employees do not need to write the customer’s name for every prompt, or so that the reply can be processed and sent as a response email to the customer automatically without a manual copy-paste procedure. Fingers crossed, may we discuss that on a later occasion, shall we.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd21304cdc61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Unsupervised Learning of Clustering]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/the-unsupervised-learning-of-clustering-8fc856c3f3dd?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fc856c3f3dd</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Sat, 04 Apr 2026 16:49:13 GMT</pubDate>
            <atom:updated>2026-04-07T09:55:44.857Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding how we could make the most of something that basically is just an enhanced scatter plot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tdxQQdv1VO5PLWs5LQdG-g.png" /></figure><p><em>This article is a part of a designated lecture course study material. Therefore we would like to present a disclaimer that the tutorial may not necessarily sufficient for practical use cases since the tutorial is intended for concept learning purpose</em></p><p>Clustering is a type of problem within field of Unsupervised Learning in Machine Learning; is perhaps the most commonly known and implemented in business.It helps us not only to identify patterns that exist within data, but to make something meaningful out of them by putting them into coherent segments.</p><p>Clustering has been applied to so many business scenarios, most prominently perhaps in how we can separate customers who share similar behaviour from those who do not, so that we can design different products or marketing strategies that work more effectively for each distinct customer segment.</p><p>Clustering at its simplest form, could be demonstrated by leveraging two dimensional graph combining — onto two axes — two variables of interest (actually we can go even simpler by just observing one variable, but usually its less useful). In practice, we typically want to cluster data entities — from individual customers to corporate clients — across many variables. However, since displaying more than two variables on a two-dimensional medium is not particularly effective, we will work with just two variables for now. And when you try to imagine how two variables interact on a graph, well — it is essentially a scatter plot!</p><p>If it is a scatter plot, then it must not be all that difficult, right? Well, yes, if your only goal is to discover whether a pattern exists between two variables. However, as mentioned earlier, a clustering algorithm does not merely identify if a pattern is present; it specifically tells you how to assign each entity to a predefined number of clusters that you define. And that is what makes it both fun and more useful.</p><h4>Study Case: Country Dataset</h4><p>Let’s jump into action by working with a real dataset. We will use this interesting dataset from Kaggle. In case you have never heard of it, Kaggle is a community platform where you can find an abundance of useful datasets to practice with, alongside many other great resources and stuff.</p><p>Please guide yourself into link over here: <a href="https://www.kaggle.com/code/zohrehtofighizavareh/clustering-on-country-dataset/input">https://www.kaggle.com/code/zohrehtofighizavareh/clustering-on-country-dataset/input</a>.</p><p>Basically it is a dataset about countries with some interesting features or columns. To be honest I barely could find anything in regards of the dataset, like where it was sourced from or what overarching purpose it serves. But that is not a problem for us here. The more mysterious the dataset, the more creative our perspective towards it.</p><p>The dataset columns/features are:</p><blockquote><strong>country: </strong>Name of the country <br><strong>child_mort: </strong>Deaths of children under 5 years of age per 1,000 live births<br><strong>exports: </strong>Exports of goods and services per capita, as a percentage of GDP per capita<br><strong>health: </strong>Total health spending per capita, as a percentage of GDP per capita<br><strong>imports: </strong>Imports of goods and services per capita, as a percentage of GDP per capita<br><strong>income: </strong>Net income per person<br><strong>inflation: </strong>Annual growth rate of the total GDP<br><strong>life_expec: </strong>Average life expectancy at birth, in years <br><strong>total_fer: </strong>Total fertility rate: average number of children per woman under current age-fertility rates<br><strong>gdpp: </strong>GDP per capita</blockquote><h4>Step 1: Download the data in the Kaggle</h4><p>Once you click the dataset link above, locate the download button in the <strong>Input</strong> tab of the page. Kaggle also offers a convenient data wrangler where you can explore each feature’s value distribution. For many people, this is a very helpful first step before diving into analysis.</p><h4>Step 2: Open our Clustering sandbox tool!</h4><p>Check out this simple clustering sandbox we created by clicking the link here: <a href="https://clustering-demonstration.vercel.app/">https://clustering-demonstration.vercel.app/</a></p><p>When you open this web app, you will see four main panels to interact with: <strong>Data Source</strong>, <strong>Features</strong>, <strong>The Two-Dimensional Scatter Plot</strong>, and <strong>Clustering</strong>.</p><p>You will notice that a pre-loaded dataset of dummy synthetic customer data is already embedded within the app. This data would technically serve our demonstration purposes, but using customer data for a clustering study case would be a bit boring, right?</p><h4>Step 3: Load the Country Dataset</h4><p>To load the country dataset you downloaded from Kaggle, look for the <strong>Data Source</strong> panel at the top of the page. You will see two options: loading the built-in sample, or uploading your own file. Click on the<strong> </strong>CSV file button and select the country dataset CSV you downloaded from Kaggle. Make sure your file includes the header row — the app relies on it to read your column names correctly.</p><p>Once uploaded, the scatter plot will refresh and the <strong>Features</strong> panel will populate with the country dataset’s columns, replacing the default customer data. You are now ready to start exploring.</p><h4>Step 4: Choose and Observe any possible of two features combination</h4><p>On the side, you can find the <strong>Features</strong> section, where each feature in the loaded dataset is listed alongside its data type (either numerical or categorical). You will notice that almost all features here are numerical. This is particularly useful for our purposes, because clustering tends to be most intuitive when the axes of the scatter plot are continuous.</p><p>Select any two features to compare against each other. What do you think would be a reasonable pair here?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*EeVha-78bqacqANGvVGuaw.png" /><figcaption>Features sidebar</figcaption></figure><p>A sensible pairing is one where the two variables seem meaningfully related to each other. For instance, choosing <strong>Health</strong> and <strong>Child Mortality</strong> makes intuitive sense — health expenditure may directly influence child mortality rates, a plausible causal relationship in most contexts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUH4-IW1mMfHcM_OYcwDWg.png" /><figcaption>Health vs Child Mortality</figcaption></figure><p>Another way to see if a pair would be a good pair is when the scatter plot segregate data into emerging shape as if they were in groups (prior assign them into clusters), noticeably at least. For example, below is when I choose to compare</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6ILye8cqmFnxRA1xMpo0A.png" /><figcaption>Life Expectancy vs Total Fertility</figcaption></figure><p>When I try to match <strong>Total Fertility</strong> with <strong>Life Expectancy</strong>, at a glance, you can see at least two natural clusters forming: one concentrated in the upper-left region and another in the lower-right. Given this, the clustering algorithm will almost certainly pick up on this observable pattern and label them as distinct clusters.</p><p>That said, visually apparent groups are not a prerequisite for running clustering. You can still assign data into clusters even when the scatter plot appears more dispersed or shows little correlation. However, keep in mind that clustering is most effective when entities within the same cluster are as similar to one another as possible. The more concentrated the data, it underlines strong similarity and therefore we recommend to approach it as we explain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ltf4CpTWdHOEVufZ.png" /><figcaption>Example of no correlation. Source: Statology.com</figcaption></figure><h4>Step 5: Run the Clustering Algorithm, Fit the Data</h4><p>he final step is fitting your data using a clustering algorithm. We provide two of the most widely used options to experiment with: <strong>K-means</strong> and <strong>Hierarchical clustering</strong> (unfortunately, discussion about the how of the algorithm must be put aside for another story). Different algorithms may produce different results, and you can observe this directly by watching how each data point changes colour once you click the <strong>Fit Clusters</strong> button, which corresponds to your chosen number of clusters.</p><p>The <strong>Number of Clusters</strong> is a hyperparameter. In short, think of a hyperparameter as a configuration setting that the user defines before the algorithm runs, in order to tailor the outcome to a specific need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3BvK5tuz1xilcFhitxt-mg.png" /><figcaption>Fitting clusters with hyperparameter of number of clusters set to 2</figcaption></figure><h4>Final thought: Comprehending the unsupervised learning way of it</h4><p>The main difference of supervised and unsupervised machine learning basically lies in our ability to tell if they are good or not (besides the fact that supervised data works on <em>labelled data</em> and unsupervised don’t). Supervised learning has a stark definition for this, as we could use metric as accuracy to tell if a model is any good. In unsupervised, the judgment is far less rigid. Despite we could leverage metric — like silhouette score or elbow method — that can sort of evaluate whether one number of clusters fits the data better than another, for example, the way we choose the number of clusters (or many other possible hyperparameters) often depends on user’s need and interpretation. And there is no absolute way to tell if the presented clusters now as you have it, is bad or great, but at least the machine suggest what mostly make sense according to their mathematical rule. And that makes unsupervised learning, like clustering, is a fun tool to have in your AI skill repertoire.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fc856c3f3dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brief Tutorial: Setting up your own Chatbot leveraging API Calls Procedure]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/brief-tutorial-setting-up-your-own-chat-bot-leveraging-api-calls-procedure-15bf79e61e92?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/15bf79e61e92</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 15:29:13 GMT</pubDate>
            <atom:updated>2026-03-29T07:26:21.641Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn the very basic form of traditional Chatbot AI now made even easier to build</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-0iNZrFEIOT0u6vaiEt1cg.png" /></figure><p><em>This article is a part of a designated lecture course study material. Therefore we would like to present a disclaimer that the tutorial may not necessarily sufficient for practical use case since the tutorial is intended for concept learning purpose</em></p><p>Chatbots have been cramming up the landscape of digital business. Many many corporations has integrated chatbots functional into their business process, helping internal and external corridors. Perhaps highest than ever.</p><p>In this tutorial we would like to showcase and underline how setting up a chatbot is now very easy. Compared to before, open-source tools have transformed into something whose usability is significantly increasing, even for production-level deployment. One of which is <strong>Streamlit</strong>, a free web application framework built on the Python language that not only provides seamless interface design development but even specific features from dashboards, geographic maps, and of course, chatbot interfaces.</p><p>While we learn about chatbots, we would also like to demonstrate a basic example of how the algorithm that operates the bot works at its backend. Specifically, we will leverage other functionality, that of an <strong>Information Database through API retrieval</strong>. We will demonstrate how API calls are used to provide what will be retrieved and shown as the main ingredient of information by which the bot formulates its reply as the answer to the user’s query.</p><p>Thus we have several learning objectives here:</p><ul><li>Understand the application of simple Chatbots and its operation</li><li>Understand the process of using accessible API provider</li><li>Understand how application interface handle state across interactions</li></ul><h4>About the Study Case</h4><p>For this tutorial, we will build a <strong>Movie Information Chatbot</strong>. The user types the title of a movie into a chat interface, and the bot responds with details about that film — including its release year, audience rating, and a short synopsis.</p><p>To retrieve this information, we will use <strong>The Movie Database (TMDB)</strong>, a well-known and freely accessible API that hosts an extensive catalog of film and television data. This use case is intentionally simple so that we can keep full attention on the two core concepts: <strong>how an API works</strong> and <strong>how a chatbot interface is structured</strong>.</p><p>This small exercise is structured into the creation of these files</p><pre>movie-chatbot/<br>│<br>├── app.py          ← the Streamlit chatbot interface<br>├── tmdb_api.py     ← the API retrieval logic<br></pre><h4>STEP 1: Prepare your TMDB API Key</h4><p>Every API provider needs to know who is making a request. This is handled through an <strong>API Key</strong> — a unique identifier tied to your account that the server uses to authenticate your requests. Think of it as a digital ID card you must show every time you want to access data.</p><p>To obtain your TMDB API Key, follow these steps:</p><ol><li>Visit <a href="https://www.themoviedb.org/">https://www.themoviedb.org</a> and create a free account</li><li>After logging in, go to <strong>Settings → API → Create → Developer</strong></li><li>Fill in the required form (you may describe the use as “educational/personal project”)</li><li>Copy your <strong>API Key </strong>— it will be a long string of letters and numbers</li></ol><h4>STEP 2: Understand the structure of the API</h4><p>Before writing any code, it is important to first understand what the API actually returns. This step is often skipped by beginners, but it is arguably the most valuable part of learning to work with APIs.</p><p>You could test using jupyter notebook file, and try to understand the JSON output structure to get the idea about information being stored and send by the API provider of TMDB. You could test by doing something as follows</p><pre>import requests<br><br><br>url = &quot;https://api.themoviedb.org/3/search/movie&quot;<br>params = {&quot;query&quot;: &quot;Inception&quot;, &quot;api_key&quot;: &quot;739c63f73d647351eb95da97576c2d80&quot;}<br>response = requests.get(url, params=params)   # &lt;-- this is the API call<br>response.json()</pre><p>You will see a raw JSON response displayed in your browser — a structured block of text data. Inside it, you will find a key called results, which contains a list of movie entries. Each entry carries fields such as title, overview, release_date, and vote_average.</p><p>Note: the url here define the ‘gate’ from which you get to receive the information. Imagine if you want to withdraw (asking) money from TMDB bank, then url must be the door you’re entering.</p><h4>STEP 3: Installing dependencies</h4><p>With your environment ready, install the required Python packages. Open your terminal and run:</p><pre>pip install streamlit requests python-dotenv</pre><p>Here is a brief explanation of each package and why it is needed:</p><ul><li><strong>streamlit</strong> — the framework that will render our chatbot interface in the browser. This is the most ridiculously handy web app interface framework in Python!</li><li><strong>requests</strong> — the library that handles sending HTTP requests to the TMDB API. This way you could let your code communicate with the internet!</li></ul><h4>STEP 4: Set Up the API Modules</h4><p>Create a file named tmdb_api.py. This module is solely responsible for communicating with TMDB — it sends the request, receives the data, and formats it for display. The chatbot interface will simply call the functions defined here.</p><pre>import requests<br>import os<br><br>API_KEY = os.getenv(&quot;TMDB_API_KEY&quot;)<br>BASE_URL = &quot;https://api.themoviedb.org/3&quot;<br>def search_movie(title):<br>    url = f&quot;{BASE_URL}/search/movie&quot;<br>    params = {&quot;query&quot;: title, &quot;api_key&quot;: API_KEY}<br>    response = requests.get(url, params=params)   # This is the API call<br>    if response.status_code == 200:<br>        results = response.json().get(&quot;results&quot;, [])<br>        if results:<br>            return results[0]   # Return the top matching result<br>    return None<br>def format_movie_info(movie):<br>    return (<br>        f&quot;🎬 **{movie[&#39;title&#39;]}** ({movie.get(&#39;release_date&#39;, &#39;N/A&#39;)[:4]})\n\n&quot;<br>        f&quot;⭐ Rating: {movie.get(&#39;vote_average&#39;, &#39;N/A&#39;)}/10\n\n&quot;<br>        f&quot;📖 {movie.get(&#39;overview&#39;, &#39;No description available.&#39;)}&quot;<br>    )</pre><p>A few things worth noting here. The response.status_code value tells us whether our request was successful. A code of 200 means everything went well. A 401 indicates an invalid API key. A 404 means the requested resource was not found. These <strong>HTTP status codes</strong> are a universal language of the web — you will encounter them across virtually every API you work with in the future.</p><p>The entire code function of search_movie will execute the procedure to send request to and take feedback from the TMDB API. It let TMDB know the movie title you ask as well your API key credential, and it will give you load of information in return (recall the structure of the information in STEP 2)</p><p>The format_movie_info function then takes the raw data dictionary and shapes it into a readable, well-presented string that our chatbot will display to the user. You can customizes how the chatbot reply over here.</p><h4>STEP 5: Build the Chatbot Interface</h4><p>Create a file named app.py. This is the Streamlit application that the user will interact with. It handles displaying the chat history, capturing user input, and calling our API module to generate bot replies.</p><p>python</p><pre>import streamlit as st<br>from tmdb_api import search_movie, format_movie_info<br><br>st.title(&quot;🎥 Movie Info Chatbot&quot;)<br>st.caption(&quot;Ask me about any movie! Just type the title.&quot;)<br># Initialize chat history in session state<br>if &quot;messages&quot; not in st.session_state:<br>    st.session_state.messages = []<br># Display the existing conversation history<br>for msg in st.session_state.messages:<br>    with st.chat_message(msg[&quot;role&quot;]):<br>        st.markdown(msg[&quot;content&quot;])<br># Handle new user input<br>if prompt := st.chat_input(&quot;Type a movie title...&quot;):<br>    # Display and save the user&#39;s message<br>    st.session_state.messages.append({&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt})<br>    with st.chat_message(&quot;user&quot;):<br>        st.markdown(prompt)<br>    # Call the API and generate a bot reply<br>    movie = search_movie(prompt)<br>    if movie:<br>        reply = format_movie_info(movie)<br>    else:<br>        reply = f&quot;Sorry, I couldn&#39;t find anything for **&#39;{prompt}&#39;**. Try another title!&quot;<br>    # Display and save the bot&#39;s reply<br>    st.session_state.messages.append({&quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: reply})<br>    with st.chat_message(&quot;assistant&quot;):<br>        st.markdown(reply)</pre><p>Pay particular attention to the use of st.session_state. By default, Streamlit re-runs your entire script from top to bottom every time a user interacts with the page. Without session state, the chat history would be wiped clean on every message. st.session_state is Streamlit&#39;s mechanism for <strong>persisting data across these re-runs</strong> — which is exactly what a chatbot needs to maintain a coherent conversation thread.</p><h4>STEP 6: Test your Chatbot down!</h4><p>Once all required files are well defined, now it’s time to put your chatbot app into action. Open new terminal (in Visual Code you could find in the upper menu of ‘Terminal’ and then choose ‘New Terminal’) and proceed in the terminal with streamlit run app.py and click enter to execute and wait until your browser bring up your app!</p><p>Try to write down in the chat your favorite movie!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEN382Qpm3bhneaTPPLJGw.png" /><figcaption>just some bit on how it would look like</figcaption></figure><h4>Concluding Remark</h4><p>Now you already find yourself able to create basic but fundamental chatbot. This is exactly how many many chatbot works. You asking for something, and it will check within associated database if what your have requested matching or relevant with any available component/information to send back to you. This how, for example, a clinic use chatbot to let know potential patient whether a specific schedule is available or not, or how florist inform their potential customer if any specific flower is ready in stock.</p><p>Currently, Chatbot has been evolving into something more powerful by leveraging Large Language Model (LLM). We will talk about it, but perhaps let’s put that aside for the next time😀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15bf79e61e92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python’s Agent-Based Modelling for Agriculture]]></title>
            <link>https://medium.com/@lazuardy.almuzaki/pythons-agent-based-modelling-for-agriculture-a6259081ab07?source=rss-c80d742946c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6259081ab07</guid>
            <category><![CDATA[mesa]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[agriculture]]></category>
            <category><![CDATA[agent-based-modeling]]></category>
            <category><![CDATA[modelling-and-simulation]]></category>
            <dc:creator><![CDATA[Lazuardi Al-Muzaki]]></dc:creator>
            <pubDate>Tue, 30 Jul 2024 12:21:43 GMT</pubDate>
            <atom:updated>2024-07-30T12:21:43.340Z</atom:updated>
            <content:encoded><![CDATA[<p>Chapter 1: Adopting Cellular Automata to Model Farmer’s Harvesting Behaviour Impacting Profitability</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k33SnVds3ZQlWd6nx7bVQ.png" /></figure><h3><strong>Introduction</strong></h3><p>Welcome to another series!, I love doing this you know. This time, we will cover what is famously known by Agent-Based Modelling. We will have you for several chapters, but hopefully we will discover only fun knowledge.</p><p><strong>Agent-based Modelling (ABM)</strong> is an exciting approach that, although originally emerging from the field of <em>Management Science</em>, particularly in <em>Modelling and Simulation</em>, has now been applied across many disciplines. By definition, ABM involves using computer simulations to study interactions between entities known as agents. A common objective of ABM is to observe emergent effects over time.</p><p>ABM has been instrumental in enhancing our understanding of social phenomena across various fields, from political science to medicine. For example, it can help analyze the impact of political campaigns on election outcomes or determine the most effective social interventions for flattening the COVID-19 infection curve.</p><h3>ABM for Agriculture</h3><p>For sure ABM would be a great tool for research in Agriculture, as well. The primary advantage of modeling and simulation is that it allows experimentation without real-world consequences, as we are only manipulating a model of the actual system. And Agriculture is a place where people would likely do experiments. Too many variable to consider, the farm, the weather, the working schedule, the plants, the disease, the crop, the price, you name it.</p><p>Inspired by my long ago undergraduate course assignment, I would like to recreate a basic, and hopefully also a basis, model on harvesting behaviour affecting farm productivity and most importantly its profitability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*uh7HR72KU4je7gc7ILJiMw.png" /><figcaption>snapshot of my past project doing similar stuff in Netlogo (you can find the files in my repository!)</figcaption></figure><p>The project back then was about sugar cane plant in particular, and Netlogo software was used to develop the model. This time, I would say it could be any plant thereis. And the model is built in Python leveraging Mesa package which has been quite popular in the ABM community. Thus, you could try to do your own modelling by adopting this model once you have particular plant to simulate by modifying the model variable value into the particular specification.</p><p>We will discuss how the model works shortly. Let’s get started.<br>But before we begin, I would like to let you know</p><blockquote><strong>note</strong>: all the underlying material consisting of the excel data has been provided in my Github repository <a href="https://github.com/Lazuardis/agent_based_modelling">here</a>, please read the readme file to embark. Please refer to Jupyter Notebook files I have attached there if you need more complete overview of the coding experience and insight.</blockquote><h3>Modelling ABM in Python</h3><h4>How can we model ABM for Agriculture Study Case in Python</h4><p>The following code simulates an agricultural field using a multi-agent system framework, where individual patches of land are modeled as agents, we are about to define it as <em>PatchAgents</em>. Each PatchAgent has properties such as height and sugar content and interacts with the environment (e.g., rain) and other agents. The primary model, we called it <em>FieldModel</em>, manages these agents, oversees their scheduling, and collects data on their states. This simulation allows users to experiment by adjusting different parameters to observe their effects on the system.</p><p>This model employs a concept known as Cellular Automata, a discrete computational model consisting of a regular grid of cells, each in one of a finite number of states, such as on or off. In the context of ABM, time advances in discrete units called ticks, and the simulation runs for a set number of ticks. Each grid cell represents a farm block but could represent other entities like a tree or a group of trees in different scenarios. Each agent embodies specific characteristics and methods, and these agents are arranged in a grid where each cell is connected to its neighbors, forming a complete system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*UDXWbjOGBWbkbJi8mDBYgA.png" /><figcaption>representation of cellular automaton example (<a href="https://www.researchgate.net/figure/A-cellular-automaton-consist-of-a-regular-grid-of-cells-each-containing-astate-chosen_fig1_324935995">source</a>)</figcaption></figure><blockquote><em>In our case study, we focus on a hypothetical farmer with a large farm, divided into blocks defined by their width and height. Imagine this as a sugar cane farm, with a sugar mill located at one corner, serving as the farm’s entrance and the point where buyers purchase the processed cane. The farmer aims to determine the best harvesting pattern or decision logic that would optimize income over the long term.</em></blockquote><blockquote><em>The farmer has a good understanding of the average growth rate of sugar cane and knows that the plants grow twice as fast during rainy periods. With years of farming experience, he can estimate the sugar content based on the cane’s height, which is directly related to its selling price. However, he faces a dilemma in deciding the optimal time to harvest the crop. He knows that sugar cane is suitable for harvest when it reaches a height of more than 2.4 meters but no more than 4 meters.</em></blockquote><blockquote><em>The farmer is also considering whether it is more profitable in the long term to harvest as soon as the cane reaches the minimum height or to wait until it grows optimally. Additionally, he is contemplating hiring extra help for harvesting during peak periods instead of managing it alone. He is curious if the optimal decision-making strategy would change during the rainy season, with a high probability of rain, compared to the dry summer season when rainfall is less frequent.</em></blockquote><h4>UML Conceptual Model</h4><p>The following is UML class diagram to explain the model we are about to develop. Our main library here while making the model in Python is called Mesa which able to let us model an agent-based through object-oriented approach, thus explain the reason to create the UML. If you are not familiar with UML, <a href="https://www.geeksforgeeks.org/unified-modeling-language-uml-class-diagrams/">this</a> resource will certainly help.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBZmcV2UyWv7AjyDVSUUbA.png" /><figcaption>UML Class Diagram of our about to be developed model</figcaption></figure><p>FieldModel has a one-to-many relationship with PatchAgent (composition), indicating that each FieldModel instance contains multiple PatchAgent instances.</p><p>FieldModel here is the main logic we develop, it represents all the rule of the farm, it represent the rule of harvesting by the farmers, it initialize each of PatchAgent and feed them initial attributes on the go which in this case, PatchAgent is each of the farm block.</p><p>Each PatchAgent or each farm block is a living object, they can grow, they have economical value which may based on its nutritional contents, and they can be harvested after certain height level.</p><p>To wrap FieldModel and PatchAgent in more technical terms, let’s say that they constitute <em>attributes</em> and <em>methods</em></p><h4>The Main Code (Model Framework)</h4><p>Below are the main code that effectively define the model framework</p><pre>class PatchAgent(Agent):<br>    <br>    &#39;&#39;&#39; PatchAgent class represent farm block<br>    in the model. It has sugar content, height, price at mill, and position<br>    as their attributes&#39;&#39;&#39;<br>    <br>    def __init__(self, unique_id, model):<br>        super().__init__(unique_id, model)<br>        self.sugar_content = random.uniform(0, 0.112)<br>        self.height = random.uniform(0, 2)<br>        self.price_at_mill = 0<br>        self.pos = None<br><br>    def step(self):<br>        <br>        &#39;&#39;&#39; step method is used if there is a trigger from FieldModel Class<br>        for the agents to move or do something. In this case, the agents<br>        will grow and produce sugar content based on the rain probability&#39;&#39;&#39;<br>        <br>        # a farm block or tree will grow faster if rain happens<br>        if self.model.rain &lt;= self.model.rain_probability:<br>            self.height += 0.00123 * 2<br>            self.sugar_content += 0.0000688 * 2<br>        else:<br>            self.height += 0.00123<br>            self.sugar_content += 0.0000688<br>            self.model.cashflow -= 0.3<br>            <br>        # we calculate each agent valuation or price at mill for every step<br>        self.price_at_mill = self.calculate_price_at_mill()<br><br>        # upon calculating the price at mill, we check if the agent is the best patch<br>        # and if the height is enough to be harvested<br>        # and if there is still harvesting capacity left<br>        # if all conditions are met, the agent will be harvested<br>        # and the harvesting capacity will be reduced by 1 for that iteration (step)<br>        if (self.model.best_patch == self.pos and <br>            self.height &gt;= self.model.minimum_height_to_harvest and <br>            self.model.current_harvesting_capacity &gt; 0):<br>            self.being_harvested()<br>            self.model.current_harvesting_capacity -= 1<br><br>    def calculate_price_at_mill(self):<br>        <br>        &#39;&#39;&#39; this method is used to calculate the price at mill for each agent<br>        having the model setting of grid cells. The mill is located at<br>        the bottom right of the grid. The price at mill is calculated based on<br>        the sugar content, distance to the mill, and the price of sugar per kg<br>        &#39;&#39;&#39;<br>        <br>        if self.pos is None:<br>            raise ValueError(&quot;Agent position is not set.&quot;)<br>        x1, y1 = self.pos<br>        x2, y2 = self.model.width, 0<br>        distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)<br>        price_at_mill = 14000 * (self.sugar_content * (1 - (distance * (0.6 / 16.9))))<br>        return round(price_at_mill, 2)<br><br>    def being_harvested(self):<br>        <br>        &#39;&#39;&#39; this method is used to harvest the agent if the agent is the best patch<br>        and the height is enough to be harvested. The agent will be harvested and<br>        the number of harvested will be increased by 1. The cashflow will be<br>        increased by the price at mill and decreased by 0.05 for the cost of harvesting<br>        &#39;&#39;&#39;<br>        <br>        self.height = 0<br>        self.sugar_content = 0<br>        self.model.number_harvested += 1<br>        self.model.cashflow += self.price_at_mill<br>        self.model.cashflow -= 0.05<br><br>class FieldModel(Model):<br>    <br>    &#39;&#39;&#39; <br>    The FieldModel class embody the rule of the model. We specify the grid<br>    size, the probability of rain, the minimum height to harvest, the harvesting<br>    capacity per step, and the cashflow. The model will have a grid of PatchAgent<br>    and the agents will be placed in the grid. The model will also have a schedule<br>    for the agents to step. The model will also have a datacollector to collect<br>    the data of the model and the agents.<br>    &#39;&#39;&#39;<br>    <br>    def __init__(self, width, height, minimum_height_to_harvest=2.4, harvesting_capacity_per_step=1, rain_probability=0.3):<br>        super().__init__()<br>        self.width = width<br>        self.height = height<br>        self.grid = MultiGrid(width, height, torus=False)<br>        self.schedule = RandomActivation(self)<br>        self.rain = None<br>        self.best_patch = None<br>        self.harvesting_capacity_per_step = harvesting_capacity_per_step<br>        self.number_harvested = 0<br>        self.cashflow = 1000000 #initial cashflow<br>        self.minimum_height_to_harvest = minimum_height_to_harvest<br>        self.current_harvesting_capacity = self.harvesting_capacity_per_step<br>        self.rain_probability = rain_probability<br>        <br>        # below is code to initialize agent position within the grid<br><br>        agent_id = 0<br>        for x in range(width):<br>            for y in range(height):<br>                if x == (width - 1) and y == 0:<br>                    continue<br>                <br>                a = PatchAgent(agent_id, self)<br>                self.schedule.add(a)<br>                self.grid.place_agent(a, (x, y))<br>                agent_id += 1<br>                <br>        # the following is the code to initialize the datacollector, a feature in mesa that allows the model to record outputs<br><br>        self.datacollector = DataCollector(<br>            model_reporters={&quot;Average Height&quot;: average_height, &quot;Cashflow&quot;: &quot;cashflow&quot;, &quot;Number Harvested&quot;: &quot;number_harvested&quot;},<br>            agent_reporters={&quot;Height&quot;: &quot;height&quot;}<br>        )<br><br>    def step(self):<br>        <br>        &#39;&#39;&#39; this method of FieldModel class is used to trigger the agents to step<br>        and to update the model datacollector. The model will also calculate the<br>        best patch based on the price at mill of the agents. The model will also<br>        update the rain probability for each iteration (step). The model will also<br>        check the best patch, the height of the agents, and the harvesting capacity&#39;&#39;&#39;<br>        <br>        self.rain = random.uniform(0, 1)<br>        self.best_patch = find_best_patch(self)<br>        self.datacollector.collect(self)<br>        self.schedule.step()<br>        self.current_harvesting_capacity = self.harvesting_capacity_per_step<br>        <br>def find_best_patch(model):<br>    <br>    &#39;&#39;&#39;this function is used by FieldModel to find the best patch based on the price at mill&#39;&#39;&#39;<br>    <br>    agents = model.schedule.agents<br>    max_price = -float(&#39;inf&#39;)<br>    best_patch = None<br><br>    for agent in agents:<br>        if agent.price_at_mill &gt; max_price:<br>            max_price = agent.price_at_mill<br>            best_patch = agent.pos<br><br>    return best_patch<br><br>def average_height(model):<br>    &#39;&#39;&#39; this function is used by FieldModel to calculate the average height of the agents&#39;&#39;&#39;<br>    <br>    return np.mean([agent.height for agent in model.schedule.agents])</pre><h4>Model Assumption Note:</h4><p>We have set some assumption, actually most of them are obvious throughout the main code, but some of our major note are:</p><ul><li>The simulation starts by assigning random attributes value for all patch agents, this ensure the model not need to encounter warm-up period (the time that the simulation will run before starting to collect results. This allows the Queues (and other aspects in the simulation) to get into conditions that are typical of normal running conditions in the system you are simulating). Because if we set the initial farm as it just begin planting, we would need more time to make the entire farm gradually grow. So due to random initialization, we got tall canes and short canes balanced.</li><li>calculate_price_at_mill shows how Manhattan Distance formula is used here. This is due to the nature of sugar cane that tend to have its sugar contain diminishing (perhaps because being chemically vaporized) upon being harvested. So the further we need to transport the cane to mill, the more lessen we will get the sugar contain, which value effectively defines the selling price.</li><li>The cane is growing in deterministic manner, if you think that modelling it in stochastic is more representative to your own case, please do!</li><li>The initial cashflow here are assummed too, you could change it if you want.</li></ul><h4>Code to Run the Simulation</h4><p>It is common, I believe, to have main code that define the model and the code that actually run the model separated. It is because intuitively we wlll make the code that actually run the model to be sort of experimentation dashboard, where we could set some input variables differently thus observing the difference in the output.</p><p>Please check the following. Aware that we run the model by default in 3240 ticks, this is equivalent to 1 year since our assumption is that one ticks = two hour.</p><p>As it indicates, we have several independent variable that are designed to experiment which are:</p><ul><li><strong>width and height</strong>: the size of the farm, for example if width is 10 and height is 10 then the farm size would be 10 x 10 = 100 blocks — 1 block for the mill location</li><li><strong>minimum_height_to_harvest</strong>: the model will check for every tick passed, if there’s any plant can be harvested. This value set the minimum the model, through its hypotetical harvester, the earliest they can do the harvesting.</li><li><strong>harvesting_capacity_per_step</strong>: talking about hypotetical harvester, or let’s say farmer, this variable define the capacity for each step of the harvest.</li><li><strong>rain_probability</strong>: the probability of raining to happen for each tick.</li></ul><pre># random seed set for reproducability<br>random.seed(100)<br><br><br># Input variables are set here before running the model<br><br>model = FieldModel(width=30, height=30, minimum_height_to_harvest=2.4, harvesting_capacity_per_step=1, rain_probability = 0.3)<br><br># for logic to run the model and instruct it to do step method for 3240 time<br><br>for i in range(3240):<br>    model.step()</pre><h4>Simulation Output and Result Analysis</h4><p>Please recall these lines within the main model</p><pre>self.datacollector = DataCollector(<br>model_reporters={&quot;Average Height&quot;: average_height, &quot;Cashflow&quot;: &quot;cashflow&quot;, &quot;Number Harvested&quot;: &quot;number_harvested&quot;},<br>agent_reporters={&quot;Height&quot;: &quot;height&quot;}</pre><p>Mesa datacollector has the job to records all the information throughout the simulation, for every step happening, it is recording.</p><p>And it records two kind of output, attribute value (here we called as agent_reporters) which belong to agents, and variable value (model_reporters) which belong to the model, globally.</p><p>In our example, we record attribute of height, recorded for each step, for each agent. And for the model_reporters we are interested to record the average height, cashflow fluctuation and number of cane being harvested.</p><p><strong>Histogram of Agent’s Height<br></strong>Following histogram presents the height of all agents of farm block during the last step (end simulation)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*A6LTZtRG8viX7Td7iCTLAw.png" /></figure><p>Analyzing it, we could guess that the gap in which there’s no tree between height 3 to 5 indicate that at one point the farmer would have break period of harvesting before they start again.</p><p>But do you think it will yield same pattern if we, say, increase the minimum height to harvest parameter?, it’s your time to re-run the simulation and tell me about it.</p><p><strong>Line Chart of Cashflow</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*ikr_t0EKs--imgzfJoTFew.png" /></figure><p>At first we could only the cash declining until the harvest season arrives and the line raising significantly. The moment when it begins to decline confirms our guess on prior histogram that the farmer is expected to have a break period where harvesting does not take place.</p><p><strong>Line Chart of Number of Harvest<br></strong>Basically tell more or less same idea with previous line. We could see that the harvesting period is not as productive during the very first wave but the following harvest has witnessed the farmer does not need to wait for longer period before they could harvest again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*EbsYPX5GiQzhxHtFvDII5A.png" /></figure><h4>Finishing on Chapter 1</h4><p>Yup, and that is a wrap for the very first chapter. We will discuss more about running more ‘valid’ simulation that conform the perspective of Modelling of Simulation through replication. We will discuss as well about doing significant test, and furthermore on how to deploy this simulation model into more tangible, accessible form of web apps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6259081ab07" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>