<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: ALI MANSOOR</title>
    <description>The latest articles on Forem by ALI MANSOOR (@theali711).</description>
    <link>https://forem.com/theali711</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F712760%2F2ca1acf5-3641-4b88-9aaf-1e21b2d28107.jpeg</url>
      <title>Forem: ALI MANSOOR</title>
      <link>https://forem.com/theali711</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/theali711"/>
    <language>en</language>
    <item>
      <title>Implementing K-Means Clustering from scratch in Python</title>
      <dc:creator>ALI MANSOOR</dc:creator>
      <pubDate>Mon, 02 May 2022 10:21:23 +0000</pubDate>
      <link>https://forem.com/theali711/implementing-k-means-clustering-from-scratch-in-python-5fo6</link>
      <guid>https://forem.com/theali711/implementing-k-means-clustering-from-scratch-in-python-5fo6</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disclaimer! I am a student learning Datascience, Machine Learning. What I write here might have mistakes, do point them out in comments or reach out directly to me at my &lt;a href="https://www.linkedin.com/in/ali-mansoor-0140a81bb/"&gt;linkedin&lt;/a&gt; account.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is K-Means Clustering?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;k-means clustering is a method of vector quantization, originally from signal processing, that aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean (cluster centers or cluster centroid), serving as a prototype of the cluster. This results in a partitioning of the data space into Voronoi cells. - Wikipedia&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you did not understand this wikipedia definition like me, let me explain it in simpler terms.&lt;br&gt;
In K-means clustering we divide n number of observations into k groups/clusters in such a way that the observations similar to each other are linked in one group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YIRupOD0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3mk1853guk7qe0d61tmo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YIRupOD0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3mk1853guk7qe0d61tmo.gif" alt="K-Means Convergence" width="220" height="214"&gt;&lt;/a&gt;&lt;br&gt;
Image Credits: &lt;a href="https://en.wikipedia.org/wiki/K-means_clustering"&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps for K-Means Clustering
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Decide the value of k, which is the number of groups to divide your observations into.&lt;/li&gt;
&lt;li&gt;Select k random points C (aka centroids) for each cluster within your observations.&lt;/li&gt;
&lt;li&gt;Calculate absolute difference of each point from all centroids.
&lt;code&gt;|X-C|&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Put the observation in the cluster which has the closest centroid. &lt;/li&gt;
&lt;li&gt;Calculate new centroid for each cluster by taking average of all observations in that cluster.&lt;/li&gt;
&lt;li&gt;Repeat step 3-5 until the centroids stop changing.&lt;/li&gt;
&lt;li&gt;You have successfully organized n observations in k clusters.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have also &lt;a href="https://github.com/TheAli711/datascience/tree/main/k-means-clustering"&gt;written the python code&lt;/a&gt; from scratch to implement k-means clustering for n-clusters, it currently works for 2-4 clusters(limited color values) but sometimes goes into infinite loop. if given n values of colors, it can work for n clusters&lt;/p&gt;

&lt;p&gt;Github: &lt;a href="https://github.com/TheAli711/datascience/tree/main/k-means-clustering"&gt;https://github.com/TheAli711/datascience/tree/main/k-means-clustering&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See you guys in the next article :)&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>datascience</category>
      <category>python</category>
    </item>
    <item>
      <title>Automatically deploy your react site with GitHub and Netlify</title>
      <dc:creator>ALI MANSOOR</dc:creator>
      <pubDate>Sat, 02 Apr 2022 03:48:44 +0000</pubDate>
      <link>https://forem.com/theali711/automatically-deploy-your-react-site-with-github-and-netlify-5d00</link>
      <guid>https://forem.com/theali711/automatically-deploy-your-react-site-with-github-and-netlify-5d00</guid>
      <description>&lt;p&gt;Hi guys, this is my first article on &lt;a href="//dev.to"&gt;Dev.to&lt;/a&gt; platform&lt;br&gt;
Today I am going to show you how you can automate your ReactJS deployments on Netlify.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;NPM and NodeJS installed.&lt;/li&gt;
&lt;li&gt;Understanding of React.&lt;/li&gt;
&lt;li&gt;Understanding of git and GitHub.&lt;/li&gt;
&lt;li&gt;Free Netlify and GitHub accounts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Setup ReactJS app
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;npx create-react-app my-portfolio&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NPX
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;npx is a CLI tool whose purpose is to make it easy to install and manage dependencies hosted in the NPM registry. This is awesome because sometimes you just want to use some CLI tools but you don’t want to install them globally just to test them out. This means you can save some disk space and simply run them only when you need them. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 2: Set up GitHub repository
&lt;/h2&gt;

&lt;p&gt;Login to your GitHub account and create a new repository, in the &lt;strong&gt;Initialize this repository with&lt;/strong&gt; section leave everything unchecked&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Link your local code to GitHub repository
&lt;/h2&gt;

&lt;p&gt;Go to the my-portfolio folder created earlier and do the following:&lt;br&gt;
Rename local master branch to main:&lt;br&gt;
&lt;code&gt;git branch -M main&lt;/code&gt;&lt;br&gt;
Add remote repository:&lt;br&gt;
&lt;code&gt;git remote add origin YourGithubRepoUrlHere&lt;/code&gt;&lt;br&gt;
Push local code to GitHub:&lt;br&gt;
&lt;code&gt;git push -u origin main&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Link Netlify to GitHub repository
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Login to your Netlify account.&lt;/li&gt;
&lt;li&gt;Go to the Sites tab and click on Add New Site button.&lt;/li&gt;
&lt;li&gt;Select Import existing project.&lt;/li&gt;
&lt;li&gt;Select GitHub in &lt;strong&gt;Connect to Git Providers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pick the newly created repository.&lt;/li&gt;
&lt;li&gt;Make sure that the branch to deploy is main&lt;/li&gt;
&lt;li&gt;Click deploy site
Your site will be deployed and now whenever there is any change main branch of GitHub, Netlify will automatically build and deploy your site with latest changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bonus: Set up dev branch so you can create merge requests and get preview before deploying on the url
&lt;/h2&gt;

&lt;p&gt;We can create a development branch in the repository where we can do all the changes and when we are confident with our code, we can create a merge request from development branch to main branch, before merging, Netlify will provide us with a deploy preview, on a separate URL, we can test it to see if our website functions as required and then can merge our code into main.&lt;/p&gt;

&lt;p&gt;That's all for this article, Goodbye :)&lt;/p&gt;

</description>
      <category>automation</category>
      <category>react</category>
      <category>github</category>
      <category>netlify</category>
    </item>
  </channel>
</rss>
