<?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 Sahaswari Senanayaka on Medium]]></title>
        <description><![CDATA[Stories by Sahaswari Senanayaka on Medium]]></description>
        <link>https://medium.com/@smsahaswari?source=rss-305f5cf96a08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*j4jk5_Y148-4OGOrMnmL_g.jpeg</url>
            <title>Stories by Sahaswari Senanayaka on Medium</title>
            <link>https://medium.com/@smsahaswari?source=rss-305f5cf96a08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:36:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@smsahaswari/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[Command pattern (Design Pattern)]]></title>
            <link>https://medium.com/@smsahaswari/command-pattern-design-pattern-b8480b1c7e2f?source=rss-305f5cf96a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8480b1c7e2f</guid>
            <dc:creator><![CDATA[Sahaswari Senanayaka]]></dc:creator>
            <pubDate>Tue, 23 Apr 2024 14:52:08 GMT</pubDate>
            <atom:updated>2024-04-23T14:52:08.743Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*L0VFWuMlr4_ZskbNnoyucA.jpeg" /></figure><p>The Command Pattern encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations. It is a behavioral design pattern.</p><p><strong>Pros and cons</strong></p><p>The advantages are by using command pattern,</p><ul><li>Open/Closed Principle.</li><li>Assemble a set of simple commands into a complex one.</li><li>Single Responsibility Principle.<br>However, the code may become more complicated by considering the pattern.</li></ul><h3><strong>Identify the command pattern with a real-world example….</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*7AsvHKyYtWhBWM1Aa_sxiA.jpeg" /></figure><h4><strong>Why we use command patterns in coding…<br></strong>In the below code,</h4><blockquote>if (slot1 == Light)</blockquote><blockquote>light.on();</blockquote><blockquote>Else if (slot1 == Hottub) {</blockquote><blockquote>hottub.prepareJets();</blockquote><blockquote>hottub.jetsOn();</blockquote><blockquote>} Else if (slot1 == TV)</blockquote><blockquote>tv.on();</blockquote><blockquote>etc</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*jKtRZxWkPYHC81jUPsLU1A.jpeg" /></figure><p>The Remote needs to be aware of all the details about turning a device on (or off). If the device On/Off mechanism changes or a new device is added, the Remote code will need to be changed. Is this Open for Extension?? Then the command pattern is used to avoid that problem.</p><p><strong>How to use command design pattern for the smart house example.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*EZUMhdf_AI1JshNu5KWtSA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*AIRuYsrm9MiD12-7nKnbZA.jpeg" /></figure><p><em>Reference: Head First Design Patterns book (Eric Freeman Elisabeth Freeman with Kathy Sierra Bert Bates)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8480b1c7e2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn From Past Mistakes (ESA Ariane 5 Flight failure)]]></title>
            <link>https://medium.com/@smsahaswari/learn-from-past-mistakes-esa-ariane-5-flight-failure-87ec441384d4?source=rss-305f5cf96a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/87ec441384d4</guid>
            <dc:creator><![CDATA[Sahaswari Senanayaka]]></dc:creator>
            <pubDate>Tue, 23 Apr 2024 13:52:41 GMT</pubDate>
            <atom:updated>2024-04-23T13:52:41.037Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*o7-yLq5sEcSBtClpFJNpwg.jpeg" /></figure><h4><strong>What is ESA Ariane 5 Flight Failure</strong></h4><p><strong>•</strong>It was the Ariane 5 rocket, that failed on June 4, 1996.</p><p>•Just 36 seconds after its launch, the rocket engines failed resulting in a loss of over $370 million.</p><p>•The reason is critical errors in the software design. It is about conversion errors from 64-bit to 16-bit data.</p><ul><li>That is one of the most costly damaged projects in the world.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*Ys1juzM7_d0ak1CRcPHHAA.jpeg" /></figure><h4><strong>Violations Against Engineering Ethics (IESL Code of Ethics)</strong></h4><p>•Testing wasn’t enough, so problems went unnoticed. (Clause 07-give evidence, trustful)</p><p>•Pressure to finish quickly. (Clause 06- think employees workability, skills)</p><ul><li>Keeping costs down made safety less important. (Clause 01- Health, safety, and welfare)<br>Also, there are some other violations that can be seen in this past incident.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*mrQHb92WUzsqdGG-P98pLg.jpeg" /></figure><p><strong>Conclusion</strong><br>In conclusion, the ESA Ariane 5 Flight Failure underscores the importance of upholding ethical standards in engineering practices. It serves as a cautionary tale, reminding us that ethical considerations must always take precedence over expediency and cost-saving measures. By prioritizing safety, reliability, and meticulous adherence to established rules and protocols, engineers can mitigate risks and safeguard against the recurrence of such catastrophic failures, ultimately advancing the collective pursuit of innovation while upholding the highest ethical standards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87ec441384d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub and Git]]></title>
            <link>https://medium.com/@smsahaswari/github-and-git-3431e1c69e41?source=rss-305f5cf96a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/3431e1c69e41</guid>
            <dc:creator><![CDATA[Sahaswari Senanayaka]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 22:54:22 GMT</pubDate>
            <atom:updated>2024-03-07T23:06:28.063Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_JfvuQo1j_kRg2R2e4H8_A.jpeg" /></figure><h3>What are Git and GitHub?</h3><p><strong>Git</strong> is an open-source version control system that is used to track changes in source code in software development. It can be used to collaborate on projects for multiple developers. It has many features such as branching, merging, and version history tracking.<br><strong>GitHub</strong> is a web-based platform built around Git. It provides a host for the repositories and issue tracking, project management, and collaboration such as, pull requests and code reviews.</p><h3>How to work Git?</h3><p>Our development files, developments are stored as repositories. When you make changes to the source, git creates a comment.<strong> Comments</strong> is a snapshot of current files. Also, it allows us to revert to the previous commit, comparing changes.</p><p><strong>Branches</strong>: It is a copy of the source code that works parallel to the main version. To save the changes, merge the branch into the main version. It helps to keep teamwork with other developers in the project. If one task is finished, can add features to the main branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*eGS_hu8SDAdgU0aamgRg9w.png" /></figure><h3>Basic Commands</h3><p>For every data science project, we normally use these basic git commands such as creating, saving, checking logs, pushing, and merging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*tQGFAaVh3a5wQxaMRnREXA.jpeg" /></figure><p><strong>git init</strong>: create a Git repository in a local directory. <br><strong>git clone &lt;repo- address&gt;:</strong> get a copy of the entire repository from a remote server to a remote directory. <br><strong>git add &lt;file.txt&gt;</strong>: add a single file or multiple files and folders.<br><strong>git commit -m “<em>message</em>”</strong>: create a snapshot of changes and save it. <br><strong>git config</strong>: used to set user-specific configurations (email, username).<br><strong>git status</strong>: show a list of file changes or show staged and committed things.<br><strong>git push &lt;remote name&gt; &lt;branch name&gt;</strong>: send local commit to the remote branch. <br><strong>git checkout</strong> <strong>-b</strong> <strong>&lt;branch name&gt;</strong>: create a new branch and switch to a new branch. <br><strong>git remote -v</strong>: view all remote repositories.<br><strong>git remote add &lt;remote name&gt; &lt;host or remote URL&gt;: </strong>add a remote server to a local repository.<br><strong>git branch -d &lt;branch name&gt;</strong>: delete branch<br><strong>git pull</strong>: merge commits to a local directory from a remote repository.<br><strong>git merge &lt;branch name&gt;</strong>: blend the changes to the current branch after resolving merge conflicts. <br><strong>git log</strong>: show details of the commits of the current branch.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3431e1c69e41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Heart Disease Prediction]]></title>
            <link>https://medium.com/@smsahaswari/heart-disease-prediction-439726869cf3?source=rss-305f5cf96a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/439726869cf3</guid>
            <dc:creator><![CDATA[Sahaswari Senanayaka]]></dc:creator>
            <pubDate>Sat, 10 Feb 2024 01:48:40 GMT</pubDate>
            <atom:updated>2024-02-10T01:48:40.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="“Estimated 17.9 million lives death each year because cardiovascular diseases, it is approximately 30% of all global deaths” 
 According to the WHO report" src="https://cdn-images-1.medium.com/max/1024/1*79nyCaY4B1rxMTeMcPuDKQ.jpeg" /></figure><p><strong>Background<br></strong>▸“Estimated 17.9 million lives death each year because cardiovascular diseases, it is approximately 30% of all global deaths”<br> <em>-According to the WHO report</em></p><p><strong>Why is the Heart Disease Prediction Important?<br></strong>▸Heart disease prediction is crucial for several reasons, and addressing it effectively can have a significant impact on public health and individual well-being.</p><ul><li>Early Intervention and Prevention</li><li>Resource Allocation</li><li>Reducing Healthcare Costs</li><li>Improving Quality of Life</li><li>Public Health Planning</li><li>Patient Empowerment</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*qPR1b5uwvYI_nbSzpumXHA.jpeg" /></figure><p><strong>Problem Statement<br></strong>▸Early, we used</p><ul><li>medical history of a patient,</li><li>physical test results,</li><li>investigation of related symptoms by doctors for heart disease prediction.</li></ul><p>▸But it had some limitations of the traditional and manual approach.</p><ul><li>Limited Variable</li><li>Human Bias</li><li>Lack of Scalability</li><li>Inability to Learn and Adapt</li><li>Incomplete data Integration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*Nnad1ErERsKwP6MHMkZkgA.jpeg" /></figure><p><strong>Find a solution using ML <br></strong>▸Machine learning (ML) techniques offer a more advanced and efficient approach to predicting heart diseases:</p><ul><li>Feature Extraction</li><li>Complex Pattern Recognition</li><li>Scalability</li><li>Continuous Learning</li><li>Personalized Predictions</li></ul><p><strong>Methodology<br><em>Data Set <br>-</em></strong>Choose 4238 records with 14 features and It is an imbalanced data set (10 years of risk of CHD: No — 3594, Yes — 644).<br>Link: <a href="https://www.kaggle.com/datasets/dileep070/heart-disease-prediction-using-logistic-regression/data">https://www.kaggle.com/datasets/dileep070/heart-disease-prediction-using-logistic-regression/data</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8n8k5UOXcstHrNIHf1Duw.png" /><figcaption>Data Set</figcaption></figure><p><strong>Methodology<br></strong>▸It belongs to supervised learning and classification problems.</p><ul><li>SVM</li><li>Random Forest</li></ul><p><strong>Steps for implementation<br></strong>Data Preposesing for SVM</p><ul><li>Use the value of the median to fill in the blanks</li><li>Feature selection</li><li>Handle imbalanced data</li><li>Remove duplicate values</li><li>Feature scaling</li></ul><p>Data Preposesing for RF</p><ul><li>Use the value of the median to fill in the blanks</li><li>Handle imbalanced data</li><li>Remove duplicate values</li></ul><p><strong>Data Pre-processing<br><em>Null value handling</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*X9QcCsiG5YDXi_Fl8qPm4A.png" /></figure><p>According to the data set, the following features consist of null values.</p><p>• Education</p><p>• CigsPerDay</p><p>• BPMeds</p><p>• TotalChol</p><p>• BMI</p><p>• HeartRate</p><ul><li>Glucose</li></ul><p>According to the data set, most of the features are skewed. Then, replace the null value using the median.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*hJMM96GJhHxu4Rg5XGQxfg.png" /></figure><p><strong><em>Feature selection<br></em></strong>•Select the 10 most mutual features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*wmlyJH0sV9rghrLCDOmRwA.png" /></figure><p><strong><em>Handle imbalanced data<br></em></strong>•Imbalanced data set -10 years of risk of CHD: No — 3594 and Yes — 644</p><p>•Balance the imbalanced data set using the Oversampling technique. SMOTE (Synthetic Minority Oversampling Technique)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*i1-na2JUSspKt5VIBRUckA.png" /></figure><p><strong><em>Feature scaling<br></em></strong>▸Use the standardization method for scaling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HIsKjAek3iKPRQxQ3y8Uwg.png" /></figure><p><strong>Results<br><em>Performance Measure — SVM<br></em></strong>Use the confusion matrix<br>▸Accuracy is 75.24%</p><p>▸Precision is 73.11%</p><p>▸Recall is 79.00%</p><p>▸F1 score is 0.75</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*0PWg4i4d-6dTrDAaRLyoAg.png" /></figure><p><strong><em>Performance Measure — RF<br></em></strong>Use the confusion matrix<br>▸Accuracy is 91.17%</p><p>▸Precision is 91.04%</p><p>▸Recall is 90.38%</p><p>▸F1 score is 0.91</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*JZbvtj-4_hIA9C7RrfOpuw.png" /></figure><p><strong>Ethics<br></strong>Building a Heart Disease prediction model using Machine Learning (ML) raises several ethical considerations.<br>▸Privacy Concerns</p><p>▸Bias and Fairness</p><p>▸Security Measures</p><p>▸Transparency and Explainability</p><p>▸Data Quality and Representativeness</p><p><strong>Conclusion<br></strong>Random Forest demonstrated superior performance on our imbalanced heart disease dataset.</p><ul><li>ensemble nature of RF</li><li>robustness to noise</li><li>built-in mechanisms for handling imbalanced data</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=439726869cf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Problems Make a Strong Person]]></title>
            <link>https://medium.com/@smsahaswari/problems-make-a-strong-person-5f93a3b32209?source=rss-305f5cf96a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f93a3b32209</guid>
            <dc:creator><![CDATA[Sahaswari Senanayaka]]></dc:creator>
            <pubDate>Sun, 23 Jul 2023 07:41:49 GMT</pubDate>
            <atom:updated>2023-07-23T07:41:49.169Z</atom:updated>
            <content:encoded><![CDATA[<p>When you think, I can not do that and I’m a weak person You can not do that never. I will tell a true story, there is a family which has five members. Farther, mother, two boys, and one girl. Farther is a farmer and mother hasn’t a job. Because of that, they live in very poor life. As per their family statement, the girl wants to study hard and save their family. She met a lot of barriers during her study. However, she could enter the university medical faculty for her higher education. Now the family has a medical student, and because of that, they want to spend a lot of money on her education as well.</p><p>While going time, the two boys also study hard. One boy did mathematics and the other boy did Biology for A/L. After a few months, one boy’s eyes were weakened. So he faced an operation at this time. however, did not stop his study. Finally, the results of the A/L examination came. The boy who faced eye weakness had got selected to the best university for Engineering. Other boys also select to the university for higher education. but he could achieve good results same as the first boy.</p><p>According to that, we can get the idea about, p<strong>roblems make a strong person and never he or she is not stopped by any other barriers. Be a strong person in your life.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f93a3b32209" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>