<?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 Ashwin M on Medium]]></title>
        <description><![CDATA[Stories by Ashwin M on Medium]]></description>
        <link>https://medium.com/@ashes192000?source=rss-1eda8367b203------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EMZTwpfzXlDbFA-q2WCCyA.jpeg</url>
            <title>Stories by Ashwin M on Medium</title>
            <link>https://medium.com/@ashes192000?source=rss-1eda8367b203------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 16:44:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashes192000/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[MySQL Table Partitioning for Multi-Tenant Applications: A Performance Case Study]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ashes192000/mysql-table-partitioning-for-multi-tenant-applications-a-performance-case-study-f9c136e2efa3?source=rss-1eda8367b203------2"><img src="https://cdn-images-1.medium.com/max/1500/1*pBgp-l6f1WBLJ1biBo2HXw.png" width="1500"></a></p><p class="medium-feed-snippet">When building multi-tenant applications, one of the first challenges is managing large datasets efficiently.</p><p class="medium-feed-link"><a href="https://medium.com/@ashes192000/mysql-table-partitioning-for-multi-tenant-applications-a-performance-case-study-f9c136e2efa3?source=rss-1eda8367b203------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ashes192000/mysql-table-partitioning-for-multi-tenant-applications-a-performance-case-study-f9c136e2efa3?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9c136e2efa3</guid>
            <category><![CDATA[multitenancy]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[partitioning]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Fri, 17 Oct 2025 19:05:35 GMT</pubDate>
            <atom:updated>2025-10-17T19:05:35.286Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding Node.js Clustering and the Need for Shared Session Storage]]></title>
            <link>https://medium.com/@ashes192000/understanding-node-js-clustering-and-the-need-for-shared-session-storage-556c8ad0d873?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/556c8ad0d873</guid>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[shared-memory]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Wed, 09 Apr 2025 19:13:32 GMT</pubDate>
            <atom:updated>2025-04-09T19:13:32.117Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of high-performance Node.js applications, <strong>clustering</strong> is a powerful technique to scale your app across multiple CPU cores. However, it introduces a new challenge: <strong>data sharing between isolated processes</strong>. In this post, we will explore Node.js clustering, the concept of workers, and a real-world use case where session sharing is essential.</p><h3>What is Clustering in Node.js?</h3><p>Node.js runs in a <strong>single-threaded</strong> environment, which means by default, only one CPU core is used. Modern machines often have multiple cores, and clustering allows us to utilize all of them.</p><p>The cluster module in Node.js enables us to spawn <strong>multiple worker processes</strong>, all running the same code. Each worker handles incoming HTTP requests independently, and the OS or master process distributes requests among them.</p><pre>const cluster = require(&#39;cluster&#39;);<br>const os = require(&#39;os&#39;);<br>const express = require(&#39;express&#39;);</pre><pre>if (cluster.isMaster) {<br>  const numCPUs = os.cpus().length;<br>  for (let i = 0; i &lt; numCPUs; i++) {<br>    cluster.fork();<br>  }<br>} else {<br>  const app = express();<br>  app.get(&#39;/&#39;, (req, res) =&gt; res.send(`Handled by PID ${process.pid}`));<br>  app.listen(3000);<br>}</pre><p>Each forked worker is an independent process, meaning they do not share memory or data.</p><h3>The Concept of Workers</h3><p>When you run your Node.js application in cluster mode:</p><ul><li>The <strong>master process</strong> forks multiple <strong>worker processes</strong></li><li>Each <strong>worker</strong> runs the same server code and listens to the same port</li><li>The master balances incoming requests across these workers</li></ul><blockquote><em>Example: “Cluster mode with 4 workers” means 4 independent Node.js processes are handling requests.</em></blockquote><h3>Real-World Problem: Session Management</h3><p>Consider you are building an Express application using express-session for authentication. By default, sessions are stored in memory.</p><h3>Problem:</h3><ol><li>User logs in, and their session is stored in Worker 1’s memory.</li><li>Next request from the same user goes to Worker 3 (due to load balancing).</li><li>Worker 3 doesn’t have the session info — resulting in the user being logged out.</li></ol><p>This happens because <strong>memory is not shared</strong> across workers.</p><h3>Solution: Use a Shared Session Store (Redis)</h3><p>To resolve this, store sessions in an <strong>external, shared location</strong> like <strong>Redis</strong>.</p><h3>Setup with Redis:</h3><pre>npm install express-session connect-redis ioredis</pre><h3>Code Example:</h3><pre>const session = require(&#39;express-session&#39;);<br>const RedisStore = require(&#39;connect-redis&#39;)(session);<br>const Redis = require(&#39;ioredis&#39;);</pre><pre>const redisClient = new Redis();</pre><pre>app.use(session({<br>  store: new RedisStore({ client: redisClient }),<br>  secret: &#39;my-secret&#39;,<br>  resave: false,<br>  saveUninitialized: false,<br>  cookie: { secure: false } // Set true if using HTTPS<br>}));</pre><p>Now, all workers access session data from Redis, ensuring consistency.</p><h3>How the OS Handles Clustering</h3><p>When a request comes:</p><ul><li>The <strong>master</strong> process accepts it</li><li>It uses <strong>round-robin</strong> or OS-level scheduling to forward it to a worker</li><li>The chosen <strong>worker handles</strong> the request completely</li></ul><p>If the worker is doing async tasks (e.g., DB calls), it doesn’t block the process — thanks to Node’s event loop.</p><h3>Use Cases That Require Shared Storage</h3><p>Use Case Shared Store Used Session management Redis / DB Rate limiting (IP-based) Redis Real-time user analytics Redis / PubSub WebSocket sticky sessions Redis + Load Balancer Cart/session persistence Redis / DB File upload progress tracking Redis</p><h3>FAQs</h3><h3>1. Is clustering multithreading?</h3><blockquote><em>No, it’s multi-process. Each worker is a separate single-threaded process.</em></blockquote><h3>2. Do workers share memory?</h3><blockquote><em>No. Use Redis or DB for shared data.</em></blockquote><h3>3. Can I use native variables to share data?</h3><blockquote><em>No. They’ll be isolated to the process they are created in.</em></blockquote><h3>4. Can workers communicate?</h3><blockquote><em>Yes, via inter-process communication (IPC), but it’s limited. Prefer external stores.</em></blockquote><h3>5. Does PM2 support clustering?</h3><blockquote><em>Yes! PM2 makes clustering production-ready using </em><em>pm2 start app.js -i max</em></blockquote><h3>6. Is clustering helpful for async apps?</h3><blockquote><em>Yes — although Node.js handles async well, clustering allows usage of all CPU cores.</em></blockquote><h3>Advanced Considerations for Production Systems</h3><h3>Worker Crash Handling</h3><p>Workers can crash due to unhandled exceptions. A production-grade cluster should monitor worker health:</p><pre>cluster.on(&#39;exit&#39;, (worker, code, signal) =&gt; {<br>  console.log(`Worker ${worker.process.pid} died. Restarting...`);<br>  cluster.fork();<br>});</pre><h3>Sticky Sessions for WebSocket Support</h3><p>WebSocket connections must be consistently handled by the same worker. Solutions:</p><ul><li>Use a <strong>sticky-session proxy</strong> (e.g., Nginx or HAProxy)</li><li>Use <strong>socket.io with Redis adapter</strong> to sync events across workers</li></ul><h3>Horizontal Scaling (Multiple Machines)</h3><p>Clustering scales vertically on a single machine. For horizontal scaling:</p><ul><li>Deploy to multiple machines</li><li>Use a load balancer (e.g., Nginx, AWS ELB)</li><li>Combine with Redis or DB for shared state</li></ul><h3>Performance Monitoring</h3><p>Use tools like:</p><ul><li><strong>PM2</strong> for cluster management &amp; monitoring</li><li><strong>New Relic</strong> or <strong>Datadog</strong> for application metrics</li><li><strong>Redis INFO command</strong> to monitor session store performance</li></ul><h3>Conclusion</h3><p>Node.js clustering boosts performance by running your app across multiple processes. But, for shared data like sessions, you must use an external store like Redis. Understanding how to properly manage session data in a clustered environment is crucial for building scalable, consistent, and reliable applications.</p><p>As your application grows, consider advanced topics like crash recovery, WebSocket handling, and horizontal scaling. Combined, these practices help ensure your Node.js app is both resilient and scalable.</p><p>Happy scaling! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=556c8ad0d873" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple Book Hub Application in Go: A Comprehensive Guide]]></title>
            <link>https://medium.com/@ashes192000/building-a-simple-book-hub-application-in-go-a-comprehensive-guide-ce5f54f8eda9?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce5f54f8eda9</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[gorm]]></category>
            <category><![CDATA[gorilla-mux]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 13:09:14 GMT</pubDate>
            <atom:updated>2024-07-14T13:10:33.718Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vqwU_i0K2n-mS-D2" /><figcaption>Photo by <a href="https://unsplash.com/@geekgunda?utm_source=medium&amp;utm_medium=referral">Chinmay B</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Are you looking to build a web application in Go? This blog post will walk you through the creation of a simple Book Hub application using Go. By the end of this guide, you’ll have a solid understanding of Go’s powerful features, including structs, pointers, and interfaces, and how to leverage them to build a functional web application.</p><h3>Project Overview</h3><p>Our Book Hub application will allow users to perform CRUD (Create, Read, Update, Delete) operations on a collection of books. We’ll be using the Gorilla Mux package for routing and GORM (Go Object-Relational Mapping) for interacting with a MySQL database.</p><h3>Folder Structure</h3><p>Here’s a quick overview of the project structure:</p><pre>BookHub/<br>├── cmd/<br>│ └── main/<br>│ └── main.go<br>├── pkg/<br>│ ├── config/<br>│ │ └── app.go<br>│ ├── controllers/<br>│ │ └── controller.go<br>│ ├── models/<br>│ │ └── models.go<br>│ ├── routes/<br>│ │ └── routes.go<br>│ └── utils/<br>│ └── utils.go<br>└── .gitignore</pre><h4>File Descriptions</h4><p>- `cmd/main/main.go`: Entry point for the application. Contains the `main` function.<br>- `pkg/controllers/controller.go`: Handles the business logic for our routes.<br>- `pkg/config/app.go`: Manages the application configuration, including database connections.<br>- `pkg/routes/routes.go`: Defines the application’s routes.<br>- `pkg/models/models.go`: Defines the data models and handles database operations.<br>- `pkg/utils/utils.go`: Contains utility functions, such as parsing request bodies.</p><h3>Detailed Explanation of Each Component</h3><h4>main.go</h4><p>The `main.go` file is the entry point of our application. It sets up the HTTP server and registers the routes.</p><pre>package main<br>import (<br> &quot;log&quot;<br> &quot;net/http&quot;<br> &quot;github.com/gorilla/mux&quot;<br> _ &quot;github.com/jinzhu/gorm/dialects/mysql&quot;<br> &quot;github.com/Ashwin202/go-bookhub/pkg/routes&quot;<br>)<br>func main() {<br> r := mux.NewRouter()<br> routes.RegisterBookStoreRoutes(r)<br> http.Handle(&quot;/&quot;, r)<br> log.Print(&quot;Listening on port 9000&quot;)<br> log.Fatal(http.ListenAndServe(&quot;localhost:9000&quot;, r))<br>}</pre><h4>routes.go</h4><p>In the `routes.go` file, we define the routes for our application.</p><pre>package routes<br>import (<br> &quot;github.com/gorilla/mux&quot;<br> &quot;github.com/Ashwin202/go-bookhub/pkg/controllers&quot;<br>)<br>var RegisterBookStoreRoutes = func(router *mux.Router) {<br> router.HandleFunc(&quot;/book/&quot;, controllers.CreateBook).Methods(&quot;POST&quot;)<br> router.HandleFunc(&quot;/book/&quot;, controllers.GetAllBooks).Methods(&quot;GET&quot;)<br> router.HandleFunc(&quot;/book/{bookId}&quot;, controllers.GetBookById).Methods(&quot;GET&quot;)<br> router.HandleFunc(&quot;/book/{bookId}&quot;, controllers.UpdateBookById).Methods(&quot;PUT&quot;)<br> router.HandleFunc(&quot;/book/{bookId}&quot;, controllers.DeleteBookById).Methods(&quot;DELETE&quot;)<br>}</pre><h4>controller.go</h4><p>The `controller.go` file contains the logic for handling HTTP requests and interacting with the models.</p><pre>package controllers<br>import (<br> &quot;encoding/json&quot;<br> &quot;net/http&quot;<br> &quot;github.com/gorilla/mux&quot;<br> &quot;github.com/Ashwin202/go-bookhub/pkg/models&quot;<br> &quot;github.com/Ashwin202/go-bookhub/pkg/utils&quot;<br> &quot;strconv&quot;<br>)<br>var CreateBook = func(w http.ResponseWriter, r *http.Request) {<br> var book models.Book<br> utils.ParseBody(r, &amp;book)<br> b := book.CreateBook()<br> marshalledBook, _ := json.Marshal(b)<br> w.WriteHeader(http.StatusCreated)<br> w.Write(marshalledBook)<br>}<br>var GetAllBooks = func(w http.ResponseWriter, r *http.Request) {<br> allBooks := models.GetAllBooks()<br> marshalledBooks, _ := json.Marshal(allBooks)<br> w.WriteHeader(http.StatusOK)<br> w.Write(marshalledBooks)<br>}<br>var GetBookById = func(w http.ResponseWriter, r *http.Request) {<br> vars := mux.Vars(r)<br> bookID := vars[&quot;bookId&quot;]<br> ID, err := strconv.ParseInt(bookID, 0, 0)<br> if err != nil {<br> w.WriteHeader(http.StatusBadRequest)<br> w.Write([]byte(&quot;please send correct book id&quot;))<br> return<br> }<br> bookDetails, _ := models.GetBookById(ID)<br> marshalledBook, _ := json.Marshal(bookDetails)<br> w.WriteHeader(http.StatusOK)<br> w.Write(marshalledBook)<br>}<br>var UpdateBookById = func(w http.ResponseWriter, r *http.Request) {<br> vars := mux.Vars(r)<br> bookID := vars[&quot;bookId&quot;]<br> var newBookDetails models.Book<br> utils.ParseBody(r, &amp;newBookDetails)<br> ID, err := strconv.ParseInt(bookID, 0, 0)<br> if err != nil {<br> w.WriteHeader(http.StatusBadRequest)<br> w.Write([]byte(&quot;please send correct book id&quot;))<br> return<br> }<br> bookDetails, db := models.GetBookById(ID)<br> bookDetails.Name = newBookDetails.Name<br> bookDetails.Author = newBookDetails.Author<br> bookDetails.Publication = newBookDetails.Publication<br>db.Save(&amp;bookDetails)<br> marshalledBook, _ := json.Marshal(bookDetails)<br> w.WriteHeader(http.StatusOK)<br> w.Write(marshalledBook)<br>}<br>var DeleteBookById = func(w http.ResponseWriter, r *http.Request) {<br> vars := mux.Vars(r)<br> bookID := vars[&quot;bookId&quot;]<br> ID, err := strconv.ParseInt(bookID, 0, 0)<br> if err != nil {<br> w.WriteHeader(http.StatusBadRequest)<br> w.Write([]byte(&quot;please send correct book id&quot;))<br> return<br> }<br> bookDetails := models.DeleteBookById(ID)<br> marshalledBook, _ := json.Marshal(bookDetails)<br> w.WriteHeader(http.StatusOK)<br> w.Write(marshalledBook)<br>}</pre><h4>models.go</h4><p>In the `models.go` file, we define the data models and the functions to interact with the database.</p><pre>package models<br>import (<br> &quot;github.com/jinzhu/gorm&quot;<br> &quot;github.com/Ashwin202/go-bookhub/pkg/config&quot;<br>)<br>var db *gorm.DB<br>type Book struct {<br> gorm.Model<br> Name string `gorm:&quot;&quot; json:&quot;name&quot;`<br> Author string `json:&quot;author&quot;`<br> Publication string `json:&quot;publication&quot;`<br>}<br>func init() {<br> config.Connect()<br> db = config.DB<br> db.AutoMigrate(&amp;Book{})<br>}<br>func (b *Book) CreateBook() *Book {<br> db.NewRecord(b)<br> db.Create(&amp;b)<br> return b<br>}<br>func GetAllBooks() []Book {<br> var books []Book<br> db.Find(&amp;books)<br> return books<br>}<br>func GetBookById(Id int64) (*Book, *gorm.DB) {<br> var getbook Book<br> db := db.Where(&quot;id = ?&quot;, Id).Find(&amp;getbook)<br> return &amp;getbook, db<br>}<br>func DeleteBookById(Id int64) Book {<br> var book Book<br> db.Where(&quot;id = ?&quot;, Id).Delete(&amp;book)<br> return book<br>}</pre><h4>Understanding Pointers and Structs</h4><blockquote>Why Are Models Defined in This Way?<br>- Models are defined using structs to represent data in a structured format.<br>- The `gorm.Model` struct is embedded to provide fields like ID, CreatedAt, UpdatedAt, and DeletedAt.</blockquote><blockquote>Why Use Pointers for Parameters and Returns?<br>- Pointers are used to reference memory locations, allowing functions to modify the original data without copying it.<br>- Using pointers for parameters and returns helps manage memory efficiently, especially with large data structures.</blockquote><blockquote>What Does `func init()` Do?<br>- The `init()` function initializes the package. It’s called automatically when the package is imported.<br>- In our model, `init()` connects to the database and performs auto-migration.</blockquote><blockquote>Why Use Structs?<br>- Structs group together variables under a single name, defining a new data type.<br>- They provide a way to model real-world entities and their attributes.</blockquote><h4>utils.go</h4><p>The `utils.go` file contains utility functions, such as parsing request bodies.</p><pre>package utils<br>import (<br> &quot;encoding/json&quot;<br> &quot;net/http&quot;<br> &quot;io/ioutil&quot;<br>)<br>func ParseBody(r *http.Request, x interface{}) {<br> if body, err := ioutil.ReadAll(r.Body); err == nil {<br> if err := json.Unmarshal([]byte(body), x); err != nil {<br> return<br> }<br> }<br>}</pre><h4>app.go</h4><p>The `app.go` file manages the application configuration, including the database connection.</p><pre>package config<br>import (<br> &quot;os&quot;<br> &quot;fmt&quot;<br> &quot;github.com/jinzhu/gorm&quot;<br> _ &quot;github.com/jinzhu/gorm/dialects/mysql&quot;<br> &quot;github.com/joho/godotenv&quot;<br>)<br>var DB *gorm.DB<br>func Connect() {<br> godotenv.Load()<br> databaseURI := fmt.Sprintf(&quot;%s:%s@tcp(%s)/%s?charset=utf8&amp;parseTime=True&amp;loc=Local&quot;,<br> os.Getenv(&quot;DATABASE_USER&quot;),<br> os.Getenv(&quot;DATABASE_PASSWORD&quot;),<br> os.Getenv(&quot;DATABASE_URL&quot;),<br> os.Getenv(&quot;DATABASE_NAME&quot;))<br> d, err := gorm.Open(&quot;mysql&quot;, databaseURI)<br> if err != nil {<br> panic(err)<br> }<br> DB = d<br>}<br>func GetDB() *gorm.DB {<br> return DB<br>}</pre><h3>Conclusion</h3><p>By following this guide, you’ve learned how to build a simple Book Hub application in Go. We’ve covered:</p><ul><li>Setting up the project structure and understanding the purpose of each file.</li><li>Defining and using structs to model data.</li><li>Utilizing pointers for efficient memory management and function interactions.</li><li>Implementing CRUD operations using GORM.</li><li>Setting up routing with Gorilla Mux.</li><li>Parsing request bodies and managing database connections with utility functions.</li></ul><p>This project showcases the power and simplicity of Go in building web applications. With these concepts and techniques, you’re well-equipped to expand this project further or create your own web applications in Go. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce5f54f8eda9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Potential: Dive into the World of Progressive Web Apps]]></title>
            <link>https://medium.com/@ashes192000/unlocking-the-potential-dive-into-the-world-of-progressive-web-apps-62715d64d74f?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/62715d64d74f</guid>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Sat, 24 Feb 2024 10:31:38 GMT</pubDate>
            <atom:updated>2024-02-24T10:33:04.213Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*SFlIF-lrmPSdlNtIAW3f9A.png" /></figure><p>Lets begin with a story,<br>Once upon a time in the big world of the internet, there were two kinds of digital places: websites and apps. Websites were like big playgrounds everyone could visit, but sometimes they didn’t work very well on different devices. Apps, on the other hand, worked really well on phones and tablets, but only on certain ones.</p><p>Then, something special came along called a Progressive Web App (PWA). It was like a magical mix of a website and an app! PWAs could do cool things like work even when there wasn’t any internet and look nice on all kinds of devices, just like magic.</p><p>People liked PWAs a lot because they were easy to use and worked for everyone, no matter what device they had. And so, PWAs became a favorite for people who wanted the best of both worlds in one neat package.</p><h3>What is Progressive Web App?</h3><p>A Progressive Web App (PWA) is a type of web application that utilizes modern web technologies to provide users with an app-like experience directly through their web browser. PWAs offer features typically associated with native mobile apps, such as offline functionality, push notifications, and the ability to be installed on a device’s home screen, while maintaining the accessibility and universality of traditional websites. They are designed to work across various platforms and devices, delivering a consistent and engaging user experience regardless of the device or network conditions.</p><h3>The Superpowers of Progressive Web Apps (PWAs)</h3><h4>PWAs vs. Native Apps:</h4><ul><li>PWAs work on all devices like magic, while native apps need different versions for each device.</li><li>You can get PWAs straight from the internet, but native apps need to go through special stores.</li></ul><h4>PWAs vs. Traditional Websites:</h4><ul><li>PWAs feel like cool apps but live on the internet, just like regular websites.</li><li>They can work even when the internet is acting funny, unlike regular websites.</li></ul><h4>Why PWAs Are Awesome:</h4><ul><li>PWAs give you a special app feeling, but you can share them easily like a website.</li><li>They can do neat things even without the internet, like sending you messages.</li><li>PWAs are super fast and don’t make you wait, just like turning on a light switch!</li></ul><h3>To Get Started</h3><p><strong>Understanding of Web Technologies</strong>:</p><ul><li>Familiarize yourself with HTML, CSS, and JavaScript, as these are the building blocks of web development.</li><li>Learn about modern JavaScript frameworks and libraries such as React, Angular, or Vue.js, which can streamline PWA development.</li></ul><p><strong>Knowledge of PWA Principles:</strong></p><ul><li>Understand the core principles of PWAs, including service workers, web app manifests, and responsive design.</li><li>Explore the capabilities and features that differentiate PWAs from traditional web applications.</li></ul><p><strong>Development Environment:</strong></p><ul><li>Set up a development environment on your computer.</li><li>Choose a code editor like Visual Studio Code, Sublime Text, or Atom.</li><li>Install Node.js and npm (Node Package Manager) for managing project dependencies.</li></ul><p><strong>Learn Service Workers:</strong></p><ul><li>Service workers are a crucial component of PWAs responsible for caching resources and enabling offline functionality.</li><li>Learn how to implement and configure service workers in your web application.</li></ul><p>Example:</p><pre>// Service Worker Code<br>self.addEventListener(&#39;install&#39;, event =&gt; {<br>  event.waitUntil(<br>    caches.open(&#39;my-cache-v1&#39;).then(cache =&gt; {<br>      return cache.addAll([<br>        &#39;/index.html&#39;,<br>        &#39;/styles.css&#39;,<br>        &#39;/script.js&#39;,<br>        &#39;/images/logo.png&#39;<br>      ]);<br>    })<br>  );<br>});<br><br>// Fetch Event<br>self.addEventListener(&#39;fetch&#39;, event =&gt; {<br>  event.respondWith(<br>    caches.match(event.request).then(response =&gt; {<br>      return response || fetch(event.request);<br>    })<br>  );<br>});js</pre><p><strong>Manifest File:</strong></p><ul><li>Understand the importance of the web app manifest file in defining the appearance and behavior of your PWA when installed on a device’s home screen.</li><li>Learn how to create and configure the manifest file to provide a native app-like experience.</li></ul><p>Example</p><pre>{<br>  &quot;name&quot;: &quot;My Progressive Web App&quot;,<br>  &quot;short_name&quot;: &quot;MyPWA&quot;,<br>  &quot;start_url&quot;: &quot;/index.html&quot;,<br>  &quot;display&quot;: &quot;standalone&quot;,<br>  &quot;background_color&quot;: &quot;#ffffff&quot;,<br>  &quot;theme_color&quot;: &quot;#2196f3&quot;,<br>  &quot;icons&quot;: [<br>    {<br>      &quot;src&quot;: &quot;/images/icon-192x192.png&quot;,<br>      &quot;sizes&quot;: &quot;192x192&quot;,<br>      &quot;type&quot;: &quot;image/png&quot;<br>    },<br>    {<br>      &quot;src&quot;: &quot;/images/icon-512x512.png&quot;,<br>      &quot;sizes&quot;: &quot;512x512&quot;,<br>      &quot;type&quot;: &quot;image/png&quot;<br>    }<br>  ]<br>}</pre><p><strong>HTTPS Setup:</strong></p><ul><li>PWAs require a secure HTTPS connection to ensure the integrity and security of data transmission.</li><li>Set up HTTPS for your development environment and deploy your PWA on a secure hosting platform.</li></ul><p><strong>Testing and Debugging:</strong></p><ul><li>Learn how to test and debug PWAs across different devices and browsers.</li><li>Utilize browser developer tools and testing frameworks to identify and fix issues during development.</li></ul><p><strong>Performance Optimization:</strong></p><ul><li>Explore techniques for optimizing the performance of your PWA, such as lazy loading, code splitting, and image optimization.</li><li>Ensure that your PWA loads quickly and provides a smooth user experience, even on low-end devices and slow networks.</li></ul><p><strong>Accessibility and SEO:</strong></p><ul><li>Consider accessibility guidelines and best practices to ensure that your PWA is usable by everyone, including users with disabilities.</li><li>Implement SEO (Search Engine Optimization) techniques to improve the discoverability and visibility of your PWA in search engine results.</li></ul><p>In the ever-evolving realm of web development, Progressive Web Apps stand out as a revolutionary blend, seamlessly integrating the best of traditional websites and native applications. Embarking on a captivating journey through the realms of coding ingenuity and creative innovation, we delve into the enchanting synergy of service workers and web app manifests. Together, let’s unlock the boundless potential of PWAs, charting a course towards redefined user experiences and a transformed digital landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62715d64d74f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph Neural Networks-Part 4]]></title>
            <link>https://medium.com/@ashes192000/graph-neural-networks-part-4-e54251d0256d?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/e54251d0256d</guid>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[graph]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 08:25:10 GMT</pubDate>
            <atom:updated>2022-01-14T08:25:10.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*ABUdJ0RuRgdK0VQI.png" /></figure><p>In part 3 of the series, I explained the basics of Graph Neural Networks.<br><br>If you haven’t gone through the same please check out <a href="https://link.medium.com/L7tIsXv2Nmb">Graph Neural Networks- Part 3</a></p><p>In this part, I’ll explain what is Graph Convolutional Networks.</p><p>Before getting into it have you ever thought that how you get the recommendations on your social media like Instagram, Twitter, etc?</p><p>Persons who are coming recommendations will have some sort of connection with us for example he/she may be our second connection. At this point, everyone will doubt how the data is been shared?</p><p>This sharing of data or feature vectors can be explained using Graph Convolutional Networks.</p><p><strong>Message Passing Layers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*O9F_Ssn0Aa5LgbfoBjmGWg.gif" /></figure><p>The graph information including node features and structural properties and fed through the message passing layers. These layers are made up of node embeddings that contain the knowledge of other nodes and edges in a compressed format. This is done by gathering the current node information of the neighbor nodes combining it in a certain way to get a new embedding updating it to form new embeddings. This is also called <strong>Graph convolution.</strong></p><p>Let&#39;s look into the working of Message passing layers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*Gmko_TfjwhkDx9JUR_p5rA.png" /><figcaption>Source-Deepfindr</figcaption></figure><p>Let&#39;s assume this is our input graph. Here you can see a yellow node with number 1 with a yellow-colored feature vector. This is the nod that we are focused on the following. To update the node state we collect the information of the direct neighbors which means we perform message passing. To update the current node state we take the information about the direct neighbors and the information about the current node (which is represented as <em>h</em>). We perform aggregation in the neighboring state to combine their information. Then we combine the current state information with the combined state information to get the new state or embedding in the layer <em>k+1.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*zBjIhV_3w5o620YSqE4avg.png" /><figcaption>Source-Deepfindr</figcaption></figure><p>Here you can see the node features of the blue nodes are been added to the new embedding and then we update the annotations in the graph and it will become:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*gIIDfnG2wp0x_BnqKkHfuQ.png" /><figcaption>Source-Deepfindr</figcaption></figure><p>Here you can see the blue nodes feature vectors are also been changed as some of them are directly connected green nodes. In short, there will be a new embedding for every node in our graph. The size of the new embedding is a hyperparameter and depends on the graph data we use. As you can see the node 5 has only known about the blue nodes and does not know about the yellow node with the number but this would change when we pass it through a message-passing layer. We can do several message-passing steps which correspond to the number of nodes in GNN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*WugyyzswIL2bFM30U9B5EA.png" /><figcaption>Source-Deepfindr</figcaption></figure><p>Again we collect the information about the nodes and aggregate it in some way to form a new embedding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*y2HRdvSUe7eUp5PP10KSqg.png" /><figcaption>Source-Deepfindr</figcaption></figure><p>So if you look into the yellow node some information about the green node has also been added to it. This means that node 1 knows something about node 5. In short, all nodes have known something about other nodes in one way or another, so there will be some sort of relation between them even though they are not connected directly. This knowledge is stored in each embedding and contains feature-based as well as structural information about the nodes. These embeddings can be used for prediction as they contain all the information about the graph that we need.</p><p>But if we pass the same graph through many message passing layers, over smoothing may occur. The message passing system makes use of the two core functions Aggregate and Update, which take feature vectors from neighbors and combine them with the node’s features to update the node’s representation. This operation works in such a way that the representations of interacting nodes (inside this process) are quite similar.</p><p>That’s the end of the Graph Neural Networks blog series. Do feel free to connect to share your feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e54251d0256d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph Neural Network- Part 3]]></title>
            <link>https://medium.com/@ashes192000/graph-neural-network-part-3-ded957cd21fa?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/ded957cd21fa</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[graph]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Wed, 22 Dec 2021 07:33:26 GMT</pubDate>
            <atom:updated>2021-12-22T07:33:26.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-LXOWP35EyHLq2Te.jpeg" /></figure><p>In part 2 of the series, I explained the conversion of theoretical knowledge of graphs to a practical form and explain the applications of Graphs.</p><p>If you haven’t gone through the same please check out <a href="https://medium.com/@ashes192000/graph-neural-networks-part-2-6e3a44b0d835">Graph Neural Networks- Part 2</a></p><p>In this part, I’ll explain what is Graph Neural Networks.</p><p>From the previous blogs we know the main objective of graphs, we understand that graphs have an enormous expressive capacity, and as a result, they are getting a lot of interest in the field of machine learning. Every node is coupled with an embedding, which specifies the node in the data space.</p><p><strong>GNN</strong>s are neural networks that can be directly applied to graphs, and provide an easy way to do node-level, edge-level, and graph-level prediction tasks.</p><p>Before getting to know what is Graph Neural Networks, we should know:</p><h3>Why do Convolutional Neural Networks fail on graphs?</h3><p>The main reason for that is unfixed node ordering. In graphs, due to permutation invariance in each turn, the ordering of the node can be changed. So we cant give the adjacency matrix itself as the input to predict the output. The second reason is that graphs have non-Euclidean spaces. The other reason is that graphs are size-independent. For a better understanding go through the image given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LO9RKKzoZ0o6-I3iuxeTrw.png" /></figure><p>In the first picture of a cat there, we can see five nodes but in the next picture, you can see there are six nodes. From this, we could understand that the number of nodes will not be the only criteria to confirm it as a cat as it is size-independent.</p><p>From the next picture, we could understand that even if we flipped the image the node order is changed, so the adjacency matrix itself can’t be given as the input.</p><p>All images have fixed pixels and that can’t be interchanged(Euclidean data) while graphs are not. These are reasons for not using CNN in graphs.</p><h3>Graph Neural Networks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*3lZeNdH5VEIrsBcrmYJ0RA.gif" /><figcaption><a href="https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.outsystems.com%2Fblog%2F-%2Fmedia%2Fimages%2Fblog%2Fposts%2Fgraph-neural-networks%2Fnn-gif-4.gif%3Fupdated%3D20190809152541&amp;imgrefurl=https%3A%2F%2Fwww.outsystems.com%2Fblog%2Fposts%2Fgraph-neural-networks%2F&amp;tbnid=JLveRgfrV2-reM&amp;vet=12ahUKEwj764L13fb0AhUlgGMGHY7gAsUQMygBegUIARC5AQ..i&amp;docid=U6rsTiWtvj4ldM&amp;w=750&amp;h=393&amp;q=graph%20neural%20network%20animation&amp;ved=2ahUKEwj764L13fb0AhUlgGMGHY7gAsUQMygBegUIARC5AQ">https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.outsystems.com%2Fblog%2F-%2Fmedia%2Fimages%2Fblog%2Fposts%2Fgraph-neural-networks%2Fnn-gif-4.gif%3Fupdated%3D20190809152541&amp;imgrefurl=https%3A%2F%2Fwww.outsystems.com%2Fblog%2Fposts%2Fgraph-neural-networks%2F&amp;tbnid=JLveRgfrV2-reM&amp;vet=12ahUKEwj764L13fb0AhUlgGMGHY7gAsUQMygBegUIARC5AQ..i&amp;docid=U6rsTiWtvj4ldM&amp;w=750&amp;h=393&amp;q=graph%20neural%20network%20animation&amp;ved=2ahUKEwj764L13fb0AhUlgGMGHY7gAsUQMygBegUIARC5AQ</a></figcaption></figure><p>Graph Neural Networks are neural networks that can be applied directly to graphs. The limitations that are explained above can be overcome by using this Graph Neural Networks. These models optimize GNNs for use on larger graphs and apply them to domains such as social networks, citation networks, and online communities.</p><p>In the past few years, different variants of Graph Neural Networks are being developed with Graph Convolutional Networks (GCN) being one of them. GCNs are also considered as one of the basic Graph Neural Networks variants.</p><p>That’s it for part 3 of the Graph Neural Network series. In part 4, I will explain what is GCN and it’s working.</p><p>Thank you for reading and please do connect for any suggestions or feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ded957cd21fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph Neural Networks- Part 2]]></title>
            <link>https://medium.com/@ashes192000/graph-neural-networks-part-2-6e3a44b0d835?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e3a44b0d835</guid>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Tue, 14 Dec 2021 08:23:20 GMT</pubDate>
            <atom:updated>2021-12-28T16:07:22.418Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EVM4pOSnXNHY_dh4" /><figcaption>Photo by <a href="https://unsplash.com/@universaleye?utm_source=medium&amp;utm_medium=referral">Universal Eye</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In part 1 of the series, I explained the basic introduction to graphs which include the types of labels and graphs.</p><p>If you haven&#39;t gone through the same please check out G<a href="https://medium.com/@ashes192000/graph-neural-networks-introduction-355b2a4782cd">raph Neural Networks- Introduction</a>.</p><p>In this part, I’ll explain the conversion of theoretical knowledge of graphs to a practical form and explain the applications of Graphs.</p><h3><strong>How can we convert the graph to a format that the computer can understand?</strong></h3><p>In order to convert these graphs into a format that computer we just convert them into the matrix.</p><p>The first matrix is called the <strong>Incidence matrix. </strong>This is an <em>N x M </em>matrix where<em> N</em> represents the number of nodes and <em>M</em> represents the number of edges.</p><p>The next is the <strong>Adjacent matrix. </strong>It is a connection square matrix having 0’s and 1’s. These 0 or 1 depending on whether nodes of the graph are adjacent or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*M4Zluihq5H6eGtqMBj1uOA.png" /><figcaption>Undirected Adjacency matrix</figcaption></figure><p>The next is the <strong>Degree matrix</strong>. It is a diagonal matrix that contains information about the degree of each node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*gQ3HMc5oct4NSF1j" /></figure><h4><strong>Why we are using Graphs?</strong></h4><p>Graphs are the ultimate abstraction for many real-world problems and today, technology exists that can treat them as such.</p><p>We all are using social media in our day-to-day life. There all we are using is Graph data structures in Facebook Graph API’s Recommendation systems, Web analytics etc. The reason is that all are dynamic in nature so in order to handle dynamic data’s Graphs are the best.</p><p>More complex problems can be solved using graphs by reducing them into simpler representations or by transforming them into representations from various perspectives.</p><p>So Graphs are more effective at representing abstract notions such as linkages and interactions. They also provide a visually intuitive manner of thinking about these issues. Graphs are also an excellent tool for understanding social relationships.</p><h4>Some Practical Applications of Graphs.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*Q0rH24Z38kCrKUDp.jpg" /><figcaption>(<a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.lifesight.io%2Fpractical-data-enrichment-applications-in-marketing%2F&amp;psig=AOvVaw2beppIU0Vl6FPFNTLm7dQd&amp;ust=1639553373445000&amp;source=images&amp;cd=vfe&amp;ved=0CAsQjRxqFwoTCNi72rfi4vQCFQAAAAAdAAAAABAD">https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.lifesight.io%2Fpractical-data-enrichment-applications-in-marketing%2F&amp;psig=AOvVaw2beppIU0Vl6FPFNTLm7dQd&amp;ust=1639553373445000&amp;source=images&amp;cd=vfe&amp;ved=0CAsQjRxqFwoTCNi72rfi4vQCFQAAAAAdAAAAABAD</a>)</figcaption></figure><ol><li>Social Graphs<br>In social graphs, we can consider all the nodes as a person or a place, and edges are drawn between them which resembles the sort of relation between them. Facebook is one of the best examples of the application of graphs to real-life problems.</li><li>Recommendation Engine<br><strong>Netflix, YouTube, Tinder, and Amazon</strong> are all examples of recommender systems in use. They can be considered as predicting the link between the nodes.</li><li>Path Optimization Algorithms<br>Finding the best connection that fits the predefined criteria is done in this algorithm. Either <strong>Breadth First Search (BFS)</strong> or Depth First Search (DFS) can be used to find a path between two vertices.</li><li>Knowledge Graphs<br> A knowledge graph is organized as a graph, which is not always true of knowledge bases. For a better understanding go through the video</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmmQl6VGvX-c%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmmQl6VGvX-c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmmQl6VGvX-c%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/826bcd8789e1d7203b4a4ce643799010/href">https://medium.com/media/826bcd8789e1d7203b4a4ce643799010/href</a></iframe><p>That’s it for part 2 of the Graph Neural Network series. In part 3, I will explain what is GNN.</p><p>Thank you for reading and please do connect for any suggestions or feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e3a44b0d835" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph Neural Networks — Introduction]]></title>
            <link>https://medium.com/@ashes192000/graph-neural-networks-introduction-355b2a4782cd?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/355b2a4782cd</guid>
            <category><![CDATA[gnn]]></category>
            <category><![CDATA[graph-theory]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[graph]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Wed, 10 Nov 2021 12:50:53 GMT</pubDate>
            <atom:updated>2021-12-11T07:34:56.883Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHR8GVPMk0UO9NMa-e4yfA.jpeg" /></figure><p>Have you ever heard about a machine discovering an antibiotic that can treat several bacterial strains, including multi-drug-resistant bacteria?</p><p>Yes, its <strong>Halicin</strong> was discovered by a pioneering machine learning approach called Graph Neural Network (GNN). So GNN has been <strong>t</strong>aken into consideration as an appealing modeling technique for molecular assets prediction, and several research has proven that GNN ought to yield extra promising outcomes than conventional.</p><p>Before getting into the topic let&#39;s understand what is a <em>graph.</em></p><h3>Graph</h3><p>A <strong>Graph</strong> is a structured data type that has nodes and edges. Nodes are also called vertices. Graphs are a type of <strong>Non-Euclidean data</strong>, which means they exist in 3D, unlike other data types like images, text, and audio. Mathematically we can represent a graph as a set of <strong>vertex/nodes</strong> (V) and <strong>edges</strong> (E)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/1*Ts6jHOyYv8nTLJQMLJmSCw.png" /></figure><p>Diagrammatically a graph can be represented as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*RuXTI0iGrUXIGTmaVUmqzQ.png" /><figcaption>Graph Structure (fastforwardlabs.com)</figcaption></figure><p>Each node and vertices can have<strong> labels</strong>. According to the labeling pattern they can be classified as Numerical labels, Textual labels, Unique labels. Let&#39;s learn more about it.</p><p>Labels seen on the graphs are not always being a number as they can be text too.</p><p>If the nodes and edges have numeric data then it&#39;s called<strong> Numeric labels</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*WulbOzkKqtYwO20W.png" /><figcaption>Numeric label. Source:<a href="https://towardsdatascience.com/graph-theory-and-deep-learning-know-hows-6556b0e9891b">https://towardsdatascience.com/graph-theory-and-deep-learning-know-hows-6556b0e9891b</a></figcaption></figure><p>If the labels are not numbers but texts then it&#39;s called <strong>Textual labels.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*JsA-yhG2aZgfJBf6.png" /><figcaption>Textual Label Source: <a href="https://towardsdatascience.com/graph-theory-and-deep-learning-know-hows-6556b0e9891b">https://towardsdatascience.com/graph-theory-and-deep-learning-know-hows-6556b0e9891b</a></figcaption></figure><p>If multiple nodes are there they are given the same labels called <strong>Unique labels.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*nolCDqEMUPqzebP_.png" /><figcaption>Unique Label. Source:<a href="https://towardsdatascience.com/graph-theory-and-deep-learning-know-hows-6556b0e9891b">https://towardsdatascience.com/graph-theory-and-deep-learning-know-hows-6556b0e9891b</a></figcaption></figure><blockquote>A node is a person, a node’s label is a person’s name, and the node’s features are the person’s characteristics.</blockquote><p>Graphs are of two types directed graph and undirected graph.</p><h4>Directed graph</h4><p>In this type, the direction between the nodes is specified. Consider you are using Twitter and the one who you follow may not not be following you. So there is only one direction. So in case of this, we use a directed graph.</p><h4>Undirected graph</h4><p>Here direction between the nodes is not present. Consider a Facebook friend request, if you receive a request from your friend and you accept it, you both will become friends and can see the content of each and this is a typical example of an undirected graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*ZTXIL0I59ArnUYhPYy6L1Q.jpeg" /><figcaption>differencebetween.com</figcaption></figure><p>That&#39;s it for part 1 of the Graph Neural Network series. In part 2, I will explain how we can convert graphs in a format computers can understand.</p><p>Thank you for reading and please do connect for any suggestions or feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=355b2a4782cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Malayalam Character recognition using OCR and OpenCV]]></title>
            <link>https://medium.com/@ashes192000/malayalam-character-recognition-using-ocr-and-opencv-53c74b6a4532?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/53c74b6a4532</guid>
            <category><![CDATA[malayalam]]></category>
            <category><![CDATA[malayalam-character]]></category>
            <category><![CDATA[ocr]]></category>
            <category><![CDATA[recognition]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Thu, 04 Nov 2021 15:58:07 GMT</pubDate>
            <atom:updated>2021-11-04T15:59:34.021Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dyw6gUdEGMVUd_j0tiUeDQ.jpeg" /></figure><p>OCR or Optical Character Recognition is the use of technology to distinguish printed or handwritten text characters inside digital images of physical documents. In the simplest terms, OCR also referred to as text recognition, involves examining the text of a document and translating the characters into code that can be used for data processing.</p><p><em>Malayalam is a South Indian language — which is the principal language of the State of Kerala, spoken by about 36 million people in the world. The Malayalam script is a Brahmic script used commonly to write the Malayalam language. Like many other Indic scripts, Malayalam follows a writing system that is partially alphabetic and partially syllable-based. The Malayalam script uses both old and new scripts for depicting characters. Due to the complexity of the Malayalam character set, an efficient method for the recognition of handwritten characters has not been proposed till now.</em></p><p><em>The main objective is to develop a handwritten Malayalam word recognition system.</em></p><p><em>The two phases identified are:</em></p><p><em>i) To recognize Handwritten Malayalam character</em></p><p><em>ii) To develop a Malayalam word recognition system to achieve a better accuracy rate in Malayalam handwritten character recognition system.</em></p><p><strong>Working</strong></p><p>Here we use Open source computer vision (OpenCV) for reading the image and for doing some image processing techniques. For finding text in an image the first process is to do color conversion, For this, we have to store the image to a variable and by using<em> cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)</em> the RGB image is converted into a grayscale image. As we have binarized the image, binarized image pixel values from 0 to 255. By doing binarization there is a chance of generating noise in the image. This noise won’t help our OCR to detect the text correctly. To avoid that we must add some blur. This can be attained by using the command <em>cv2.GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[,borderType=BORDER_DEFAULT]]] ) .</em></p><p>Normally the kernel size is given as a 5x5 matrix. For edge detection, canny edge detection is used to measure edges of the horizontal and vertical axis present around the text region in a grayscale image.</p><p>This edge detection helps us to find the information on shapes that can be figured out from the image. While detecting the edges we will give an upper and lower threshold. Anything above the lower threshold and upper threshold will be accepted and others are rejected.</p><p>Contours are defined as the line joining all the points along the boundary of an image that are having the same intensity. After the edge detection, the copy of this image is given as the source for finding the contour and <em>cv2.RETR_EXTERNAL</em> is used to find the outer contour and <em>CHAIN_APPROX_SIMPLE</em> will return all the endpoints required for drawing the contour. Then the contours are stored as tuples and sorted using <em>imutils.grab_contours, sort_contours</em> respectively.</p><p>Then we have to filter out too large and too small areas. For this, we have to give some conditions. Then by using <em>cv2.threshold </em>we can find the text. Considering all the text is dark we give a lower threshold to 0 and output threshold to 255 which means anything greater than 0 pixels will be converted to 255 and this is done by <em>cv2.THRESH_BINARY_INV. </em>Finding out the dimensions of the bounding box and then we have grown the bounding box outside each character.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/0*mAqkGzZeN-cW8h5y" /></figure><p>Conclusion:</p><p>Optical character recognition is a necessary first step for all applications that consider typewritten or handwritten manuscripts as input. Recognition of printed text gives good results. Almost all the data read was correct. Only a few recognized fields contained mistakes, but they have been unreadable or damaged during the scanning process.</p><p><strong>We conclude that Malayalam letters can’t be figured out by using openCV to create complex shapes and similarities between their letters. The accuracy that is produced by our system is less than 30%</strong></p><blockquote>Any criticism, suggestion or addition, corresponding to the project are welcome.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53c74b6a4532" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEATHERWORKS]]></title>
            <link>https://medium.com/@ashes192000/weatherworks-5fbd7cd32d25?source=rss-1eda8367b203------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fbd7cd32d25</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[weather]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Ashwin M]]></dc:creator>
            <pubDate>Thu, 22 Jul 2021 13:18:29 GMT</pubDate>
            <atom:updated>2021-07-22T13:26:01.255Z</atom:updated>
            <content:encoded><![CDATA[<h4>Weather Classifier</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O04EjdiJRgp3JcgxOBzonQ.jpeg" /></figure><p><strong>Introduction</strong></p><p>Climatology and prognostication are vital since it helps verify future climate expectations. Meteorology focuses on current climate equivalent to humidity, air pressure, and temperatures and forecasting the short-run weather conditions to come. Weather warnings are significant as they could predict any possible danger to life or property. Weather is the single most event that affects human life in each dimension, starting from food to fly. In contrast, on the opposite hand, it’s the original unfortunate phenomenon. Therefore, the prediction of weather phenomena is of significant interest for human society to avoid or minimize the destruction of weather hazards. Weather prediction is advanced because of noise and missing values dataset. Varied efforts were created to create weather predictions as correct as possible. However, still, the complexities of noise are touching accuracy.</p><h4>WEATHERWORKS</h4><p>Weatherworks is an online platform that aims at weather detection by classifying sky images. The multi class application distinguishes the weather into rainy, cloudy, shiny, and sunrise, allowing suitable precautions that the user could undertake.</p><p>From the perspective of agriculture, the applications help forecast the weather for the day, which helps avoid unnecessary chaos.</p><p>We would like to thank Kaggle for providing the dataset for the completion of the project.</p><h3><strong>Working</strong></h3><p>Here we are using the PyTorch framework.</p><p>To install torch: <em>pip install torch</em></p><p>PyTorch is an open-source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, primarily developed by Facebook’s AI Research lab.</p><p>The training images and test images are preprocessed using the opencv and made into 32x32 px. These preprocessed images are randomly selected and split into test and train datasets, and moved into a directory “Preprocessed_image.” Taking the train directory as a whole is converted into tensor using <em>torchvision.datasets.ImageFolder. </em>Using <em>torch</em><strong><em>.</em></strong><em>utils</em><strong><em>.</em></strong><em>data</em><strong><em>.</em></strong><em>DataLoader, </em>the training dataset is divided into a batch size of 50.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QWhXFuSzLEVdGpVB" /><figcaption>Data Loader</figcaption></figure><p>Then we define the network. Our model name is Weatherclass.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rt7Ito2mOZ3Q03Om" /><figcaption>Defined network</figcaption></figure><p>Here we use Convolution neural networks. The neural network input was [3,32,32], which represents the number of channels, 32x32 the size of the image. Since it is an RGB image, the number of channels is 3. After defining the model, we call the fit function, which helps us get the validation dataset’s accuracy and training loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qlSbF5nWhhGbTO79" /><figcaption>Accuracy of the model.</figcaption></figure><p>The model’s accuracy was about 86.00%, and then we load the weights and bias to “Weather_model.pt” file for inference.</p><p>Defining the model and loading the “Weather_model.pt” is done on another python file is that “Loading model.py.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JzSrFlXfCW3G6JWs" /><figcaption>Saving the model</figcaption></figure><p>The image of dimension [3,32,32] is passed through the convolution layers and between each convolution payer there is an ReLU activation function. After passing through these layers the output flattens in such a manner that we get 4 classes as outputs. This was done in a sequential order.</p><p>To Accept and give out the prediction in a web application, we have used the Flask API of Python, a micro web framework.</p><p>Our application name is <em>app</em></p><p><em>app=Flask(__name__)</em></p><p>Our index page has both GET and POST methods. The GET method is used to request data from the server that is our image URL. The POST method is used to submit our prediction to the server.</p><p>To create an application using a flask, we use two folders — templates and static.</p><p>Templates are used to render HTML, which will display in the user’s browser.</p><p>Static folder contains assets used by the templates, including CSS files, JavaScript files, and images.</p><p><strong>INFERENCE</strong></p><p>Weatherworks is a basic model that classifies images into 4 classes.</p><p>The current accuracy is 86 with the existing dataset of around 170 in each class. The model is able to differentiate the images into cloudy, rainy, shine and sunrise.</p><p>Although, it is to be inferred that the number of classes as well as the dataset corresponding to each class is to be increased to raise the accuracy as well as to make its usability significantly efficient. As we can infer, the presence of classes such as windy, hurricane, winter, autumn etc, can make the application more efficient for the expected consumers, essentially the farmers.</p><blockquote>Any criticism, suggestion or addition, corresponding to the project are welcome.</blockquote><p>GitHub reference : <a href="https://github.com/Ashwin202/Weatherworks.git">https://github.com/Ashwin202/Weatherworks.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fbd7cd32d25" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>