<?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 Fijaya Bimasakti on Medium]]></title>
        <description><![CDATA[Stories by Fijaya Bimasakti on Medium]]></description>
        <link>https://medium.com/@fijaya?source=rss-49271197df70------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*H57zN408vnpLJ287</url>
            <title>Stories by Fijaya Bimasakti on Medium</title>
            <link>https://medium.com/@fijaya?source=rss-49271197df70------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:34:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fijaya/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[Reconstructing Prehistory: How I Rebuilt a 6cm Micro-Avian Fossil Assemblage Using 3D Slicer and…]]></title>
            <link>https://medium.com/@fijaya/reconstructing-prehistory-how-i-rebuilt-a-6cm-micro-avian-fossil-assemblage-using-3d-slicer-and-7a21174b471d?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a21174b471d</guid>
            <category><![CDATA[paleoart]]></category>
            <category><![CDATA[fossil-reconstruction]]></category>
            <category><![CDATA[3d-modeling]]></category>
            <category><![CDATA[paleontology]]></category>
            <category><![CDATA[blender]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Sat, 16 May 2026 18:55:03 GMT</pubDate>
            <atom:updated>2026-05-16T18:55:03.554Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reconstructing Prehistory: How I Rebuilt a 6cm Micro-Avian Fossil Assemblage Using 3D Slicer and Blender</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8sOJm5Ije_BVeEaqiqm_9Q.png" /></figure><p>A deep dive into processing CT scan data, writing custom Python cleanup scripts, and biomechanical rigging with Rigify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*LOMR1D55zO9TPIusw6oSIQ.jpeg" /><figcaption>An original fossil found by my friend Mr. Carmel</figcaption></figure><p>As a 3D digital artist, you rarely expect your daily canvas to consist of millions of years of compressed geological history. But recently, I was handed a fascinating technical challenge: digitally reconstructing a highly fragmented micro-fossil assemblage from raw CT scan data.</p><p>The specimen in question is a marvel of taphonomy — a micro-scale prehistoric avian measuring just about 6 cm, found in tight spatial association with a fossilized egg and a surrounding nesting structure. Recovered from Pueblo, Colorado, the entire matrix was tightly encased within heavy ironstone and dense sediment.</p><p>While the visual payoff of a final 3D render is rewarding, the journey from raw medical data to an anatomically plausible, rigged 3D skeleton is a masterclass in data cleanup and biomechanical problem-solving. Here is how I approached the workflow.</p><h3>Phase 1: Data Extraction in 3D Slicer</h3><p>The project began with a massive stack of volumetric CT scan data. Unlike standard 3D modeling where you start with a clean topology, working with micro-fossils means fighting the surrounding geology.</p><p>Using <strong>3D Slicer</strong>, an open-source software primarily designed for medical image processing, I began the meticulous process of segmentation.</p><ul><li><strong>The Challenge:</strong> Ironstone encasement is notorious for its density. The thresholding phase required surgical precision to separate the delicate, hollow cortical bone walls of the micro-avian from the mineral-heavy matrix without eroding actual diagnostic features.</li><li><strong>The Output:</strong> Once the density thresholds were locked in, the segments were converted and exported into raw .STL files.</li></ul><blockquote>Taphonomic Note:<em> Because the fossil was heavily compressed over millennia, the axial skeleton was vastly displaced. The cervical-to-dorsal vertebrae sequence looked like a scattered puzzle within the sediment block.</em></blockquote><h3>Phase 2: Automating the Cleanup via Python in Blender</h3><p>Importing raw STL files generated from CT scans into Blender is famously a nightmare for viewport performance. The meshes are typically dense, plagued with millions of redundant vertices, non-manifold geometry, and internal floating “noise” artifacts from unseparated sediment particles.</p><p>To tackle this efficiently without destroying the fragile anatomical shapes, I avoided manual vertex hunting and instead <strong>wrote custom Python scripts</strong> within Blender to automate the optimization:</p><pre># A conceptual snippet of the cleanup approach used to target floating artifacts<br>import bpy<br>def cleanup_fossil_mesh(obj_name, distance_threshold=0.001):<br>    bpy.ops.object.select_all(action=&#39;DESELECT&#39;)<br>    obj = bpy.data.objects.get(obj_name)<br>    if obj:<br>        bpy.context.view_layer.objects.active = obj<br>        obj.select_set(True)<br>        <br>        # Switch to Edit Mode to merge doubles and clean loose geometry<br>        bpy.ops.object.mode_set(mode=&#39;EDIT&#39;)<br>        bpy.ops.mesh.select_all(action=&#39;SELECT&#39;)<br>        bpy.ops.mesh.remove_doubles(threshold=distance_threshold)<br>        bpy.ops.mesh.select_all(action=&#39;DESELECT&#39;)<br>        <br>        # Select and delete loose floating vertices/particles<br>        bpy.ops.mesh.select_loose()<br>        bpy.ops.mesh.delete(type=&#39;VERT&#39;)<br>        bpy.ops.object.mode_set(mode=&#39;OBJECT&#39;)<br># Automated cleanup applied to the fragmented avian STL data</pre><p>By leveraging Python, I successfully downsampled the polygon count while preserving critical diagnostic markers — such as the delicate curvature of the <em>furcula</em> (wishbone), the tiny <em>pygostyle</em>, and the complex structure of the pelvic region.</p><h3>Phase 3: Biomechanical Alignment and Rigging with Rigify</h3><p>Once the individual bone elements were isolated and cleaned, the biggest scientific question arose: <strong>How did this animal actually sit or pose in its natural biomechanical state before fossilization?</strong></p><p>Because the cervical and dorsal vertebrae were displaced, I couldn’t rely on the fossil’s current state for anatomical positioning. I needed to manually re-align the structural skeleton.</p><p>To make the postural adjustments grounded in realistic physics and biology, I implemented Blender’s <strong>Rigify</strong> system.</p><ul><li><strong>Bone Parentage:</strong> I built a custom armature tailored to avian proportions, treating the fragmented axial skeleton segments as independent rigid bodies bound to a functional kinematic chain.</li><li><strong>Inverse Kinematics (IK):</strong> By setting up IK constraints on the neck and limbs, I was able to test the limits of the joints. This allowed me to find a natural, biomechanically plausible posture where the transitional alignment from the neck to the back didn’t overextend or clip the reconstructed bones.</li><li><strong>Contextual Composition:</strong> Finally, the reconstructed bird skeleton was posed alongside the quarter-sized fossilized egg and the surrounding nest matrix to analyze their spatial relationships.</li></ul><h3>The Intersection of Science and 3D Art</h3><p>Projects like this highlight the changing landscape of paleo-reconstruction. Moving away from traditional sketches, the integration of tools like 3D Slicer for CT analysis, Python for data handling, and Blender for rigging allows digital artists to collaborate directly with scientific data.</p><p>Through this workflow, we aren’t just creating a cool creature render; we are reversing the chaotic effects of geological time, piece by piece, bone by bone.</p><p>Here’s complete video about the full reconstruction process</p><p><a href="https://www.youtube.com/playlist?list=PLFferhnu23cVeyXb694kcHOSltdfIKGur">https://www.youtube.com/playlist?list=PLFferhnu23cVeyXb694kcHOSltdfIKGur</a></p><p><strong>Are you working on scientific or medical reconstructions in Blender?</strong></p><p>I’d love to hear your thoughts on minimizing reconstruction bias when handling highly fragmented data. Drop a comment below or connect with me to discuss workflows!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a21174b471d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kuliah itu scam]]></title>
            <link>https://medium.com/@fijaya/kuliah-itu-scam-ebb131329641?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebb131329641</guid>
            <category><![CDATA[pendidikan]]></category>
            <category><![CDATA[pendidikan-indonesia]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 08:00:13 GMT</pubDate>
            <atom:updated>2026-01-05T08:00:13.143Z</atom:updated>
            <content:encoded><![CDATA[<p>‎Kuliah bisa menjadi scam selama orientasinya ke &quot;uang&quot;. Mengapa demikian? Karena pendidikan belum menjadi prioritas utama di negara ini.</p><p>Tak heran jika banyak PT berdiri, tetapi hanya segelintir yang benar-benar berkualitas. Izin pendirian PT relatif mudah: cukup menjanjikan lulusan S2 fresh graduate untuk “meminjam” ijazah mereka. Setelah PT berdiri, para lulusan ini kerap dijadikan tenaga pengajar dengan gaji tidak layak. Pada tahap awal, mahasiswa diterima tanpa seleksi ketat yang penting SPP masuk. Silabus perkuliahan pun sering kali tidak relevan dengan jurusan yang ditempuh, sehingga materi yang diajarkan tidak membangun kompetensi yang semestinya. Akibatnya, kompetensi lulusan PT semacam ini tidak jauh berbeda dengan lulusan SMA, SMK, dan peserta bootcamp yang menjamur dan justru lebih siap secara praktis.‎<br>Mahasiswa kuliah dengan harapan setelah lulus bisa mencari penghasilan layak, sementara banyak penyelenggara PT berfokus meraup keuntungan sebesar-besarnya. ‎Di luar negeri, hampir semua jurusan kuliah memiliki relevansi dan manfaat yang jelas. Di Indonesia, banyak lowongan kerja justru tidak sesuai dengan latar belakang pendidikan. Lebih ironis lagi, pendidikan bisa “dibeli” tanpa benar-benar kuliah: skripsi, tesis, dan disertasi dapat dikerjakan joki, bahkan ijazah bisa dipalsukan.<br>‎Masalah lain terletak pada kualitas tenaga pendidik. Sistem terima dosen yang jelek dari PT yang jelek. Keilmuan sebagai dosen tidak ada, hanya ilmu senioritas yang tinggi, tidak paham esensi &quot;membimbing skripsi&quot;.</p><p>Akar persoalannya jelas: pendidikan di Indonesia lebih berorientasi pada uang daripada ilmu.</p><p>Kesimpulan:<br>Kuliah scam jika kamu salah pilih PT dan salah jurusan karna pendidikan di Indo masih berorientasi pada uang, masalah lebih detail:</p><p>1. Banyak PT sedikit yang berkualitas</p><p>2. Sistem penerimaan dosen yang ngasal</p><p>3. Sistem penerimaan mahasiswa yang ngasal</p><p>4. Tugas akhir dan ijazah bisa dibeli</p><p>5. Career path jurusan yang tidak sesuai</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebb131329641" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Artists Don’t Trust AI (And Why They Have a Point)]]></title>
            <link>https://medium.com/@fijaya/why-artists-dont-trust-ai-and-why-they-have-a-point-007de5e5ac45?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/007de5e5ac45</guid>
            <category><![CDATA[artifical-intellegence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[artificial]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 09:53:59 GMT</pubDate>
            <atom:updated>2025-12-10T09:53:59.475Z</atom:updated>
            <content:encoded><![CDATA[<p>A lot of people still don’t get why so many artists are uncomfortable with AI. It’s not just about “being afraid of technology”, “art without soul”, or “losing jobs.” <strong>The real root of the problem is copyright.</strong></p><p>In countries like low-class country, the issue gets even worse because we were never taught to respect copyright in the first place. We grow up thinking it’s normal to download cracked software, use music without permission, take images from Pinterest, tweak them a little, and start selling products. This culture of “just grab it” has been around for a long time. And when AI shows up? It amplifies the problem.</p><p><strong>So why does AI clash with copyright law? </strong>To understand that, you need to know <em>how AI works.</em></p><p>AI models are trained on massive datasets containing millions — even billions — of images from the internet. Many of those images are copyrighted artworks.</p><p>The big problem is:</p><ul><li>Artists were <strong>never asked for permission</strong></li><li>Artists were <strong>never compensated</strong></li><li>Their work is still <strong>used to train AI</strong></li></ul><p>This process is called <em>data scraping. </em>Think about it: how does AI know what a wolf looks like? What water looks like? How can it mimic Van Gogh’s style, or anime style, or cartoon style?</p><p>Because the model learned from the visual data it was fed. And that data includes real artworks by real artists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*empw5GdJmE8xP6M1.jpg" /><figcaption><a href="https://knightlifenews.com/">https://knightlifenews.com/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vcGa0WIaY685ZAxl" /><figcaption><a href="https://cdn.climbing.com/">https://cdn.climbing.com/</a></figcaption></figure><p>That’s why many artists say:</p><blockquote><em>“AI is copying my style without my consent.”</em></blockquote><p>And yes — there are countless cases showing exactly that.</p><p>I still remember the early DALL·E era when “AI artist communities” popped up everywhere, and some people even started selling “AI art classes.” Meanwhile, the original artists whose work was used to train these models didn’t get anything in return.</p><p>This is also why many design competitions prohibit AI-generated submissions. Though let’s be honest… judges often can’t even tell which ones are AI-made 😅</p><p>But the key point is:<br><strong>This isn’t just artists vs technology.</strong><br>It’s about <em>ethics, copyright, and the unauthorized use of someone’s creative work.</em></p><p>Share this so more people can understand the real issue behind the controversy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=007de5e5ac45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pengetahuan Dasar UI/UX]]></title>
            <link>https://medium.com/@fijaya/pengetahuan-dasar-ui-ux-f116d29c5da5?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/f116d29c5da5</guid>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Sat, 21 Dec 2024 02:51:05 GMT</pubDate>
            <atom:updated>2024-12-21T02:51:05.936Z</atom:updated>
            <content:encoded><![CDATA[<p>Manakah yang bukan merupakan tips untuk menulis ux writing yang baik ? a. Riset audiens dan eksplorasi tindakan yang mereka maksudkan<br>b. Sejelas mungkin yang kamu bisa<br>c. Hindari, jelaskan, and selesaikan error nya<br><strong>d. Pilih kata-kata yang daerah tertentu</strong></p><p>Alasan:<br>UX writing yang baik bertujuan untuk menciptakan pengalaman yang jelas, inklusif, dan mudah dipahami oleh semua pengguna, bukan hanya untuk wilayah tertentu. Kata-kata yang terlalu spesifik untuk daerah tertentu dapat membingungkan audiens global dan mengurangi aksesibilitas.</p><p>Apa yang dimaksud dengan “Convention over Configuration” dalam “Don’t Make Me Think” karya Steven Krug?</p><p>a. <strong>Menggunakan elemen desain yang sudah familiar bagi user<br></strong>b. Menambahkan fitur yang tidak diperlukan pada website<br>c. Menggunakan desain yang tidak biasa untuk menarik perhatian user<br>d. Menghilangkan fitur yang dianggap tidak penting<br><br>“Convention over Configuration” dalam konteks buku <em>Don’t Make Me Think</em> karya Steven Krug berarti menggunakan elemen atau pola desain yang sudah umum dan dikenali oleh pengguna. Dengan cara ini, pengguna tidak perlu berpikir keras untuk memahami cara menggunakan situs atau aplikasi, karena desainnya konsisten dengan harapan mereka berdasarkan pengalaman sebelumnya. Hal ini membantu menciptakan pengalaman yang intuitif dan efisien.</p><p>Bagaimana cara untuk menambahkan elemen baru pada desain di Figma? a. Klik pada tombol “Add Element” di toolbar<br>b. Tekan tombol “Ctrl” + “E”<br>c. Klik kanan pada desain dan pilih “Add Element”<br><strong>d. Tekan tombol “Shift” + “A”</strong><br>Di Figma, menekan <strong>“Shift + A”</strong> digunakan untuk membuat <strong>Auto Layout</strong>, yang sering menjadi langkah awal untuk menambahkan elemen baru dalam desain dengan tata letak yang terorganisir. Namun, jika Anda ingin menambahkan elemen seperti bentuk, teks, atau lainnya, Anda dapat menggunakan toolbar atau shortcut lain, seperti:</p><ul><li><strong>R</strong> untuk Rectangle.</li><li><strong>T</strong> untuk Text.</li><li><strong>L</strong> untuk Line.</li></ul><p>Figma tidak memiliki tombol khusus bernama “Add Element.”</p><p>Apa perbedaan antara Voice dan Tone dalam UX Writing? <br>a. Voice adalah tingkat formalitas dalam komunikasi, sedangkan Tone adalah konsistensi dalam komunikasi. <br>b.Voice dan Tone sama-sama adalah cara produk atau perusahaan berkomunikasi dengan pengguna. <br>c. Voice lebih ke pilihan kata yang konsisten, dan dapat dikenali di seluruh pengalaman nya. <br><strong>d. Tone mengarah ke variasi dalam suara (voice) dari satu bagian pengalaman ke bagian yang lain.</strong></p><ul><li><strong>Voice</strong>: Merujuk pada kepribadian atau identitas komunikasi dari suatu produk atau perusahaan yang konsisten di seluruh pengalaman pengguna. Ini adalah “karakter” dari komunikasi tersebut.</li><li><strong>Tone</strong>: Merujuk pada cara penyampaian Voice yang dapat bervariasi tergantung pada konteks, situasi, atau emosi yang ingin disampaikan dalam bagian tertentu dari pengalaman pengguna.</li></ul><p>Misalnya, sebuah aplikasi perbankan mungkin memiliki Voice yang profesional dan terpercaya, tetapi Tone-nya bisa lebih ramah saat memberikan ucapan selamat, atau lebih serius saat membahas masalah keamanan akun.</p><p>Fungsi dari user research dalam proses desain website ada<br><strong>a. Menentukan target audience </strong><br>b. Menentukan warna dan font yang digunakan <br>c. Menentukan layout website <br>d. Menentukan fitur-fitur website<br>User research berfungsi untuk memahami kebutuhan, perilaku, dan preferensi pengguna sehingga desainer dapat menciptakan pengalaman yang relevan dan efektif. Langkah ini membantu mengidentifikasi <strong>target audience</strong> dan memberikan wawasan tentang bagaimana desain (termasuk fitur, layout, warna, dan font) dapat memenuhi kebutuhan pengguna dengan lebih baik.</p><p>Namun, keputusan seperti warna, font, layout, atau fitur biasanya dilakukan setelah analisis data dari user research.</p><p>Apakah portofolio dalam desain UI/UX harus dibuat menggunakan software tertentu? <br>a. Ya, harus menggunakan software Adobe XD atau Sketch <br>b. Ya, harus menggunakan software Figma atau InVision <br><strong>c. Tidak, portofolio dapat dibuat menggunakan software apapun yang sesuai dengan kebutuhan </strong><br>d. Tidak, portofolio harus dibuat menggunakan software yang ditentukan oleh perusahaan</p><p>Portofolio dalam desain UI/UX tidak harus dibuat dengan software tertentu. Yang paling penting adalah portofolio tersebut mampu menampilkan kemampuan, proses berpikir, dan hasil kerja Anda dengan jelas dan profesional. Software seperti Figma, Adobe XD, Sketch, atau bahkan alat presentasi seperti PowerPoint atau situs web pribadi semuanya dapat digunakan, tergantung pada preferensi dan kenyamanan Anda.</p><p>Perusahaan biasanya lebih tertarik pada isi portofolio, seperti kualitas desain, pemahaman proses, dan solusi yang ditawarkan, daripada software yang digunakan untuk membuatnya.</p><p>Bagaimana cara meningkatkan efektivitas navigasi dalam website menurut “Don’t Make Me Think” karya Steven Krug? <br>a.Menambahkan fitur navigasi yang tidak diperlukan <br><strong>b.Menyederhanakan struktur navigasi </strong><br>c.Menambahkan efek animasi pada navigasi <br>d.Menambahkan fitur navigasi yang kompleks</p><p>Dalam <em>“Don’t Make Me Think”</em> karya Steven Krug, salah satu prinsip utama adalah membuat pengalaman pengguna menjadi intuitif dan mudah. Menyederhanakan struktur navigasi membantu pengguna menemukan apa yang mereka cari tanpa kebingungan. Navigasi yang efektif harus:</p><ul><li><strong>Jelas</strong>: Label menu mudah dipahami.</li><li><strong>Konsisten</strong>: Struktur dan penempatan navigasi sama di seluruh halaman.</li><li><strong>Efisien</strong>: Meminimalkan jumlah klik yang diperlukan untuk mencapai tujuan.</li></ul><p>Menambahkan fitur atau efek yang tidak perlu justru dapat membingungkan dan mengganggu pengalaman pengguna.</p><p>imak arti dari tiap istilah UI UX di sini:</p><ol><li>UI (User Interface): UI adalah segala sesuatu yang berkaitan dengan tampilan dan antarmuka pengguna dalam sebuah aplikasi atau situs web.</li><li>UX (User Experience): UX adalah pengalaman keseluruhan pengguna saat berinteraksi dengan produk atau layanan, mencakup tampilan, interaksi, dan emosi.</li><li>Wireframe: Gambaran kasar atau sketsa dari antarmuka pengguna yang digunakan untuk merencanakan tata letak.</li><li>Prototipe: Model interaktif dari desain produk yang membantu dalam pengujian dan pengembangan.</li><li>User Persona: Representasi karakteristik dan kebutuhan pengguna yang membantu dalam perancangan berdasarkan pengguna.</li><li>A/B Testing: Uji perbandingan dua versi desain atau elemen dalam produk untuk menentukan yang lebih efektif.</li><li>Kepuasan Pengguna: Ukuran kepuasan pengguna terhadap pengalaman yang diberikan oleh produk.</li><li>Usability Testing: Proses pengujian produk dengan pengguna untuk mengidentifikasi masalah dalam antarmuka pengguna.</li><li>Affordance: Kemampuan produk memberikan petunjuk tentang cara menggunakannya.</li><li>Heuristic Evaluation: Penilaian antarmuka pengguna oleh para ahli untuk mengidentifikasi masalah potensial.</li><li>Gamifikasi (Gamification): Penggunaan elemen permainan dalam desain untuk meningkatkan keterlibatan pengguna.</li><li>Landing Page: Halaman pertama yang dilihat oleh pengunjung saat mengakses situs web.</li><li>Conversion Rate: Persentase pengunjung yang melakukan tindakan tertentu, seperti membeli produk atau mendaftar.</li><li>Micro Interaksi: Animasi atau respons kecil yang meningkatkan pengalaman pengguna.</li><li>Accessibility: Kualitas produk yang memungkinkan akses dan penggunaan oleh semua orang, termasukkan mereka dengan disabilitas.</li><li>Visual Hierarchy: Penekanan berdasarkan urutan pentingnya elemen dalam desain.</li><li>Konsistensi Desain (Design Consistency): Mempertahankan elemen desain yang seragam di seluruh produk.</li><li>Mobile-First Design: Pendekatan desain yang memprioritaskan UX di perangkat seluler.</li><li>User Flow: Langkah-langkah yang diambil oleh pengguna saat berinteraksi dengan produk.</li><li>Sitemap: Diagram struktur situs web yang menunjukkan hubungan antara halaman.</li><li>Design Lo-Fi: design kasar yang menunjukan layout dan konsep dasar dari produk yang akan didesain</li><li>Design Hi-Fi: design tahap lanjutan yang sudah menggambarkan interface lengkap dengan elemen visual dan interaktivitas</li><li>F-Pattern ini adalah salah satu pola ketika pembaca memindai sebuah konten. F bisa berarti pola yang dibentuk dan bisa juga bermakna “<strong>fast</strong>” atau “<strong>cepat</strong>” dimana pengguna merasa lebih cepat mendapatkan informasi ketika menerapkan pola ini.</li><li><strong>Voice </strong>Menunjukkan identitas brand yang mudah dikenali. Voice yang konsisten dapat membantu membangun identitas brand.</li><li><strong>Tone </strong>Menunjukkan cara menyampaikan pesan yang sesuai dengan situasi. Tone yang fleksibel dapat memastikan pesan disampaikan dengan cara yang tepat.</li><li>Visual Hierarki:</li></ol><ul><li>Color (warna yang cerah lebih menarik perhatian daripada yang redup)</li><li>Contrast (pemilihan warna berbeda sehingga salah satunya lebih eye-catching)</li><li>Alignment (kalimat judul yang berada diluar paragraf akan lebih menonjol untuk dibaca daripada isi yang tersusun dalam sebuah paragraf)</li><li>Repetition (pengulangan gaya visual dapat memberikan sugesti kalau infomasinya berkaitan)</li><li>Proximity (peletakan konten secara berdekatan dapat memberikan sugesti kalau infomasinya berkaitan)</li><li>Whitespace (lebih banyak ruang kosong dalam suatu elemen membuatnya mudah jadi perhatian)</li><li>Texture &amp; style (lebih banyak detail membuat suatu elemen lebih menarik perhatian)</li></ul><p><a href="https://www.binar.co.id/blog/20-istilah-ui-ux-yang-paling-banyak-digunakan-di-pekerjaan">20+ Istilah UI UX yang Paling Banyak Digunakan di Pekerjaan</a></p><p><a href="https://latifaska.medium.com/f-pattern-cara-pengguna-memindai-mikrokopi-9fedbc93571e">https://latifaska.medium.com/f-pattern-cara-pengguna-memindai-mikrokopi-9fedbc93571e</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f116d29c5da5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forgiving Regular Expressions (RegEx)]]></title>
            <link>https://medium.com/@fijaya/forgiving-regular-expressions-regex-3d0c951402c0?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d0c951402c0</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[regex]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Sun, 01 Oct 2023 16:15:31 GMT</pubDate>
            <atom:updated>2023-10-01T16:15:31.493Z</atom:updated>
            <content:encoded><![CDATA[<h4>a journey to find the inner peace by understanding the regex</h4><blockquote>“Which one is more difficult, understanding woman or regex formula?” — Fijaya (some random IT guy)</blockquote><p>So, in one beautiful day I try to ruining myself with some programming challenge. And I met this, “Find Users With Valid E-Mails” problem. My toxic trait is thinking I can solve that problem. But, after read more detail, the rules aren’t simple from what I’ve thought. And the worst part is I must dealing again with something that I hate, yes the RegEx. I hate RegEx because it is like demonic summoning sigil things, hard to read and hard to write. I am sure when you crave regex code in some stone, people will things it was written by aliens.</p><p>I am doing all the best I can do, from writing, changing, removing the structure of my code, trial and error, searching on internet, and the funny part by asking ChatAI, but this ChatAI even can’t help me:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RCOlBXS-YhPAJukRNKVeFQ.png" /><figcaption>chatAI got confused</figcaption></figure><p>My code can validate all email but I am stuck with this problem, how to detect one letter email, let’s say the email is:</p><pre>B@gmail.com</pre><p>And my code is:</p><pre>import pandas as pd<br>def valid_emails(users: pd.DataFrame) -&gt; pd.DataFrame:<br>    users[&#39;mail&#39;] = users[&#39;mail&#39;].str.extract<br>    (r&#39;(^[a-zA-Z]+[_.a-zA-Z0-9-]+@gmail\.com$)&#39;)<br>    df = users.dropna()<br>    df<br>    return df</pre><p>The code above can’t detect email with just one letter. I have trying to split the code into two part, the username part and domain part, using str.split() like below, but it won’t work:</p><pre>def valid_emails(users: pd.DataFrame) -&gt; pd.DataFrame:<br>    #copy the original df<br>    users2 = users.copy()<br>    <br>    #split the mail column and expands it to mail for username and domain for domain<br>    users2[[&#39;mail&#39;,&#39;domain&#39;]] = users[&#39;mail&#39;].str.split(r&#39;\b@gmail\b&#39;, expand=True)<br>    <br>    #because split delete the @gmail part in domain, so I adding it again to domain<br>    users2[&#39;domain&#39;] = &#39;@gmail&#39; +  users2[&#39;domain&#39;].astype(str)<br><br>...</pre><p>Finally I met Khosiyat’s article (<a href="https://leetcode.com/Khosiyat/">https://leetcode.com/Khosiyat/</a> ) to solve this problem. Lookin back to my first code, I was wrong in formulates the regex. The difference, between my formula and Khosiyat’s formula:</p><pre>#mine<br>(r&#39;(^[a-zA-Z]+[_.a-zA-Z0-9-]+@gmail\.com$)&#39;)<br> <br>#Khosiyat&#39;s<br>(r&#39;(^[A-Za-z][A-Za-z0-9_.-]*@gmail\.com)&#39;)</pre><p>See the differences? I am adding + and $. Just these two symbols, made me battling with regex for about two days haha. Once I had figured it out the function of character by character, it was easy peasy to use the regex. So, let me examine the expression used here and explain more expression that I know:</p><ul><li>^[ ] : first part of phrase</li><li>( ) : is a grouped set that is used to keep or store separators along with the word characters.</li><li>[ ] : is used to match a set of characters within the string</li><li>[^.] : is used to return a match for any character EXCEPT dot. Please take notes, “^[ ]” is different with “[^ ]”</li><li>[A-Za-z0–9_.-] : detect capital letter, small letter, number, underscore, dot, line. We put line at the end because line is special character.</li><li>a+ : Matches one or more consecutive ‘a’ characters.</li><li>a*: Matches zero or more consecutive ‘a’ characters</li><li>@gmail : search for this word</li><li>\.com : search for the dot com. We use \ to separate the dot because dot is special character.</li><li>$ : end of phrase</li></ul><p>To learn more about regex you can check this link <a href="https://regex101.com/">https://regex101.com/</a></p><h3><strong>Conclusion</strong></h3><p><strong>Stop hating and start learning</strong>. Keep grinding and challenge yourself. Always see good in all things. Sometimes, regex so usefull when the data provided to you is present in multiple files, with some of the columns present in more than one of the files. At first, I tend to think regular expressions are hard; but that’s <strong>because I am using them wrong</strong>.</p><p>Reference:</p><ol><li><a href="https://stackoverflow.com/questions/30194831/python-regex-email-address">https://stackoverflow.com/questions/30194831/python-regex-email-address</a></li><li><a href="https://www.datacamp.com/tutorial/joining-dataframes-pandas">https://www.datacamp.com/tutorial/joining-dataframes-pandas</a></li><li><a href="https://chat.openai.com/">https://chat.openai.com/</a></li><li><a href="https://blog.finxter.com/how-to-split-a-string-and-keep-the-separators/">https://blog.finxter.com/how-to-split-a-string-and-keep-the-separators/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d0c951402c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make Dataframe From Raw Text of Data]]></title>
            <link>https://medium.com/@fijaya/make-dataframe-from-raw-text-of-data-84c1492cb670?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/84c1492cb670</guid>
            <category><![CDATA[text]]></category>
            <category><![CDATA[raw-data]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[copypaste]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Fri, 29 Sep 2023 09:27:52 GMT</pubDate>
            <atom:updated>2023-09-29T09:27:52.962Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s say I need this data, I’ve got this from Leetcode:</p><pre>| article_id | author_id | viewer_id | view_date  |<br>| ---------- | --------- | --------- | ---------- |<br>| 126        | 17        | 62        | 2019-07-02 |<br>| 149        | 42        | 22        | 2019-06-23 |<br>| 138        | 39        | 33        | 2019-07-26 |<br>| 165        | 42        | 74        | 2019-07-05 |<br>| 48         | 95        | 91        | 2019-06-28 |<br>| 151        | 30        | 19        | 2019-06-22 |<br>| 195        | 76        | 65        | 2019-07-24 |<br>| 67         | 4         | 91        | 2019-06-01 |<br>| 91         | 55        | 13        | 2019-07-11 |<br>| 126        | 17        | 77        | 2019-06-14 |<br>| 142        | 38        | 100       | 2019-07-07 |<br>| 148        | 63        | 48        | 2019-07-21 |<br>| 156        | 24        | 8         | 2019-07-29 |<br>| 63         | 73        | 30        | 2019-06-16 |<br>| 32         | 93        | 66        | 2019-07-23 |<br>| 143        | 10        | 38        | 2019-07-31 |<br>| 171        | 82        | 2         | 2019-07-25 |<br>| 88         | 61        | 67        | 2019-07-02 |<br>| 40         | 92        | 67        | 2019-06-03 |<br>| 23         | 18        | 39        | 2019-07-20 |<br>| 51         | 41        | 10        | 2019-07-17 |<br>| 76         | 10        | 65        | 2019-07-13 |<br>| 123        | 50        | 23        | 2019-07-06 |<br>| 77         | 76        | 1         | 2019-07-02 |<br>| 176        | 25        | 39        | 2019-06-01 |<br>| 4          | 34        | 100       | 2019-06-26 |<br>| 175        | 82        | 48        | 2019-06-04 |<br>| 109        | 47        | 65        | 2019-07-19 |<br>| 168        | 67        | 46        | 2019-07-12 |<br>| 129        | 49        | 74        | 2019-06-09 |<br>| 162        | 60        | 89        | 2019-06-18 |<br>| 40         | 92        | 24        | 2019-07-21 |<br>| 108        | 19        | 17        | 2019-07-27 |<br>| 68         | 83        | 19        | 2019-06-21 |<br>| 22         | 62        | 26        | 2019-07-29 |<br>| 190        | 9         | 13        | 2019-06-22 |<br>| 50         | 57        | 95        | 2019-06-21 |<br>| 47         | 49        | 29        | 2019-06-05 |<br>| 155        | 29        | 87        | 2019-06-25 |<br>| 158        | 25        | 57        | 2019-07-14 |<br>| 101        | 24        | 7         | 2019-07-24 |<br>| 189        | 43        | 40        | 2019-07-21 |<br>| 148        | 63        | 49        | 2019-06-18 |<br>| 150        | 75        | 73        | 2019-06-27 |<br>| 11         | 53        | 56        | 2019-07-11 |<br>| 131        | 65        | 70        | 2019-06-10 |<br>| 124        | 21        | 25        | 2019-07-12 |<br>| 80         | 8         | 33        | 2019-06-05 |<br>| 129        | 49        | 81        | 2019-08-01 |<br>| 172        | 2         | 33        | 2019-06-23 |<br>| 21         | 3         | 63        | 2019-07-31 |<br>| 104        | 97        | 92        | 2019-07-25 |<br>| 46         | 81        | 8         | 2019-06-13 |<br>| 169        | 30        | 50        | 2019-06-12 |<br>| 70         | 93        | 59        | 2019-06-01 |<br>| 7          | 15        | 73        | 2019-06-25 |<br>| 146        | 53        | 9         | 2019-07-07 |<br>| 114        | 83        | 67        | 2019-06-16 |<br>| 32         | 93        | 78        | 2019-07-20 |<br>| 18         | 7         | 47        | 2019-07-17 |<br>| 78         | 87        | 92        | 2019-07-13 |<br>| 39         | 93        | 62        | 2019-07-14 |<br>| 180        | 43        | 8         | 2019-06-27 |<br>| 105        | 81        | 45        | 2019-07-10 |<br>| 184        | 7         | 56        | 2019-07-16 |<br>| 58         | 93        | 58        | 2019-07-27 |<br>| 176        | 25        | 40        | 2019-07-23 |<br>| 48         | 95        | 71        | 2019-07-17 |<br>| 186        | 28        | 70        | 2019-06-14 |<br>| 85         | 74        | 46        | 2019-07-03 |<br>| 132        | 4         | 49        | 2019-06-24 |<br>| 103        | 11        | 84        | 2019-06-15 |<br>| 56         | 11        | 63        | 2019-06-07 |<br>| 111        | 71        | 51        | 2019-07-07 |<br>| 2          | 47        | 27        | 2019-07-22 |<br>| 133        | 40        | 85        | 2019-06-02 |<br>| 23         | 18        | 3         | 2019-07-07 |<br>| 130        | 2         | 19        | 2019-07-06 |<br>| 142        | 38        | 90        | 2019-07-06 |<br>| 133        | 40        | 1         | 2019-07-20 |<br>| 131        | 65        | 64        | 2019-07-26 |<br>| 15         | 37        | 21        | 2019-07-27 |<br>| 111        | 71        | 68        | 2019-06-16 |<br>| 84         | 48        | 70        | 2019-07-08 |<br>| 133        | 40        | 14        | 2019-06-13 |<br>| 31         | 85        | 80        | 2019-06-01 |<br>| 183        | 13        | 87        | 2019-07-16 |<br>| 114        | 83        | 58        | 2019-06-08 |<br>| 40         | 92        | 87        | 2019-07-08 |<br>| 122        | 36        | 94        | 2019-07-02 |<br>| 135        | 96        | 47        | 2019-07-26 |<br>| 96         | 92        | 73        | 2019-06-22 |<br>| 97         | 23        | 14        | 2019-06-11 |<br>| 83         | 74        | 85        | 2019-07-20 |<br>| 143        | 10        | 2         | 2019-06-08 |<br>| 193        | 85        | 91        | 2019-06-22 |<br>| 56         | 11        | 55        | 2019-06-25 |<br>| 20         | 19        | 75        | 2019-07-19 |<br>| 70         | 93        | 36        | 2019-07-01 |<br>| 168        | 67        | 22        | 2019-06-06 |<br>| 71         | 27        | 45        | 2019-06-14 |<br>| 176        | 25        | 92        | 2019-06-05 |<br>| 198        | 40        | 96        | 2019-07-08 |<br>| 168        | 67        | 51        | 2019-07-28 |<br>| 78         | 87        | 5         | 2019-07-18 |<br>| 154        | 3         | 12        | 2019-06-19 |<br>| 168        | 67        | 18        | 2019-06-26 |<br>| 67         | 4         | 37        | 2019-06-10 |<br>| 173        | 73        | 18        | 2019-06-22 |<br>| 162        | 60        | 83        | 2019-07-24 |<br>| 37         | 83        | 36        | 2019-07-26 |<br>| 127        | 19        | 88        | 2019-07-26 |<br>| 199        | 71        | 67        | 2019-07-06 |<br>| 12         | 34        | 2         | 2019-06-22 |<br>| 45         | 16        | 63        | 2019-06-19 |<br>| 139        | 29        | 37        | 2019-07-30 |<br>| 179        | 64        | 65        | 2019-07-02 |<br>| 9          | 55        | 2         | 2019-06-20 |<br>| 16         | 94        | 81        | 2019-07-08 |<br>| 66         | 32        | 35        | 2019-07-19 |<br>| 168        | 67        | 90        | 2019-07-08 |<br>| 147        | 99        | 60        | 2019-06-17 |<br>| 42         | 7         | 63        | 2019-07-18 |<br>| 18         | 7         | 79        | 2019-07-06 |<br>| 113        | 61        | 3         | 2019-07-24 |<br>| 129        | 49        | 80        | 2019-06-07 |<br>| 51         | 41        | 44        | 2019-07-18 |<br>| 102        | 48        | 96        | 2019-07-24 |<br>| 122        | 36        | 80        | 2019-07-16 |<br>| 193        | 85        | 87        | 2019-07-24 |<br>| 16         | 94        | 32        | 2019-07-01 |<br>| 20         | 19        | 45        | 2019-07-09 |<br>| 172        | 2         | 84        | 2019-06-15 |<br>| 87         | 60        | 60        | 2019-07-16 |<br>| 24         | 43        | 69        | 2019-07-30 |<br>| 57         | 57        | 11        | 2019-06-29 |<br>| 72         | 43        | 5         | 2019-06-06 |<br>| 173        | 73        | 45        | 2019-07-31 |<br>| 156        | 24        | 22        | 2019-06-21 |<br>| 130        | 2         | 43        | 2019-06-24 |<br>| 111        | 71        | 71        | 2019-06-23 |<br>| 12         | 34        | 13        | 2019-06-22 |<br>| 115        | 89        | 78        | 2019-06-28 |<br>| 12         | 34        | 31        | 2019-06-06 |<br>| 1          | 67        | 74        | 2019-07-23 |<br>| 93         | 98        | 41        | 2019-07-17 |<br>| 94         | 50        | 65        | 2019-07-03 |<br>| 50         | 57        | 25        | 2019-07-09 |<br>| 165        | 42        | 79        | 2019-07-01 |<br>| 37         | 83        | 51        | 2019-07-28 |<br>| 148        | 63        | 77        | 2019-07-09 |<br>| 119        | 72        | 5         | 2019-07-22 |<br>| 97         | 23        | 24        | 2019-06-13 |<br>| 133        | 40        | 95        | 2019-07-07 |<br>| 37         | 83        | 60        | 2019-07-13 |<br>| 110        | 48        | 97        | 2019-07-28 |<br>| 23         | 18        | 66        | 2019-06-22 |<br>| 183        | 13        | 25        | 2019-07-27 |<br>| 47         | 49        | 10        | 2019-06-03 |<br>| 83         | 74        | 57        | 2019-06-07 |<br>| 58         | 93        | 66        | 2019-06-30 |<br>| 193        | 85        | 93        | 2019-06-09 |<br>| 144        | 66        | 7         | 2019-06-07 |<br>| 192        | 10        | 100       | 2019-06-23 |<br>| 158        | 25        | 48        | 2019-07-04 |<br>| 125        | 76        | 72        | 2019-06-21 |<br>| 4          | 34        | 7         | 2019-07-02 |<br>| 19         | 78        | 5         | 2019-07-18 |<br>| 164        | 51        | 69        | 2019-07-04 |<br>| 9          | 55        | 35        | 2019-07-26 |<br>| 127        | 19        | 34        | 2019-06-04 |<br>| 133        | 40        | 65        | 2019-07-07 |<br>| 107        | 90        | 30        | 2019-06-28 |<br>| 173        | 73        | 96        | 2019-06-10 |<br>| 118        | 43        | 20        | 2019-06-27 |<br>| 141        | 15        | 69        | 2019-06-30 |<br>| 75         | 100       | 35        | 2019-08-01 |<br>| 141        | 15        | 35        | 2019-06-01 |<br>| 183        | 13        | 27        | 2019-06-21 |<br>| 131        | 65        | 33        | 2019-06-07 |<br>| 75         | 100       | 89        | 2019-06-02 |<br>| 104        | 97        | 61        | 2019-07-21 |<br>| 126        | 17        | 33        | 2019-06-22 |<br>| 50         | 57        | 75        | 2019-06-17 |<br>| 48         | 95        | 27        | 2019-06-05 |<br>| 147        | 99        | 13        | 2019-07-07 |<br>| 50         | 57        | 72        | 2019-06-30 |<br>| 102        | 48        | 2         | 2019-07-01 |<br>| 2          | 47        | 36        | 2019-06-22 |<br>| 76         | 10        | 2         | 2019-07-03 |<br>| 88         | 61        | 57        | 2019-07-12 |<br>| 94         | 50        | 15        | 2019-07-01 |<br>| 150        | 75        | 6         | 2019-07-01 |<br>| 173        | 73        | 92        | 2019-06-10 |<br>| 165        | 42        | 76        | 2019-07-20 |<br>| 101        | 24        | 59        | 2019-06-15 |<br>| 83         | 74        | 64        | 2019-07-30 |<br>| 160        | 7         | 51        | 2019-07-10 |<br>| 88         | 61        | 48        | 2019-07-11 |<br>| 23         | 18        | 16        | 2019-07-09 |<br>| 153        | 94        | 97        | 2019-07-27 |<br>| 161        | 26        | 6         | 2019-07-07 |<br>| 29         | 8         | 73        | 2019-06-02 |<br>| 13         | 93        | 78        | 2019-06-15 |<br>| 118        | 43        | 82        | 2019-06-01 |<br>| 123        | 50        | 9         | 2019-07-11 |<br>| 155        | 29        | 56        | 2019-07-10 |<br>| 45         | 16        | 67        | 2019-06-22 |<br>| 65         | 69        | 21        | 2019-07-01 |<br>| 185        | 30        | 98        | 2019-06-22 |<br>| 64         | 77        | 56        | 2019-06-21 |<br>| 147        | 99        | 31        | 2019-07-03 |<br>| 4          | 34        | 80        | 2019-07-20 |<br>| 86         | 47        | 61        | 2019-06-15 |<br>| 93         | 98        | 24        | 2019-07-22 |<br>| 80         | 8         | 81        | 2019-07-14 |<br>| 99         | 17        | 4         | 2019-07-09 |<br>| 140        | 18        | 37        | 2019-06-28 |<br>| 4          | 34        | 61        | 2019-06-12 |<br>| 107        | 90        | 22        | 2019-08-01 |<br>| 73         | 84        | 4         | 2019-07-23 |<br>| 126        | 17        | 17        | 2019-07-27 |<br>| 35         | 50        | 100       | 2019-06-29 |<br>| 101        | 24        | 88        | 2019-06-07 |<br>| 191        | 5         | 43        | 2019-07-21 |<br>| 63         | 73        | 63        | 2019-07-21 |<br>| 91         | 55        | 84        | 2019-07-27 |<br>| 185        | 30        | 80        | 2019-06-29 |<br>| 137        | 90        | 82        | 2019-07-30 |<br>| 113        | 61        | 14        | 2019-07-24 |<br>| 166        | 85        | 58        | 2019-06-04 |<br>| 132        | 4         | 99        | 2019-06-07 |<br>| 151        | 30        | 90        | 2019-07-04 |<br>| 72         | 43        | 46        | 2019-07-13 |<br>| 97         | 23        | 29        | 2019-08-01 |<br>| 182        | 28        | 65        | 2019-07-07 |<br>| 89         | 62        | 61        | 2019-07-15 |<br>| 130        | 2         | 48        | 2019-06-13 |<br>| 171        | 82        | 5         | 2019-06-12 |<br>| 32         | 93        | 64        | 2019-06-02 |<br>| 80         | 8         | 5         | 2019-06-28 |<br>| 48         | 95        | 91        | 2019-06-18 |<br>| 128        | 6         | 83        | 2019-07-31 |<br>| 55         | 27        | 3         | 2019-06-18 |<br>| 162        | 60        | 68        | 2019-06-27 |<br>| 183        | 13        | 95        | 2019-06-29 |<br>| 132        | 4         | 65        | 2019-06-25 |<br>| 194        | 19        | 72        | 2019-07-14 |<br>| 172        | 2         | 28        | 2019-07-09 |<br>| 137        | 90        | 63        | 2019-07-11 |<br>| 102        | 48        | 68        | 2019-07-22 |<br>| 159        | 1         | 58        | 2019-06-07 |<br>| 35         | 50        | 27        | 2019-07-25 |<br>| 167        | 84        | 78        | 2019-06-04 |<br>| 71         | 27        | 34        | 2019-07-12 |<br>| 69         | 52        | 92        | 2019-07-14 |<br>| 21         | 3         | 79        | 2019-07-03 |<br>| 124        | 21        | 97        | 2019-06-02 |<br>| 122        | 36        | 8         | 2019-07-29 |<br>| 18         | 7         | 57        | 2019-06-15 |<br>| 131        | 65        | 60        | 2019-06-06 |<br>| 153        | 94        | 66        | 2019-06-03 |<br>| 138        | 39        | 55        | 2019-07-26 |<br>| 194        | 19        | 43        | 2019-07-29 |<br>| 190        | 9         | 96        | 2019-07-26 |<br>| 117        | 74        | 17        | 2019-06-28 |<br>| 177        | 22        | 84        | 2019-06-15 |<br>| 20         | 19        | 32        | 2019-07-28 |<br>| 103        | 11        | 48        | 2019-06-28 |<br>| 62         | 14        | 40        | 2019-06-30 |<br>| 8          | 39        | 6         | 2019-06-29 |<br>| 183        | 13        | 49        | 2019-07-25 |<br>| 191        | 5         | 29        | 2019-07-19 |<br>| 46         | 81        | 35        | 2019-06-04 |<br>| 76         | 10        | 82        | 2019-06-07 |<br>| 168        | 67        | 88        | 2019-07-13 |<br>| 171        | 82        | 60        | 2019-06-30 |<br>| 14         | 17        | 52        | 2019-07-30 |<br>| 97         | 23        | 69        | 2019-07-15 |<br>| 45         | 16        | 76        | 2019-06-29 |<br>| 156        | 24        | 65        | 2019-06-17 |<br>| 16         | 94        | 96        | 2019-07-24 |<br>| 155        | 29        | 20        | 2019-07-16 |<br>| 158        | 25        | 6         | 2019-07-19 |<br>| 125        | 76        | 24        | 2019-07-03 |<br>| 83         | 74        | 8         | 2019-07-21 |<br>| 85         | 74        | 3         | 2019-07-17 |<br>| 147        | 99        | 81        | 2019-07-18 |<br>| 133        | 40        | 40        | 2019-08-01 |<br>| 16         | 94        | 37        | 2019-07-02 |<br>| 118        | 43        | 32        | 2019-07-11 |<br>| 114        | 83        | 39        | 2019-06-04 |<br>| 36         | 43        | 95        | 2019-06-18 |<br>| 140        | 18        | 24        | 2019-07-04 |<br>| 29         | 8         | 10        | 2019-07-14 |<br>| 182        | 28        | 23        | 2019-07-02 |<br>| 81         | 1         | 85        | 2019-07-02 |<br>| 79         | 28        | 62        | 2019-06-10 |<br>| 116        | 53        | 70        | 2019-07-10 |<br>| 182        | 28        | 97        | 2019-06-04 |<br>| 59         | 24        | 36        | 2019-06-13 |<br>| 17         | 51        | 38        | 2019-06-20 |<br>| 10         | 78        | 88        | 2019-06-06 |<br>| 66         | 32        | 83        | 2019-06-16 |<br>| 200        | 92        | 87        | 2019-06-04 |<br>| 156        | 24        | 47        | 2019-06-10 |<br>| 119        | 72        | 4         | 2019-07-27 |<br>| 104        | 97        | 6         | 2019-06-02 |<br>| 104        | 97        | 9         | 2019-07-04 |<br>| 158        | 25        | 2         | 2019-07-08 |<br>| 161        | 26        | 70        | 2019-07-12 |<br>| 80         | 8         | 82        | 2019-06-14 |<br>| 32         | 93        | 24        | 2019-06-16 |<br>| 4          | 34        | 93        | 2019-06-17 |<br>| 154        | 3         | 13        | 2019-07-15 |<br>| 200        | 92        | 71        | 2019-06-23 |<br>| 179        | 64        | 61        | 2019-06-11 |<br>| 180        | 43        | 77        | 2019-07-02 |<br>| 87         | 60        | 86        | 2019-07-19 |<br>| 169        | 30        | 76        | 2019-07-19 |<br>| 37         | 83        | 86        | 2019-06-10 |<br>| 128        | 6         | 1         | 2019-07-22 |<br>| 7          | 15        | 84        | 2019-06-25 |<br>| 106        | 48        | 71        | 2019-06-06 |<br>| 50         | 57        | 62        | 2019-07-01 |<br>| 187        | 53        | 42        | 2019-06-10 |<br>| 59         | 24        | 19        | 2019-06-08 |<br>| 156        | 24        | 20        | 2019-07-22 |<br>| 3          | 68        | 62        | 2019-06-09 |<br>| 188        | 85        | 20        | 2019-06-29 |<br>| 39         | 93        | 30        | 2019-06-22 |<br>| 9          | 55        | 100       | 2019-06-29 |<br>| 62         | 14        | 81        | 2019-07-05 |<br>| 80         | 8         | 32        | 2019-06-14 |<br>| 149        | 42        | 87        | 2019-07-04 |<br>| 192        | 10        | 15        | 2019-06-12 |<br>| 120        | 59        | 1         | 2019-06-13 |<br>| 158        | 25        | 75        | 2019-06-13 |<br>| 51         | 41        | 68        | 2019-06-27 |<br>| 175        | 82        | 17        | 2019-06-17 |<br>| 132        | 4         | 89        | 2019-06-06 |<br>| 121        | 5         | 5         | 2019-06-26 |<br>| 67         | 4         | 14        | 2019-06-02 |<br>| 57         | 57        | 93        | 2019-07-09 |<br>| 58         | 93        | 57        | 2019-06-22 |<br>| 57         | 57        | 13        | 2019-07-26 |<br>| 126        | 17        | 18        | 2019-07-22 |<br>| 111        | 71        | 86        | 2019-06-11 |<br>| 197        | 5         | 5         | 2019-07-25 |<br>| 147        | 99        | 61        | 2019-07-09 |<br>| 40         | 92        | 77        | 2019-06-14 |<br>| 44         | 91        | 71        | 2019-06-07 |<br>| 13         | 93        | 78        | 2019-06-23 |<br>| 76         | 10        | 52        | 2019-07-23 |<br>| 78         | 87        | 70        | 2019-07-22 |<br>| 87         | 60        | 56        | 2019-06-29 |<br>| 15         | 37        | 85        | 2019-08-01 |<br>| 143        | 10        | 81        | 2019-07-02 |<br>| 186        | 28        | 37        | 2019-06-30 |<br>| 84         | 48        | 16        | 2019-07-07 |<br>| 23         | 18        | 31        | 2019-07-28 |<br>| 51         | 41        | 46        | 2019-06-29 |<br>| 174        | 70        | 41        | 2019-06-02 |<br>| 139        | 29        | 85        | 2019-07-18 |<br>| 57         | 57        | 20        | 2019-07-14 |<br>| 184        | 7         | 36        | 2019-07-19 |<br>| 21         | 3         | 73        | 2019-06-16 |<br>| 21         | 3         | 48        | 2019-07-23 |<br>| 114        | 83        | 38        | 2019-07-07 |<br>| 128        | 6         | 11        | 2019-06-15 |<br>| 5          | 22        | 45        | 2019-07-31 |<br>| 144        | 66        | 50        | 2019-06-26 |<br>| 135        | 96        | 85        | 2019-06-28 |<br>| 196        | 74        | 90        | 2019-06-08 |<br>| 15         | 37        | 8         | 2019-07-12 |<br>| 86         | 47        | 79        | 2019-07-11 |<br>| 42         | 7         | 75        | 2019-06-15 |<br>| 200        | 92        | 62        | 2019-07-12 |<br>| 3          | 68        | 74        | 2019-06-21 |<br>| 12         | 34        | 26        | 2019-06-28 |<br>| 40         | 92        | 28        | 2019-07-12 |<br>| 120        | 59        | 28        | 2019-06-19 |<br>| 3          | 68        | 69        | 2019-06-20 |<br>| 56         | 11        | 19        | 2019-07-24 |<br>| 25         | 47        | 10        | 2019-06-03 |<br>| 156        | 24        | 79        | 2019-07-31 |<br>| 159        | 1         | 12        | 2019-07-19 |<br>| 131        | 65        | 89        | 2019-06-03 |<br>| 32         | 93        | 1         | 2019-06-16 |<br>| 25         | 47        | 16        | 2019-06-22 |<br>| 161        | 26        | 93        | 2019-06-09 |<br>| 188        | 85        | 13        | 2019-07-18 |<br>| 55         | 27        | 49        | 2019-06-18 |<br>| 167        | 84        | 12        | 2019-07-07 |<br>| 97         | 23        | 8         | 2019-07-28 |<br>| 52         | 85        | 3         | 2019-07-15 |<br>| 156        | 24        | 92        | 2019-07-25 |<br>| 5          | 22        | 17        | 2019-07-25 |<br>| 22         | 62        | 60        | 2019-07-14 |<br>| 177        | 22        | 29        | 2019-06-14 |<br>| 30         | 65        | 10        | 2019-06-28 |<br>| 95         | 64        | 27        | 2019-07-18 |<br>| 110        | 48        | 29        | 2019-06-21 |<br>| 71         | 27        | 79        | 2019-07-02 |<br>| 98         | 15        | 82        | 2019-06-08 |<br>| 165        | 42        | 86        | 2019-06-27 |<br>| 101        | 24        | 70        | 2019-06-12 |<br>| 80         | 8         | 15        | 2019-07-12 |<br>| 73         | 84        | 4         | 2019-07-23 |<br>| 107        | 90        | 87        | 2019-06-08 |<br>| 34         | 16        | 4         | 2019-07-06 |<br>| 143        | 10        | 93        | 2019-07-12 |<br>| 4          | 34        | 3         | 2019-07-25 |<br>| 82         | 82        | 67        | 2019-08-01 |<br>| 60         | 77        | 37        | 2019-07-01 |<br>| 115        | 89        | 94        | 2019-07-22 |<br>| 197        | 5         | 6         | 2019-06-18 |<br>| 21         | 3         | 14        | 2019-07-05 |<br>| 138        | 39        | 14        | 2019-06-16 |<br>| 194        | 19        | 26        | 2019-07-15 |<br>| 27         | 40        | 50        | 2019-06-18 |<br>| 145        | 88        | 35        | 2019-06-18 |<br>| 77         | 76        | 36        | 2019-07-29 |<br>| 78         | 87        | 25        | 2019-06-16 |<br>| 142        | 38        | 82        | 2019-06-04 |<br>| 51         | 41        | 21        | 2019-07-14 |<br>| 25         | 47        | 62        | 2019-07-13 |<br>| 194        | 19        | 32        | 2019-07-19 |<br>| 30         | 65        | 1         | 2019-07-29 |<br>| 87         | 60        | 14        | 2019-07-05 |<br>| 164        | 51        | 3         | 2019-07-23 |<br>| 161        | 26        | 9         | 2019-07-01 |<br>| 15         | 37        | 72        | 2019-07-01 |<br>| 111        | 71        | 57        | 2019-07-09 |<br>| 43         | 57        | 76        | 2019-07-23 |<br>| 19         | 78        | 83        | 2019-07-25 |<br>| 80         | 8         | 63        | 2019-07-21 |<br>| 171        | 82        | 79        | 2019-06-22 |<br>| 81         | 1         | 6         | 2019-06-06 |<br>| 25         | 47        | 46        | 2019-07-19 |<br>| 23         | 18        | 96        | 2019-07-20 |<br>| 65         | 69        | 97        | 2019-07-03 |<br>| 6          | 73        | 47        | 2019-06-24 |<br>| 182        | 28        | 28        | 2019-06-03 |<br>| 159        | 1         | 32        | 2019-07-12 |<br>| 42         | 7         | 56        | 2019-07-17 |<br>| 71         | 27        | 5         | 2019-07-20 |<br>| 44         | 91        | 80        | 2019-07-06 |<br>| 55         | 27        | 73        | 2019-07-10 |<br>| 28         | 34        | 80        | 2019-07-27 |<br>| 106        | 48        | 13        | 2019-07-08 |<br>| 107        | 90        | 81        | 2019-06-24 |<br>| 130        | 2         | 80        | 2019-07-15 |<br>| 174        | 70        | 64        | 2019-06-18 |<br>| 139        | 29        | 88        | 2019-06-08 |<br>| 107        | 90        | 13        | 2019-07-08 |<br>| 6          | 73        | 29        | 2019-06-09 |<br>| 30         | 65        | 45        | 2019-06-23 |<br>| 27         | 40        | 84        | 2019-07-03 |<br>| 78         | 87        | 97        | 2019-07-21 |<br>| 95         | 64        | 73        | 2019-06-27 |<br>| 133        | 40        | 64        | 2019-06-30 |<br>| 146        | 53        | 58        | 2019-07-14 |<br>| 37         | 83        | 48        | 2019-06-23 |<br>| 179        | 64        | 99        | 2019-06-28 |<br>| 45         | 16        | 56        | 2019-07-23 |<br>| 186        | 28        | 66        | 2019-07-30 |<br>| 4          | 34        | 74        | 2019-07-10 |<br>| 49         | 18        | 4         | 2019-07-11 |<br>| 111        | 71        | 99        | 2019-06-17 |<br>| 10         | 78        | 66        | 2019-06-26 |<br>| 183        | 13        | 45        | 2019-06-01 |<br>| 57         | 57        | 2         | 2019-07-20 |<br>| 32         | 93        | 31        | 2019-07-11 |<br>| 133        | 40        | 55        | 2019-06-27 |<br>| 20         | 19        | 33        | 2019-06-03 |<br>| 92         | 74        | 36        | 2019-06-16 |<br>| 10         | 78        | 21        | 2019-07-11 |<br>| 73         | 84        | 43        | 2019-07-28 |<br>| 133        | 40        | 62        | 2019-07-20 |<br>| 152        | 44        | 7         | 2019-07-26 |<br>| 139        | 29        | 86        | 2019-08-01 |<br>| 121        | 5         | 37        | 2019-07-06 |<br>| 109        | 47        | 2         | 2019-07-23 |<br>| 165        | 42        | 39        | 2019-06-25 |<br>| 66         | 32        | 30        | 2019-07-18 |<br>| 130        | 2         | 24        | 2019-07-09 |<br>| 134        | 20        | 73        | 2019-07-07 |<br>| 91         | 55        | 64        | 2019-07-11 |</pre><p>How do I copy that and turn it into a dataframe in pandas? Let’s see … I can copy that and paste it to Ms. Excel then copy again and then paste it into dataframe. But, DUH, as a data analyst thats such poor method!</p><p>After spend such a long time (that I forgot to lunch), I finally figure it out:</p><ol><li>First you need to copy that raw text above (of course)</li><li>Open your pandas and type this</li></ol><pre>import pandas as pd<br>#delete space area<br>df=pd.read_clipboard(sep=&#39;\t&#39;)<br>#convert df into series<br>s_org = df.squeeze()<br>#split values by &#39;|&#39; then turns it into column with expand argument<br>data = s_org.str.split(&#39;|&#39;,expand=True)<br>#remove first column and last column<br>data.drop(data.columns[[0, len(data.columns)-1]], axis=1, inplace=True)<br>#remove first row, because it containts &#39;-----&#39;<br>data=data.iloc[1: , :]<br>#renaming columns<br>data.columns = [&#39;article_id&#39;,&#39;author_id&#39;,&#39;viewer_id&#39;,&#39;view_date&#39;]<br>#save it into csv<br>data.to_csv(&#39;data.csv&#39;,index=False)<br>#call the csv<br>df2=pd.read_csv(&#39;data.csv&#39;)</pre><p>4. Easy right? Haha haha (I’ve got headache because of this)</p><p>Cheat sheet, uh I mean reference:</p><ol><li><a href="https://www.geeksforgeeks.org/how-to-drop-one-or-multiple-columns-in-pandas-dataframe/%20https://www.geeksforgeeks.org/how-to-drop-first-row-in-pandas/%20https://stackoverflow.com/questions/20517650/how-to-delete-the-last-column-of-data-of-a-pandas-dataframe%20https://datatofish.com/pandas-dataframe-to-series/%20https://note.nkmk.me/en/python-pandas-split-extract/">https://www.geeksforgeeks.org/how-to-drop-one-or-multiple-columns-in-pandas-dataframe/%20</a></li><li><a href="https://www.geeksforgeeks.org/how-to-drop-one-or-multiple-columns-in-pandas-dataframe/%20https://www.geeksforgeeks.org/how-to-drop-first-row-in-pandas/%20https://stackoverflow.com/questions/20517650/how-to-delete-the-last-column-of-data-of-a-pandas-dataframe%20https://datatofish.com/pandas-dataframe-to-series/%20https://note.nkmk.me/en/python-pandas-split-extract/">https://www.geeksforgeeks.org/how-to-drop-first-row-in-pandas/%20</a></li><li><a href="https://www.geeksforgeeks.org/how-to-drop-one-or-multiple-columns-in-pandas-dataframe/%20https://www.geeksforgeeks.org/how-to-drop-first-row-in-pandas/%20https://stackoverflow.com/questions/20517650/how-to-delete-the-last-column-of-data-of-a-pandas-dataframe%20https://datatofish.com/pandas-dataframe-to-series/%20https://note.nkmk.me/en/python-pandas-split-extract/">https://stackoverflow.com/questions/20517650/how-to-delete-the-last-column-of-data-of-a-pandas-dataframe%20</a></li><li><a href="https://www.geeksforgeeks.org/how-to-drop-one-or-multiple-columns-in-pandas-dataframe/%20https://www.geeksforgeeks.org/how-to-drop-first-row-in-pandas/%20https://stackoverflow.com/questions/20517650/how-to-delete-the-last-column-of-data-of-a-pandas-dataframe%20https://datatofish.com/pandas-dataframe-to-series/%20https://note.nkmk.me/en/python-pandas-split-extract/">https://datatofish.com/pandas-dataframe-to-series/%20</a></li><li><a href="https://www.geeksforgeeks.org/how-to-drop-one-or-multiple-columns-in-pandas-dataframe/%20https://www.geeksforgeeks.org/how-to-drop-first-row-in-pandas/%20https://stackoverflow.com/questions/20517650/how-to-delete-the-last-column-of-data-of-a-pandas-dataframe%20https://datatofish.com/pandas-dataframe-to-series/%20https://note.nkmk.me/en/python-pandas-split-extract/">https://note.nkmk.me/en/python-pandas-split-extract/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84c1492cb670" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LeetCode Answer]]></title>
            <link>https://medium.com/@fijaya/leetcode-answer-c9888353ade0?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9888353ade0</guid>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Thu, 28 Sep 2023 15:07:19 GMT</pubDate>
            <atom:updated>2023-10-01T16:17:45.738Z</atom:updated>
            <content:encoded><![CDATA[<h4>-still going on, will update</h4><p>577. employee bonus answer</p><pre>CREATE TABLE EMPLOYEE (<br>    empId int PRIMARY KEY,<br>    name VARCHAR(50),<br>    supervisor int,<br>    salary int<br>);<br><br>INSERT INTO EMPLOYEE (empId,name,supervisor,salary)<br>    VALUES  (1, &#39;John&#39;, 3, 1000),<br>            (2, &#39;Dan&#39;, 3, 2000),<br>            (3, &#39;Brad&#39;, NULL, 4000),<br>            (4, &#39;Thomas&#39;, 3, 4000);<br><br><br>CREATE TABLE bonus (<br>    empId INTEGER PRIMARY KEY,<br>    bonus INTEGER<br>);<br><br>INSERT INTO bonus VALUES (2, 500);<br>INSERT INTO bonus VALUES (4, 2000);<br><br>SELECT * FROM EMPLOYEE;<br>SELECT * FROM bonus;<br><br>--the answer<br>SELECT name, bonus<br>FROM EMPLOYEE<br>LEFT JOIN bonus<br>ON EMPLOYEE.empId = bonus.empId<br>WHERE bonus.bonus &lt; 1000<br>  or bonus.bonus is null</pre><p>Reference:</p><ol><li><a href="https://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause%20https://www.w3schools.com/sql/sql_select.asp%20https://stackoverflow.com/questions/1219909/mysql-join-with-where-clause%20https://ngodingdata.com/cara-menggunakan-join-di-mysql/">https://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause%20</a></li><li><a href="https://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause%20https://www.w3schools.com/sql/sql_select.asp%20https://stackoverflow.com/questions/1219909/mysql-join-with-where-clause%20https://ngodingdata.com/cara-menggunakan-join-di-mysql/">https://www.w3schools.com/sql/sql_select.asp%20</a></li><li><a href="https://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause%20https://www.w3schools.com/sql/sql_select.asp%20https://stackoverflow.com/questions/1219909/mysql-join-with-where-clause%20https://ngodingdata.com/cara-menggunakan-join-di-mysql/">https://stackoverflow.com/questions/1219909/mysql-join-with-where-clause%20</a></li><li><a href="https://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause%20https://www.w3schools.com/sql/sql_select.asp%20https://stackoverflow.com/questions/1219909/mysql-join-with-where-clause%20https://ngodingdata.com/cara-menggunakan-join-di-mysql/">https://ngodingdata.com/cara-menggunakan-join-di-mysql/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9888353ade0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Menjelaskan Algoritma LSTM Secara Sederhana]]></title>
            <link>https://medium.com/@fijaya/menjelaskan-algoritma-lstm-secara-sederhana-817373fb9791?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/817373fb9791</guid>
            <category><![CDATA[long-term-sort-memory]]></category>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[algoritma]]></category>
            <category><![CDATA[data-scientist-indonesia]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 17:36:25 GMT</pubDate>
            <atom:updated>2023-10-01T16:18:00.998Z</atom:updated>
            <content:encoded><![CDATA[<h4>dijamin paham!</h4><p>Data yang saya gunakan disini adalah data berupa saham bitcoin dari tahun 2014–2023 yang saya peroleh di website <a href="https://www.kaggle.com/datasets/arslanr369/bitcoin-price-2014-2023">https://www.kaggle.com/datasets/arslanr369/bitcoin-price-2014-2023</a></p><p>Tentunya, langkah awal ialah dengan menyiapkan sebuah dataframe. Dan, pastinya memasukkan semua libraries yang akan digunakan sampai akhir projek; ada math, pandas, numpy, sklearn, keras, dan matplotlib.</p><p>Saya juga memasukkan library datetime untuk mengubah kolom Date menjadi tipe tanggal. Dan sekalian dengan perintah df.set_index akan menjadikan kolom Date sebagai index. Sehingga, nanti kalau divisualkan, kolom Date akan otomatis tampil di grafik. Kalau di plot itu kita bisa memilih style tampilan sendiri, di sini saya menggunakan tampilan fivethrtyeight. Syntax df.head() untuk menampilkan datanya, dari lima data teratas.</p><pre>import math<br>import pandas_datareader as web<br>import numpy as np<br>import pandas as pd<br>from sklearn.preprocessing import MinMaxScaler<br>from keras.models import Sequential <br>from keras.layers import Dense, LSTM<br>import matplotlib.pyplot as plt<br>from datetime import datetime<br>#format=&quot;%m/%d/%Y&quot;<br>plt.style.use(&#39;fivethirtyeight&#39;)<br>df = pd.read_csv(&#39;BTC-USD.csv&#39;)<br>df[&#39;Date&#39;] = pd.to_datetime(df.Date)<br>df.set_index(&#39;Date&#39;, inplace=True)<br><br>df.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*Y5aTanLm2AYbXvLDbQ_SvA.png" /></figure><p>Shape? Kenapa harus close?</p><p>Memvisualisasikan data dalam bentuk grafik agar nanti bisa dibandingkan dengan visual grafik setelah diprediksi. Untuk ukuran grafiknya 16x8 dengan judul ‘Close Price History’. Data yang akan divisualisasikan adalah dataframe df, kolom Close. X axisnya dilabelin ‘Date’, Y axisnya dilabelin ‘Close Price’, masing-masing dengan ukuran huruf 18. Plt.show untuk menampilkan grafik.</p><pre>#Get the number of rows and columns in the data set<br>df.shape<br><br>plt.figure(figsize=(16,8)) #ini ukuran diagramnya<br>plt.title(&#39;Close Price History&#39;) #Beri nama visualnya dengan nama &#39;Close Price History&#39;<br><br>#We give the plot the data (the closing price of our stock)<br>plt.plot(df[&#39;Close&#39;])<br><br>#Labelin axis x dan y nya<br>plt.xlabel(&#39;Date&#39;, fontsize=18)<br>plt.ylabel(&#39;Close Price&#39;, fontsize=18)<br><br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pLJwqDRyIOMDgl26zlEkNA.png" /></figure><p>Buat dataframe baru bernama data yang isinya hanya data dari kolom Close. Lalu konversikan dataframe baru bernama data ini ke dalam bentuk array, dan setor ke sebuah variabel baru bernama dataset. Buat lagi sebuah variabel baru bernama training_data_len yang diisi dengan 80% data dari dataset(array). 80% atau 0.8 ini adalah nilai yang saya pilih karna menurut saya ukurannya cukup untuk mewakili keseluruhan data.</p><pre>data = df.filter([&#39;Close&#39;])<br><br>dataset = data.values<br><br>training_data_len = math.ceil( len(dataset) * 0.8 )<br><br>training_data_len</pre><pre>2583</pre><p>Data yang awalnya berjumlah 3228 (df), sekarang menjadi 2583(training_data_len). Cara perhitungannya tuh gini:</p><p>0.8 x 3228 = 2,582.4 = ~2,583</p><p>Selanjutnya tahap scaling atau normalisasi. Apa itu? Scaling merupakan teknik mengolah nilai yang awalnya variabel independen dikonversikan menjadi data kecil yang bernilai 0 sampai 1. Kenapa sih harus discaling? Gunanya untuk menyeimbangkan nilai. Karna sebuah data itu biasanya berisikan nilai yang ribuan, di baris selanjutnya nilainya satuan, di baris selanjutnya ratusan. Kenapa harus diseimbangkan? Di LTSM nanti kita bakal menggunakan suatu teknik analisis data yang bernama regresi logistik. Teknik ini dalam pengolahan datanya sangat sensitif. Itu sebabnya nilai-nilai pada data harus seimbang dan kurang lebih sama besarnya.</p><pre>scaler = MinMaxScaler(feature_range=(0,1))<br>scaled_data = scaler.fit_transform(dataset)<br><br>np.set_printoptions(threshold=np.inf)<br>print(scaled_data)</pre><p>Saya menggunakan np.set_printoptions(threshold=np.inf) untuk bisa melihat data yang discaled secara lebih detail. Coba kita bandingkan untuk nilai kolom Close sebelum di-scaling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/249/1*0Adsa02f_yhqpd1pfHne8g.png" /></figure><p>dengan nilai kolom Close sesudah di-scaling, dan dijadikan array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/1*dcHq2fZaMhVWBxV2AmEAsQ.png" /></figure><p>Ini array-nya masih satu dimensi yaa dengan isi 3228 data, masih sama seperti sebelumnya.</p><p>Itu nilai 4.14358659e-03 cara bacanya gini, huruf “e” menyimbolkan notasi saintifik. E-03 itu sama dengan 0.0001. Jadi 4.14358659*0.0001 = 0.000414358659 (fixed-point notation).</p><p>Nilai-nilai yang sudah terscaling ini kemudian diambil datanya dari baris ke-0 sampai baris ke-2583, lalu disetor ke dalam sebuah variabel bernama train_data.</p><pre><br>train_data = scaled_data[0:training_data_len, :] <br><br>print(train_data)</pre><p>Saya sejajarkan ya data scaled_data = 3228 dengan train_data = 2583.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*0X55iBAM-AyCThGJrIZNGQ.png" /></figure><p>Untuk memulai training data, kita harus siapkan sebuah wadah bernama x_train dan y_train. Wadah ini kita isi dengan 2583 nilai (80%). #dgn perintah appen, x_train diisi 60 values (0–59)</p><pre>x_train = []<br>y_train = []<br><br>for i in range(60, len(train_data)):<br>  x_train.append(train_data[i-60:i, 0]) <br>  y_train.append(train_data[i, 0]) #y_train diisi value ke 61 (60)<br>  if i &lt;= 60:<br>    print(x_train)<br>    print(y_train)<br>    print()</pre><pre>[array([0.00414359, 0.00365546, 0.00321557, 0.00342492, 0.0032753 ,<br>       0.00332473, 0.0038239 , 0.00363714, 0.00346454, 0.00335845,<br>       0.00328567, 0.00295417, 0.00292874, 0.00309905, 0.00304965,<br>       0.00292288, 0.00269198, 0.00223721, 0.00211322, 0.00225521,<br>       0.00234585, 0.00259445, 0.0027738 , 0.0027224 , 0.00273334,<br>       0.00297447, 0.00315054, 0.0033057 , 0.00321523, 0.00303393,<br>       0.00305177, 0.0031658 , 0.00313766, 0.00303822, 0.00309209,<br>       0.00304287, 0.00267573, 0.00267466, 0.00251033, 0.00262063,<br>       0.00259518, 0.00266387, 0.00233701, 0.00248116, 0.00237752,<br>       0.00219096, 0.00219308, 0.00221774, 0.00226134, 0.00239481,<br>       0.00254029, 0.00243827, 0.00248387, 0.00274766, 0.00280197,<br>       0.00281341, 0.00364242, 0.00360048, 0.00326041, 0.00293862])]<br><br>[0.0031129686991635463]</pre><p>Lebih jelasnya seperti ini. Outputnya menghasilkan dua array. Array pertama x_train diisi nilai dari 1–60. Array kedua y_train hanya diisi 1 nilai, yaitu nilai ke 61.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*Y6p2NuvWWOrg9Dn9F5zvYA.png" /></figure><p>x_train dan y_train ini harus digabung ke dalam satu array. Caranya dengan menggunakan np.reshape untuk mengubah dimensi array nya.</p><p>np.reshape(x_train,(x_train.shape[0],x_train.shape[1].1)</p><p>atau bisa dibaca</p><p>np.reshape(60 baris,1 kolom)</p><pre>x_train, y_train = np.array(x_train), np.array(y_train)<br>x_train = np.reshape(x_train, (x_train.shape[0], x_train.shape[1], 1))<br>x_train.shape</pre><p>Dari syntax di atas, array yang baru dimensinya berisikan data 1–60, 2–62, …, 2523–2583.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/171/1*BqSeyfIlxJGDcUQB9I-Cxg.png" /></figure><p>Sampai sini masih paham kan? Ok selanjutnya kita terapkan algoritma LTSM, yang katanya bisa memprediksi masa depan hehe.</p><p>Di awal eksperimen dengan LTSM kita gunakan dulu data x_train (berisi 2583 data yang dibagi setiap 60) dan data y_train (berisi 1 data).</p><p>Gunakan Dense 25, optimizer=adam, dan loss pakai acuan mean squared error. Untuk batch_size=1, dengan epoch=1.</p><pre>model = Sequential()<br>model.add(LSTM(50, return_sequences=True, input_shape=(x_train.shape[1], 1)))<br>model.add(LSTM(50, return_sequences=False))<br>model.add(Dense(25))<br>model.add(Dense(1))<br><br>model.compile(optimizer=&#39;adam&#39;, loss=&#39;mean_squared_error&#39;)<br><br>model.fit(x_train, y_train, batch_size=1, epochs=1)</pre><pre>2523/2523 [==============================] - 95s 33ms/step - loss: 0.0013<br>&lt;keras.src.callbacks.History at 0x19bdabada30&gt;</pre><p>Selanjutnya, proses data x_test dan y_test. Caranya kurang lebih sama seperti membuat x_train dan y_test.</p><pre>test_data = scaled_data[training_data_len - 60:]<br><br>x_test = []<br>y_test = dataset[training_data_len:, :]<br>for i in range(60, len(test_data)):<br>  x_test.append(test_data[i-60:i, 0])<br><br>x_test = np.array(x_test)<br>x_test = np.reshape(x_test, (x_test.shape[0], x_test.shape[1], 1))</pre><p>test_data = 3228[2583–60=2523] = 705 data. Kalau kita hitung dari index-0 berarti data yang diambil adalah data ke-2523 sampai data ke-3227.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*O5v93CvQ2snZbMQiPpeD0Q.png" /><figcaption>kalau di gambar hitungnya dari index-1, 2524–3228</figcaption></figure><p>test_data = 704–1 = 703 data dimasukkan ke x_test dalam bentuk array dengan format yang sama seperti x_train sebelumnya. Sedangkan untuk</p><p>y_test=3228[2583]=645 data.</p><pre>Date<br>2021-10-13    57401.097656<br>2021-10-14    57321.523438<br>2021-10-15    61593.949219<br>2021-10-16    60892.179688<br>2021-10-17    61553.617188<br>                  ...     <br>2023-07-15    30295.806641<br>2023-07-16    30249.132813<br>2023-07-17    30145.888672<br>2023-07-18    29856.562500<br>2023-07-20    30189.902344<br>Name: Close, Length: 645, dtype: float64</pre><p>LTSM akan melakukan prediksi berdasarkan pola yang sudah si LTSM gunakan saat mengolah data x_train dan y_train.</p><pre>predictions = model.predict(x_test)<br>predictions = scaler.inverse_transform(predictions)<br>predictions</pre><p>model.predict akan membuat array baru berisikan 645 data. Berikut hasil prediksi dari LTSM untuk data x_test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*pXj_fAG-w0byPFG4kJ7fSA.png" /></figure><p>Untuk mengetahui seberapa akurat model LTSM ini, mari kita lihat nilai RMSE nya (root mean quared error (RMSE)).???</p><pre>rmse = np.sqrt( np.mean( predictions - y_test )**2 )<br>rmse</pre><pre>1749.2365659119187</pre><p>RMSE di angka 1749 yang berarti?</p><p>Data hasil prediksi tadi bisa kita visualisasikan dalam bentuk grafik.</p><pre>train = data[:training_data_len]<br>valid = data[training_data_len:]<br>valid[&#39;Predictions&#39;] = predictions<br><br>plt.figure(figsize=(16,8))<br>plt.title(&#39;Model&#39;)<br>plt.xlabel(&#39;Date&#39;, fontsize=18)<br>plt.ylabel(&#39;Close Price USD ($)&#39;, fontsize=18)<br>plt.plot(train[&#39;Close&#39;])<br>plt.plot(valid[[&#39;Close&#39;, &#39;Predictions&#39;]])<br>plt.legend([&#39;Train&#39;, &#39;Validation&#39;, &#39;Predictions&#39;], loc=&#39;lower right&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XJCSlDAxQmH705kKQHlHBQ.png" /></figure><p>Bagaimana apakah masih terlihat rumit? Apabila ada baris yang dibingungkan boleh bertanya di kolom komentar. Sekian.</p><p>sumber:</p><ol><li><a href="https://medium.com/analytics-vidhya/machine-learning-for-winning-algorithm-trading-it-probably-doesnt-work-c0b11f801d34">https://medium.com/analytics-vidhya/machine-learning-for-winning-algorithm-trading-it-probably-doesnt-work-c0b11f801d34</a></li><li><a href="https://stackoverflow.com/questions/65237843/predicting-stock-price-x-days-into-the-future-using-python-machine-learning">https://stackoverflow.com/questions/65237843/predicting-stock-price-x-days-into-the-future-using-python-machine-learning</a></li><li><a href="https://medium.com/@nutanbhogendrasharma/simple-sequence-prediction-with-lstm-69ff0f4d57cd">https://medium.com/@nutanbhogendrasharma/simple-sequence-prediction-with-lstm-69ff0f4d57cd</a></li><li><a href="https://stackoverflow.com/questions/52527270/pandas-dates-not-showing-on-plot">python — Pandas dates not showing on plot — Stack Overflow</a></li><li><a href="https://www.ablebits.com/office-addins-blog/excel-if-match-formula/%20https://stackoverflow.com/questions/1987694/how-do-i-print-the-full-numpy-array-without-truncation">https://www.ablebits.com/office-addins-blog/excel-if-match-formula/%20</a></li><li><a href="https://www.ablebits.com/office-addins-blog/excel-if-match-formula/%20https://stackoverflow.com/questions/1987694/how-do-i-print-the-full-numpy-array-without-truncation">https://stackoverflow.com/questions/1987694/how-do-i-print-the-full-numpy-array-without-truncation</a></li><li><a href="https://stats.stackexchange.com/questions/319637/how-to-read-scientific-notation-output-numbers-that-include-e%20https://www.w3schools.com/python/ref_list_append.asp%20https://stackoverflow.com/questions/62178888/can-someone-explain-to-me-how-minmaxscaler-works">https://www.w3schools.com/python/ref_list_append.asp%20</a></li><li><a href="https://stats.stackexchange.com/questions/319637/how-to-read-scientific-notation-output-numbers-that-include-e%20https://www.w3schools.com/python/ref_list_append.asp%20https://stackoverflow.com/questions/62178888/can-someone-explain-to-me-how-minmaxscaler-works">https://stackoverflow.com/questions/62178888/can-someone-explain-to-me-how-minmaxscaler-works</a></li><li><a href="https://aws.amazon.com/id/what-is/logistic-regression/">https://aws.amazon.com/id/what-is/logistic-regression/</a></li><li><a href="https://chortle.ccsu.edu/java5/notes/chap11/ch11_6.html">https://chortle.ccsu.edu/java5/notes/chap11/ch11_6.html</a></li><li><a href="https://www.w3schools.com/python/numpy/numpy_array_reshape.asp">https://www.w3schools.com/python/numpy/numpy_array_reshape.asp</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=817373fb9791" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OLS vs XGBOOST, Comparing Predictive Algorithms of Hourly Air Quality using Machine Learning]]></title>
            <link>https://medium.com/@fijaya/ols-vs-xgboost-comparing-predictive-algorithms-of-hourly-air-quality-using-machine-learning-29be3458e28c?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/29be3458e28c</guid>
            <category><![CDATA[jakarta-air-quality]]></category>
            <category><![CDATA[jakarta-air-pollution]]></category>
            <category><![CDATA[weather-reviews]]></category>
            <category><![CDATA[jakarta-fog]]></category>
            <category><![CDATA[bad-air-quality]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Sun, 27 Aug 2023 09:54:01 GMT</pubDate>
            <atom:updated>2023-08-27T12:04:09.672Z</atom:updated>
            <content:encoded><![CDATA[<p>Predictive modeling is a machine learning-based models process used to predict activity, behavior and trends by analyzing patterns in a given set of input data. Python is a powerful tool for predictive modeling, and is relatively easy to learn.</p><p>Apart from being used to predict outcomes, for example predicting the likelihood of a transaction being fraudulent, estimating the quality of sales leads, spam detection, or the likelihood that someone will click on a link or buy a product. Predictive modeling can also be used as a forecasting method.</p><p>We can classify predictive modeling into 2 types, namely:</p><ul><li>Unsupervised models, predictive modeling that uses conventional statistics to classify data directly, using methods such as logistic regression, time series analysis, and decision trees. One of them is OSL.</li><li>Supervised model, is predictive modeling that uses machine learning methods such as artificial neural networks to identify hidden patterns in labeled data. One of them is xgboost.</li></ul><p>One of machine learning technology is feature engineering, the process of manipulating the features in any given raw dataset to create new features that better predict the target variable. Feature engineering can be accomplished in a number of ways, including:</p><ul><li>Combining two or more moderately correlated features into a single feature to increase correlation with the target variable.</li><li>Changing a categorical feature into a numeric one so that we can use it within the model.</li></ul><p>In this article, I will walk you through the basics of building a predictive model with Python using real-life air quality data. In many parts of the world, air quality is compromised by the burning of fossil fuels, which release particulate matter small enough to penetrate the lungs. One of them is PM2.5. These particles who constructed from sulfates, nitrates, ammonia, sodium chloride, black carbon, mineral dust and water are very small, only 2.5 microns in diameter or less and can be even smaller than that. If converted to millimeters, 2.5 microns equals 0.0025 millimeters, or approximately only 3 percent of the diameter of a human hair.</p><p>Our goal is to build a model to predict the PM2.5 concentration in a given hour based on the weather factors in the dataset: dew point, temperature, pressure, combined wind direction, wind speed, and cumulated hours of rain. Understanding the relationship (i.e. building a predictive model) between PM2.5 and weather could provide actionable intelligence without the need to invest in additional PM2.5 monitoring stations, which is a much more expensive solution.</p><p>Of course, this visualization project cannot generalize about air quality conditions and PM 2.5 concentrations that are occurring in Jakarta, because the limitations of the measuring instrument itself. The DKI Jakarta Provincial Environmental Service itself has at least five air quality measurement stations, namely in North Jakarta, South Jakarta, West Jakarta, East Jakarta and Central Jakarta.</p><p>The datasets contains two different sets of information:</p><ul><li>Hourly PM2.5 data from the <a href="https://www.bmkg.go.id/kualitas-udara/informasi-partikulat-pm25.bmkg">Kemayoran Station of BMKG</a>.</li><li>Hourly meteorological data from the <a href="https://www.msn.com/id-id/cuaca/prakiraanperjam/in-Kemayoran%2C-Jakarta,Jakarta-Raya?loc=eyJsIjoiS2VtYXlvcmFuLCBKYWthcnRhIiwiciI6Ikpha2FydGEgUmF5YSIsImMiOiJJbmRvbmVzaWEiLCJpIjoiSUQiLCJ0IjoxMDIsImciOiJpZC1pZCIsIngiOiIxMDYuODQ2IiwieSI6Ii02LjE2NDEifQ%3D%3D&amp;weadegreetype=C">MSN Weather Forecast</a>.</li></ul><h3>Importing &amp; Cleaning the Datasets</h3><p>I’m using jupyter with python installed. The first step I do is to make neat workspace by create two jupyter notebooks, one for OSL and one for XGBOOST.</p><p>For every algorithms (OSL and XGBOOST), I am using these packages:</p><pre>import pandas as pd<br>import numpy as np<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>%matplotlib inline<br>import plotly.express as px<br>import plotly.io as pio<br><br>data_df = pd.read_csv(&#39;ispuprovjkt20ags23.csv&#39;)<br>data_df</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*Zx-lra174NrngHMMlt3-rg.png" /></figure><p>As seen from the image above, the dataset consists of hourly records of the concentration of PM 2.5 in Kemayoran, Jakarta, with 8 columns. The descriptions of some of the columns that need attention are as follows:</p><ul><li>tanggal: Date time</li><li>TEmb: Dew points</li><li>Tmpr: Temperature</li><li>Tek: Pressure</li><li>ArAn: Wind direction</li><li>KecAn: Wind speed</li><li>CurHu: Rain precipitation</li><li>pm2.5: PM2.5</li></ul><p>The date column (‘tanggal’ in my language) is still on object type, so I must convert that column into datetime type data. This can easily be coerced into a single feature:</p><pre>data_df[&#39;tanggal&#39;]=pd.to_datetime(data_df[&#39;tanggal&#39;], dayfirst=True)<br>data_df.info()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*ehsHKZnxQ8vYg3cBG0rCNw.png" /></figure><p>There’s still one problem. From the picture above the ‘ArAn’ or wind direction column containts string data. Because the algorithm only process numerical data, so we must convert it into numerical. Using pandas.get_dummies() function will not solves the problem because it just convert into 0 and 1. It is quite wrong to treat such directions as merely categorical. We would be losing much of the information. This way adjacent wind directions differ by 1 bit but otherwise pairs of directions don’t equally convey difference on the circle. And, having a values of zeros in several of them does not help to have a bias or noise in the data for when automatic learning algorithms are applied. As we already know, wind direction are 16 in total. So, what is the best way of dealing with these categorical variables? <strong>circular data</strong>, one class of <strong>directional data</strong>. Working with the sine and cosine of the direction is a good idea, so this the code:</p><pre>d={&#39;N&#39;:0, &#39;NNE&#39;:22.5,&quot;NE&quot;:45,&quot;ENE&quot;:67.5, &#39;E&#39;:90,&#39;ESE&#39;:112.5, &#39;SE&#39;:135,&#39;SSE&#39;:157.5, &#39;S&#39;:180,&#39;SSW&#39;:202.5, &#39;SW&#39;:225,&#39;WSW&#39;:247.5, &#39;W&#39;:270,&#39;WNW&#39;:292.5,&#39;NW&#39;:315,&#39;NNW&#39;:337.5, &#39;N&#39;:0,&#39;North&#39;:0,&#39;East&#39;:90,&#39;West&#39;:270,&#39;South&#39;:180}<br>data_df[&#39;ArAn&#39;]=data_df[&#39;ArAn&#39;].str.strip().map(d)<br>data_df.head()</pre><p>Final touch. We make sure there are Not a Number (NaN) values in the every column:</p><pre>data_df.isnull().sum()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/114/1*p3y9oq1gCOrQ2EFEw6EfoQ.png" /></figure><h3>Ordinary Least Squares (OLS) model in Python</h3><p>Since most of the data is numerical, the simplest statistical model to apply is an ordinary Least Squares Regression model.</p><p>We first break up the dataset into a test and training set. We will build the model with the training set, and evaluate its performance with the test set. This ensures the model is as unbiased as possible. To do so:</p><pre>from sklearn.model_selection import train_test_split<br><br>X_train, X_test, y_train, y_test = train_test_split(data_df[[&#39;TEmb&#39;, &#39;Tmpr&#39;, &#39;Tek&#39;, &#39;ArAn&#39;, &#39;KecAn&#39;, &#39;CurHu&#39;]], data_df[[&#39;pm2.5&#39;]], test_size=0.2)</pre><p>To construct the model we can use the <em>statsmodel</em> package. At first I am having problem when using R² because I only have data n=19 since the kurtosistest only valid for n&gt;=20. So, it is computed without centering (uncentered) since the model does not contain a constant. To solve this problem I add constant into X_train and X_test data:</p><pre>import statsmodels.api as sm<br>from statsmodels.api import add_constant<br>import numpy as np<br><br>X_train = add_constant(X_train)<br>X_test = add_constant(X_test)<br>model = sm.OLS(y_train,X_train)<br>results = model.fit()<br>y_pred=results.predict(X_test)<br><br>print(results.summary())</pre><p><strong>The output produces a summary of the regression results and fit parameters for each of the features:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*XnvxoAACXJ3jS7SEsZpdhQ.png" /></figure><p>The R-squared value is extremely poor at just 0.746. To obtain a better understanding of how the model performs, we can run the test set through a Root Mean Square Error (RSME) calculation. This tells us how far the predictions are from the actual values, on average. RMSE needs balance array/matrix. Fortunately, we already does the constant to both X (train and test), so there’s will not be an array/matrix error.</p><pre>from sklearn.metrics import mean_squared_error<br><br>y_pred = results.predict(np.asarray(X_test))<br>mse = mean_squared_error(np.asarray(y_test), y_pred)<br>rmse = mse**0.5<br>print(rmse)</pre><pre>14.492496758430265</pre><p>The predictions given by the model are roughly 15 ug/m3 off, on average.</p><h3>XGBOOST Model in Python</h3><p>There is, however, a more advanced model that can produce a slightly better result. For this, we need the <a href="https://xgboost.readthedocs.io/en/latest/"><em>xgboost</em> package</a>. Extreme gradient boosting is an algorithm that involves building multiple weak predictive models, and iteratively minimizing a cost function (or in our case, the RMSE) that results in a single strong predictive model.</p><p>We begin by install xgboost via pip then do the following code:</p><pre>import xgboost as xgb<br><br>dtest = xgb.DMatrix(X_test, y_test, feature_names=X_test.columns)<br>dtrain = xgb.DMatrix(X_train, y_train,feature_names=X_train.columns)<br><br>param = {&#39;verbosity&#39;:1,<br>        &#39;objective&#39;:&#39;reg:squarederror&#39;,<br>        &#39;booster&#39;:&#39;gblinear&#39;,<br>        &#39;eval_metric&#39; :&#39;rmse&#39;,<br>        &#39;learning_rate&#39;: 1}<br><br>evallist = [(dtrain, &#39;train&#39;)]</pre><p>Now iterate</p><pre>num_round = 30<br>bst = xgb.train(param, dtrain, num_round, evallist)</pre><pre>[0] train-rmse:21.51651<br>[1] train-rmse:20.57458<br>[2] train-rmse:20.30797<br>[3] train-rmse:20.08012<br>[4] train-rmse:19.93057<br>[5] train-rmse:19.77613<br>[6] train-rmse:19.73038<br>[7] train-rmse:19.52375<br>[8] train-rmse:19.39010<br>[9] train-rmse:19.26695<br>[10] train-rmse:19.16895<br>[11] train-rmse:19.08515<br>[12] train-rmse:19.05999<br>[13] train-rmse:18.99746<br>[14] train-rmse:18.89099<br>[15] train-rmse:18.86948<br>[16] train-rmse:18.82145<br>[17] train-rmse:18.78019<br>[18] train-rmse:18.74406<br>[19] train-rmse:18.71215<br>[20] train-rmse:18.68388<br>[21] train-rmse:18.65876<br>[22] train-rmse:18.61814<br>[23] train-rmse:18.59072<br>[24] train-rmse:18.56547<br>[25] train-rmse:18.54285<br>[26] train-rmse:18.52282<br>[27] train-rmse:18.50519<br>[28] train-rmse:18.48967<br>[29] train-rmse:18.47602 #final result</pre><p>From RMSE we can see that the OSL ~14.49 still better then xgboost algorithm ~18.4. The founder of xgboost algorithm itself mentioned that this algorithm is better when we separate data into 6-hours (so from 24 hours we have three separate data).</p><p>Reference:</p><ul><li><a href="https://www.activestate.com/blog/predictive-modeling-of-air-quality-using-python/">https://www.activestate.com/blog/predictive-modeling-of-air-quality-using-python/</a></li><li><a href="https://windy.app/blog/what-is-wind-direction.html">https://windy.app/blog/what-is-wind-direction.html</a></li><li><a href="https://stackoverflow.com/questions/67683766/convert-cardinal-wind-directions-to-degrees%20https://stats.stackexchange.com/questions/355642/dealing-with-categorical-variables-looking-for-recommendations">https://stackoverflow.com/questions/67683766/convert-cardinal-wind-directions-to-degrees%20</a></li><li><a href="https://stackoverflow.com/questions/67683766/convert-cardinal-wind-directions-to-degrees%20https://stats.stackexchange.com/questions/355642/dealing-with-categorical-variables-looking-for-recommendations">https://stats.stackexchange.com/questions/355642/dealing-with-categorical-variables-looking-for-recommendations</a></li><li><a href="https://stackoverflow.com/questions/20701484/why-do-i-get-only-one-parameter-from-a-statsmodels-ols-fit">https://stackoverflow.com/questions/20701484/why-do-i-get-only-one-parameter-from-a-statsmodels-ols-fit</a></li><li><a href="https://medium.com/@alvin.noza/visualisasi-data-jakarta-dan-partikulat-pm-2-5-bdefb01452b">https://medium.com/@alvin.noza/visualisasi-data-jakarta-dan-partikulat-pm-2-5-bdefb01452b</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29be3458e28c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Every Programmer Interview at a Government Company (Based on my Experience).]]></title>
            <link>https://medium.com/@fijaya/every-programmer-interview-at-a-government-company-based-on-my-experience-ec39d6ea55e9?source=rss-49271197df70------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec39d6ea55e9</guid>
            <category><![CDATA[government-office]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[it]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[programmer]]></category>
            <dc:creator><![CDATA[Fijaya Bimasakti]]></dc:creator>
            <pubDate>Thu, 24 Aug 2023 03:59:48 GMT</pubDate>
            <atom:updated>2023-08-24T03:59:48.856Z</atom:updated>
            <content:encoded><![CDATA[<p>Around six month ago I went through an interview process for a programmer role at a government company and I would like to share my experience with you. The interview consisted of several technical questions which were quite easy, and I will be discussing them below.</p><p>Q1. The interviewer asked me to implement containLetters function that, given two words, returns true if all the letters of the first word are contained in the second.<br><br>Example:</p><pre>boolean containLetters(string firstWord, string secondWord)<br><br>containLetters(&#39;cat&#39;,&#39;antarctica&#39;) → returnstrue<br>containLetters(&#39;cat&#39;,&#39;australia&#39;) → returnsfalse<br>containLetters(&#39;cat&#39;,&#39;ANTARCTICA&#39;) → returnstrue</pre><p>Answer:</p><pre>class ContainsExample{  <br>public static void main(String args[]){  <br>String regex = &quot;.*[catCAT].*&quot;;<br>System.out.println(&quot;antartica&quot;.matches(regex));<br>System.out.println(&quot;australia&quot;.matches(regex));<br>System.out.println(&quot;ANTARTICA&quot;.matches(regex));<br>}} </pre><pre>true<br>true<br>true</pre><p>Q2. The interviewer asked me to create a class of dictionary that will containt all words with its synonym:</p><pre>tambah(String kata,Array sinonim): not return value(void)<br>ambilSinonim(String kata) : return array of strings</pre><p>Example:</p><pre>$kamus = new Kamus();<br>$kamus-&gt;tambah(‘big’, [‘large’,‘great’]);<br>$kamus-&gt;tambah(‘big’, [‘huge’, ‘fat’]);<br>$kamus-&gt;tambah(‘huge’, [‘enormous’,‘gigantic’]);<br>// mengembalikan hasil [‘large’, ‘great’, ‘huge’, ‘fat’]<br>$kamus-&gt;ambilSinonim(‘big’);<br>// Perhatikan baik-baik hasil pengujian di bawah ini<br>// mengembalikan hasil [‘big’, ‘enormous’, ‘gigantic’]<br>$kamus-&gt;ambilSinonim(‘huge’);<br>// mengembalikan hasil[‘huge’]<br>$kamus-&gt;ambilSinonim(‘gigantic’);<br>// mengembalikan hasilnull<br>$kamus-&gt;ambilSinonim(‘colossal’);</pre><p>Answer:</p><pre>import java.util.HashMap;<br>import java.util.Set;<br>import java.util.TreeSet;<br> <br>/* untuk fitur sinonimnya */<br>class Synonym<br>{<br> public static void main (String[] args) throws java.lang.Exception<br> {<br>  Set&lt;String&gt; A,B,C,D;<br>  Kamus kamus = new Kamus();<br> <br>  kamus.tambah(&quot;big&quot;, new String[] { &quot;large&quot;, &quot;great&quot; });<br>  kamus.tambah(&quot;big&quot;, new String[] { &quot;huge&quot;, &quot;fat&quot; });<br>  kamus.tambah(&quot;huge&quot;, new String[] { &quot;enormous&quot;, &quot;gigantic&quot; });<br> <br>  A = kamus.ambilSinonim(&quot;big&quot;);<br>  B = kamus.ambilSinonim(&quot;huge&quot;);<br>  C = kamus.ambilSinonim(&quot;gigantic&quot;);<br>  D = kamus.ambilSinonim(&quot;colossal&quot;);<br> <br>  System.out.println(&quot;Sinonim big : &quot; + A);<br>  System.out.println(&quot;Sinonim huge :&quot; + B);<br>  System.out.println(&quot;Sinonim gigantic :&quot; + C);<br>  System.out.println(&quot;Sinonim colossal :&quot; + D);<br> }<br>}<br> <br> /* kelas kamusnya */<br>class Kamus {<br> <br> private HashMap&lt;String, Set&lt;String&gt;&gt; sinonimMap = new HashMap&lt;&gt;();<br> <br> public Set&lt;String&gt; ambilSinonim(String string) {<br>     return sinonimMap.get(string);<br> }<br> <br> public void tambah(String string, String[] sinonim) {<br>     for (String s : sinonim) {<br>      assignSinonim(string, s);<br>      assignSinonim(s, string);<br>     }<br> }<br> <br> private void assignSinonim(String string, String sinonim) {<br>     Set&lt;String&gt; s = sinonimMap.get(string);<br>     if (s == null) {<br>         s = new TreeSet&lt;String&gt;();<br>         sinonimMap.put(string, s);<br>     }<br>     s.add(sinonim);<br> }<br>}</pre><pre>Sinonim big : [fat, great, huge, large]<br>Sinonim huge :[big, enormous, gigantic]<br>Sinonim gigantic :[huge]<br>Sinonim colossal :null</pre><p>Q3. The interviewer asked me to create a class Klasemen that containt points of every soccer club in every match. The mechanism of points are: <br>● The winner will gain 3 point<br>● If there’s a same score between two clubs, then that two clubs will gain 1 point.<br>● Point for lose club will not be increased or decreased.</p><p>The class must implementation these functions:</p><pre>voidcatatPermainan(stringklubKandang,stringklubTandang,stringskor);<br>array cetakKlasemen()<br>string ambilPeringkat(int nomorPeringkat)</pre><p>Example:</p><pre>$klasemen=newKlasemen([‘Liverpool’,‘Chelsea’,‘Arsenal’]);<br>$klasemen&gt;catatPermainan(‘Arsenal’, ‘Liverpool’,‘2:1’);<br>$klasemen&gt;catatPermainan(‘Arsenal’,‘Chelsea’,‘1:1’);<br>$klasemen&gt;catatPermainan(‘Chelsea’,‘Arsenal’,‘0:3’);<br>$klasemen&gt;catatPermainan(‘Chelsea’,‘Liverpool’,‘3:2’);<br>$klasemen&gt;catatPermainan(‘Liverpool’,‘Arsenal’,‘2:2’);<br>$klasemen&gt;catatPermainan(‘Liverpool’,‘Chelsea’,‘0:0’);<br>//mengembalikanhasil[‘Arsenal’=&gt;8,‘Chelsea’=&gt;5,‘Liverpool’=&gt;2]<br>$klasemen&gt;cetakKlasemen();<br>// returns ‘Chelsea’<br>$klasemen&gt;ambilPeringkat(2);</pre><p>Answer:</p><pre>import java.io.BufferedReader;<br>import java.io.IOException;<br>import java.io.InputStreamReader;<br>import java.util.ArrayList;<br>import java.util.Arrays;<br>import java.util.List;<br> <br>class LeagueStandings {<br> <br>    public static void main(String[] args) {<br>        try {<br>            BufferedReader input = new BufferedReader(new InputStreamReader(System.in));<br>            int data = 0;<br>            String[] teamList = new String[data];<br>            for (int i = 0; i &lt; data; i++) {<br>                System.out.print(&quot;Enter club &quot; + (i + 1) + &quot; :\t&quot;);<br>                teamList[i] = Arsenal;<br>            }<br> <br>            System.out.println(&quot;-------------------------------------------------&quot;);<br> <br>            // representing 2D array of team score board where each scoreBoard is of type<br>            //     0      1      2      3       4<br>            // [played] [win] [draw] [loose] [points]<br>            int[][] scoreBoard = new int[data][5];<br>            for (int i = 0; i &lt; data - 1; i++) {<br>                for (int j = i + 1; j &lt; data; j++) {<br>                    System.out.print(teamList[i] + &quot; X &quot; + teamList[j] + &quot; : &quot;);<br>                    String score = input.readLine();<br>                    List&lt;String&gt; scoreList = new ArrayList&lt;String&gt;(Arrays.asList(score.split(&quot; &quot;)));<br>                    scoreList.removeIf(s -&gt; s.equals(&quot;&quot;));<br>                    int teamAScore = Integer.parseInt(scoreList.get(0));<br>                    int teamBScore = Integer.parseInt(scoreList.get(1));<br>                    scoreBoard[i][0]++;<br>                    scoreBoard[j][0]++;<br>                    if (teamAScore &gt; teamBScore) {<br>                        scoreBoard[i][1]++;<br>                        scoreBoard[j][3]++;<br>                        scoreBoard[i][4] += 3;<br>                    } else if (teamAScore == teamBScore) {<br>                        scoreBoard[i][2]++;<br>                        scoreBoard[j][2]++;<br>                        scoreBoard[i][4]++;<br>                        scoreBoard[j][4]++;<br>                    } else {<br>                        scoreBoard[i][3]++;<br>                        scoreBoard[j][1]++;<br>                        scoreBoard[j][4] += 3;<br>                    }<br>                }<br>            }<br> <br>            System.out.format(&quot;%15s%15s%15s%15s%15s%15s\n&quot;, &quot;TEAMS&quot;, &quot;PLAYED&quot;, &quot;WIN&quot;, &quot;DRAW&quot;, &quot;LOOSE&quot;, &quot;POINTS&quot;);<br>            for (int i = 0; i &lt; data; i++) {<br>                System.out.format(&quot;%15s&quot;, teamList[i]);<br>                System.out.format(&quot;%15d%15d%15d%15d%15d\n&quot;, scoreBoard[i][0], scoreBoard[i][1], scoreBoard[i][2], scoreBoard[i][3], scoreBoard[i][4]);<br>            }<br>        } catch (IOException e) {<br>            System.out.println(&quot;Error&quot;);<br>        }<br>    }<br>}</pre><pre>^ answer it with your version :D</pre><p>Finally, the interviewer also asked me about threading and async in Python. I mentioned that these concepts are not commonly used in data analysis as far as I know, and thus, I am not too familiar with them yet.</p><p>He seemed happy with it; he also told me that this role wasn’t exactly about data analysis. I got shocked as the job description had data analysis clearly mentioned along with SQL and Python. He’s going to give me feedback soon. Then, I’ll take a decision. Maybe I’ll add that too here.</p><h3>How did I prepare for the interview?</h3><ol><li><strong>Review the job description and the company:</strong> You must review the job description to see what they are looking for and prepare accordingly. In my case, there wasn’t much details given. But from my experience, when government company need a programmer or other IT role it means they need an IT that can do anything (you must can programming, design, set the projector and ppt slide, fix printer, etc).</li><li><strong>Prepare your tools:</strong> Now, this is also essential. Although, the interviewer sometimes use their computer and online compiler like <a href="https://ideone.com/">https://ideone.com/</a>, but you must bring your own machine with some famous compiler installed like pycharm and visual studio, so at least you can show how prepared you are.</li><li><strong>Know basic algorithm:</strong> Usually, interviewer will give you freedom to use what language that you can to solve the problem. But when they give you specific language, usually that’s will be famous language like java, php, or C. At least you must skilled in one. Practice from two-three months before the interview. You could practice some questions related to the concepts that you don’t feel much comfortable in.</li></ol><p>If you have any questions or want to connect with me, you can find me on:</p><p>LinkedIn at <a href="https://www.linkedin.com/in/fidibsp/">https://www.linkedin.com/in/fidibsp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec39d6ea55e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>