<?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: Priyam Jain</title>
    <description>The latest articles on Forem by Priyam Jain (@priyam_jain_f127ddf8c4d8d).</description>
    <link>https://forem.com/priyam_jain_f127ddf8c4d8d</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%2F2173013%2F815ae00a-c41b-463e-aa11-4f3432a703b3.png</url>
      <title>Forem: Priyam Jain</title>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/priyam_jain_f127ddf8c4d8d"/>
    <language>en</language>
    <item>
      <title>Reinforcement Learning complete mental map</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Fri, 10 Apr 2026 12:24:35 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/reinforcement-learning-complete-mental-map-4ie0</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/reinforcement-learning-complete-mental-map-4ie0</guid>
      <description>&lt;p&gt;Reinforcement Learning is technically a subfield of Machine Learning, but the moment you start working with it, it feels like a completely different discipline. The math looks familiar, the neural networks look familiar, but the thinking behind it is different. This blog is a personal reference — a place to come back to when the concepts start blurring together.&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 1: The Mindset Difference
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tfh310omrjp8md734eh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tfh310omrjp8md734eh.png" alt=" " width="800" height="340"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;How we think in ML&lt;/strong&gt;&lt;br&gt;
When we learn Machine Learning, we develop a very specific frame of mind. Someone has already collected data. That data has correct answers attached to it. Our job is to train a model that finds the pattern connecting inputs to outputs, and minimize the gap between what the model predicts and what the label says.&lt;br&gt;
Think of it like a student in a classroom. The teacher gives you questions and the correct answers. You study the pattern. You get tested on new questions from the same pattern. The dataset is static, the ground truth exists, and learning is fundamentally passive — you do not influence what examples you see next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How we think in RL&lt;/strong&gt;&lt;br&gt;
Reinforcement Learning breaks this frame entirely. There is no dataset. There is no correct label. Instead, there is an agent that lives inside a world and has to figure out how to behave in it.&lt;br&gt;
The agent takes an action, the world responds with a new situation and a reward signal, and the agent tries to figure out which sequence of decisions leads to the best long-term outcome. Think of a child learning to walk — nobody hands them a dataset of correct walking examples. They try, they fall, they adjust, they get better. That trial-and-error loop is the essence of RL.&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 2: What They Share
&lt;/h1&gt;

&lt;p&gt;Despite the mindset gap, RL and ML are built from the same mathematical bones. Both optimize a parametric function using iterative updates. Both can use neural networks. Both follow the same general training loop: initialize a model, collect some experience, compute a signal of how well you did, update the parameters, and repeat. Both aim to generalize — to perform well on situations not seen during training.&lt;br&gt;
The fundamental difference is what that loop is actually doing. In ML, you are reducing prediction error on a fixed dataset. In RL, you are improving the quality of decisions in a world that reacts to what you do. The source of data and the nature of the objective are different, even when the machinery underneath looks identical.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fon8n28jus96hz14gig9j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fon8n28jus96hz14gig9j.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key shift is this: in ML, the question is "what is the correct output for this input?" In RL, the question is "what should I do right now so that things go well over time?" The model is no longer learning a mapping. It is learning a behavior.&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 3: The Components of Every RL Problem
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4qjydgriwc5go98deb36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4qjydgriwc5go98deb36.png" alt=" " width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 4: The MDP — the Blueprint Behind Every RL Problem
&lt;/h1&gt;

&lt;p&gt;Every RL problem, regardless of the algorithm used to solve it, is formalized as a Markov Decision Process (MDP). The MDP is the grammar of RL the way the computation graph is the grammar of deep learning. Understanding what it contains — and which parts are fixed versus which parts depend on your problem — is essential.&lt;br&gt;
An MDP consists of five elements: a state space S (all possible situations the agent can find itself in), an action space A (all possible moves available), a transition function T (the probability of moving to a new state given a current state and action), a reward function R (the scalar signal received after each transition), and a discount factor γ (how much future rewards are weighted relative to immediate ones).&lt;/p&gt;

&lt;p&gt;All of these components are formalized inside a single framework called the Markov Decision Process. The MDP is not an algorithm — it is the grammar that describes the problem before any learning happens. Understanding which parts of it are always fixed and which parts you design is critical.&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 5: The Universal RL Loop — What Stays the Same Across All Algorithms
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmo0l5ipsbvzpqdvuicd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmo0l5ipsbvzpqdvuicd.png" alt=" " width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 6: The Bellman Equation — the Heart of Learning
&lt;/h1&gt;

&lt;p&gt;Before diving into specific algorithms, it helps to understand a core idea that most of them are built on: the &lt;strong&gt;Bellman equation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The Bellman equation is &lt;strong&gt;not an algorithm&lt;/strong&gt;, but a &lt;strong&gt;fundamental principle&lt;/strong&gt; similar to how Newton’s laws work in physics. It describes a simple but powerful idea:&lt;/p&gt;

&lt;p&gt;👉 &lt;em&gt;The value of a state right now equals the reward you get immediately plus the future value of where you end up next.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In simpler terms, it answers:&lt;br&gt;
&lt;strong&gt;“If I am here now, how good is this position considering both now and the future?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are two common ways to express it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;State value:&lt;/strong&gt;
V(s) = R + γ · V(s′)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action value:&lt;/strong&gt;
Q(s, a) = R + γ · max Q(s′, a′)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;R&lt;/strong&gt; = immediate reward&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;γ (gamma)&lt;/strong&gt; = discount factor (how much we care about future rewards)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;s′&lt;/strong&gt; = next state&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Intuition (easy way to think)
&lt;/h3&gt;

&lt;p&gt;Imagine playing chess.&lt;/p&gt;

&lt;p&gt;You only get a reward at the end (win or lose), but your earlier moves still matter. The Bellman equation helps the agent &lt;strong&gt;send that final reward backward&lt;/strong&gt;, so it can understand:&lt;/p&gt;

&lt;p&gt;👉 &lt;em&gt;“That move I made earlier was actually good because it eventually led to a win.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So every step, the agent updates its thinking:&lt;br&gt;
&lt;strong&gt;“How good was the result of my last move, and what does that say about the move itself?”&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Big Picture Hierarchy
&lt;/h3&gt;

&lt;p&gt;You can think of it like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reinforcement Learning&lt;/strong&gt; → the overall field&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MDP (Markov Decision Process)&lt;/strong&gt; → how we model the problem&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bellman Equation&lt;/strong&gt; → the core mathematical idea&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Algorithms (Q-learning, Policy Gradients, Actor-Critic)&lt;/strong&gt; → practical ways to use that idea&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Part 7: Different Algorithms — Same Problem, Different Internal Machinery
&lt;/h1&gt;

&lt;p&gt;All RL algorithms target the same problem: find a policy that maximizes cumulative reward in the given MDP. They are not components that work together like hardware parts they are alternative strategies for solving that same problem. You pick one and use it. The choice depends on the structure of the problem: the size of the state space, whether actions are discrete or continuous, and whether sparse or dense rewards are available.&lt;br&gt;
What changes between them is what the agent learns internally — the &lt;br&gt;
nature of the parameters being updated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcpfxg5bdy66mmliifnm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcpfxg5bdy66mmliifnm.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
This is where RL differs most sharply from deep learning. In DL, the neural network is a universal substrate — swap the output head and the loss function, and the same training machinery handles classification, regression, generation, and more. The weights and biases are always what get updated, and the process is always forward pass → loss → backprop → gradient step.&lt;br&gt;
In RL, what gets updated depends on the algorithm family. In tabular Q-learning, there are no neural network weights what gets updated are the cells of a Q-table, a matrix of numbers indexed by state and action. In policy gradient methods, a network's weights are updated to make good actions more probable. In actor-critic, two separate networks the actor and the critic are updated on different objectives simultaneously. These are not just different loss functions. They are different theories of what the agent should be learning.&lt;br&gt;
Think of it like different study strategies for the same exam. A value-based student memorizes how good each situation is. A policy-based student memorizes rules for what to do in each situation. An actor-critic student does both at once, using one to improve the other. Same exam, fundamentally different approach.&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 9 Why RL is more complex than DL parameter-wise
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmog1bnes1jydrhp880c8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmog1bnes1jydrhp880c8.png" alt=" " width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Part 10: The Bigger Picture - How It All Connects
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftd9ux2qi1it6qumdwwca.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftd9ux2qi1it6qumdwwca.png" alt=" " width="800" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you step back, the entire field of RL sits on a clean conceptual stack:&lt;br&gt;
every RL problem is defined as an MDP. The mathematical principle connecting all learning in that MDP is the Bellman equation the idea that the value of a decision depends not just on what it immediately yields but on what it makes possible next. The algorithms (Q-learning, DQN, policy gradients, actor-critic) are different ways of computing or approximating the quantities the Bellman equation talks about. And the implementation whether a table or a neural network is chosen based on the scale of the problem.&lt;br&gt;
Everything connects back to one recursive insight: the value of what you do now depends on what it makes possible later. That is not just an RL principle. It is how your brain actually learns.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Row Space, Column Space, Rank, and Nullity with a Simple House Price Dataset</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Wed, 11 Mar 2026 13:38:28 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/understanding-row-space-column-space-rank-and-nullity-with-a-simple-house-price-dataset-4ie4</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/understanding-row-space-column-space-rank-and-nullity-with-a-simple-house-price-dataset-4ie4</guid>
      <description>&lt;p&gt;Linear algebra is everywhere in machine learning, even if it’s often hidden behind frameworks like PyTorch or TensorFlow. Concepts like &lt;strong&gt;row space, column space, rank, and nullity&lt;/strong&gt; aren’t just abstract math — they help us understand what our model can learn and predict.&lt;/p&gt;

&lt;p&gt;In this blog, we’ll explore these ideas using a simple &lt;strong&gt;house price prediction dataset&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;1. The Dataset&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Suppose we have a dataset of houses with 3 features:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;House&lt;/th&gt;
&lt;th&gt;Size (sq ft)&lt;/th&gt;
&lt;th&gt;Bedrooms&lt;/th&gt;
&lt;th&gt;Age (years)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1200&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;1500&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2700&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We can represent this as a &lt;strong&gt;matrix&lt;/strong&gt; (X):&lt;/p&gt;

&lt;p&gt;[&lt;br&gt;
X =&lt;br&gt;
\begin{bmatrix}&lt;br&gt;
1200 &amp;amp; 3 &amp;amp; 10 \&lt;br&gt;
1500 &amp;amp; 4 &amp;amp; 5 \&lt;br&gt;
2700 &amp;amp; 7 &amp;amp; 25&lt;br&gt;
\end{bmatrix}&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;Rows = houses&lt;br&gt;
Columns = features&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;2. Column Space: The Space of Predictions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;column space&lt;/strong&gt; is the set of all linear combinations of the columns of a matrix.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each column represents a feature across all houses.&lt;/li&gt;
&lt;li&gt;Column space represents &lt;strong&gt;all possible outputs (predictions)&lt;/strong&gt; the model can generate using these features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For our dataset, column space captures the &lt;strong&gt;independent patterns in the features&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Column 1 = [1200, 1500, 2700] → “Size pattern”&lt;/li&gt;
&lt;li&gt;Column 2 = [3, 4, 7] → “Bedrooms pattern”&lt;/li&gt;
&lt;li&gt;Column 3 = [10, 5, 25] → “Age pattern”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If one column can be written as a combination of others, it &lt;strong&gt;does not add new information&lt;/strong&gt; to the column space.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;3. Row Space: The Feature Patterns in the Dataset&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;row space&lt;/strong&gt; is the set of all linear combinations of the rows.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each row represents &lt;strong&gt;one house&lt;/strong&gt; (all its features).&lt;/li&gt;
&lt;li&gt;Row space captures &lt;strong&gt;all feature patterns that exist in the dataset&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s look closely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(r_1 = [1200, 3, 10])&lt;/li&gt;
&lt;li&gt;(r_2 = [1500, 4, 5])&lt;/li&gt;
&lt;li&gt;(r_3 = [2700, 7, 25])&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice:&lt;/p&gt;

&lt;p&gt;[&lt;br&gt;
r_3 = r_1 + r_2&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;(or, more generally, (r_3) can be expressed as a &lt;strong&gt;linear combination&lt;/strong&gt; of (r_1) and (r_2)).&lt;/p&gt;

&lt;p&gt;✅ This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;r3’s features (size, bedrooms, age) can be predicted exactly from r1 and r2&lt;/li&gt;
&lt;li&gt;Mathematically, it adds &lt;strong&gt;no new direction&lt;/strong&gt; in the row space&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, in essence:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Row space = all house patterns that can be represented by combining existing houses&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In ML terms, the model can only learn relationships &lt;strong&gt;within the row space&lt;/strong&gt;. A house lying outside it (say, extremely large or unusual) may produce unreliable predictions.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;4. Rank: How Many Independent Directions Exist&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rank&lt;/strong&gt; = number of independent rows or columns&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In our example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;r1 and r2 are independent&lt;/li&gt;
&lt;li&gt;r3 is dependent&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;So, &lt;strong&gt;rank = 2&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Rank tells us &lt;strong&gt;how many independent patterns exist&lt;/strong&gt; in the dataset.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;5. Null Space: What the Model Ignores&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Null space&lt;/strong&gt; = all vectors (x) such that (Xx = 0)&lt;/li&gt;
&lt;li&gt;Intuition: combinations of features that &lt;strong&gt;do not affect predictions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If a column is in the null space, the model &lt;strong&gt;ignores that feature&lt;/strong&gt; because it can be written as a combination of other features&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;6. Why This Matters in Machine Learning&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Column space&lt;/strong&gt; = all possible outputs the model can produce&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Row space&lt;/strong&gt; = all feature patterns the model sees during training&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rank&lt;/strong&gt; = how much independent information is in the data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Null space&lt;/strong&gt; = directions that don’t affect predictions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Understanding these helps with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detecting &lt;strong&gt;redundant features&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Avoiding &lt;strong&gt;multicollinearity&lt;/strong&gt; in regression&lt;/li&gt;
&lt;li&gt;Understanding &lt;strong&gt;limitations of your model&lt;/strong&gt; for prediction&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;7. Summary Table&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Intuition (House Price)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Column space&lt;/td&gt;
&lt;td&gt;All possible patterns of predictions using features&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Row space&lt;/td&gt;
&lt;td&gt;All feature patterns that exist in the dataset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rank&lt;/td&gt;
&lt;td&gt;Number of independent feature/house patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Null space&lt;/td&gt;
&lt;td&gt;Feature combinations that don’t influence prediction&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;8. Key Takeaways&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A dependent row like r3 &lt;strong&gt;doesn’t add new information&lt;/strong&gt;, but we usually &lt;strong&gt;keep it&lt;/strong&gt; in training for stability&lt;/li&gt;
&lt;li&gt;Column space tells you &lt;strong&gt;what predictions are possible&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Row space tells you &lt;strong&gt;what the model can learn from the dataset&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;By looking at &lt;strong&gt;row space and column space&lt;/strong&gt;, you can visualize:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What your dataset &lt;strong&gt;contains&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;What your model &lt;strong&gt;can learn&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Which features or houses are &lt;strong&gt;redundant&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these concepts helps make &lt;strong&gt;linear regression and deep learning models more interpretable&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;If you want, I can also &lt;strong&gt;add a small 3D plot showing row space vs column space for this house dataset&lt;/strong&gt; — it’s super intuitive and looks great in a blog.&lt;/p&gt;

&lt;p&gt;Do you want me to do that next?&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Time Blocking System in Appointment Booking</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Sun, 01 Feb 2026 05:49:42 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/time-blocking-system-in-appointment-booking-5een</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/time-blocking-system-in-appointment-booking-5een</guid>
      <description>&lt;h2&gt;
  
  
  1. What is a Time Blocking System?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;time blocking system&lt;/strong&gt; is an appointment management approach where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each booking stores a &lt;strong&gt;start time and end time&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;This time interval is considered &lt;strong&gt;occupied&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;No other appointment is allowed to overlap with this interval&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple words:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Once a service is booked for a time range, that time range is blocked and cannot be reused.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This system models &lt;strong&gt;real-world resource usage&lt;/strong&gt;, where a vendor can serve only one customer at a time.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. How Time Blocking Works (Conceptual)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Vendor defines working hours (availability)&lt;/li&gt;
&lt;li&gt;Customer selects a service (with fixed duration)&lt;/li&gt;
&lt;li&gt;System checks existing bookings&lt;/li&gt;
&lt;li&gt;If the new booking overlaps with any existing booking, it is rejected&lt;/li&gt;
&lt;li&gt;If no overlap exists, the booking is confirmed&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thus, time is managed as &lt;strong&gt;continuous intervals&lt;/strong&gt;, not as fixed predefined slots.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Why Time Blocking is Needed
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 Real-World Accuracy
&lt;/h3&gt;

&lt;p&gt;In real life:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A salon chair&lt;/li&gt;
&lt;li&gt;A doctor&lt;/li&gt;
&lt;li&gt;A consultant&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All can handle &lt;strong&gt;only one service at a time&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Time blocking mirrors this reality by ensuring that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One service fully occupies a time window&lt;/li&gt;
&lt;li&gt;Partial overlaps are not allowed&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3.2 Supports Variable Service Durations
&lt;/h3&gt;

&lt;p&gt;Different services take different amounts of time.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Haircut → 30 minutes&lt;/li&gt;
&lt;li&gt;Hair coloring → 90 minutes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Time blocking allows services of &lt;strong&gt;any duration&lt;/strong&gt; without modifying the system.&lt;/p&gt;




&lt;h3&gt;
  
  
  3.3 Prevents Double Booking
&lt;/h3&gt;

&lt;p&gt;Because every booking blocks a time range:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Two customers cannot book overlapping appointments&lt;/li&gt;
&lt;li&gt;Data integrity is maintained automatically&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This eliminates race conditions in basic systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Comparison with Other Appointment Systems
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 Fixed Slot-Based System
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Day is divided into equal time slots (e.g., 30 minutes)&lt;/li&gt;
&lt;li&gt;Appointments occupy one or more slots&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inefficient for long services&lt;/li&gt;
&lt;li&gt;Requires slot merging logic&lt;/li&gt;
&lt;li&gt;Wastes unused time&lt;/li&gt;
&lt;li&gt;Difficult to manage variable durations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Time Blocking is Better:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No slot merging required&lt;/li&gt;
&lt;li&gt;Exact service duration is used&lt;/li&gt;
&lt;li&gt;Less wasted time&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4.2 Pre-Stored Slot System
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slots are generated and stored in advance in the database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High storage usage&lt;/li&gt;
&lt;li&gt;Needs regeneration if schedule changes&lt;/li&gt;
&lt;li&gt;Complex maintenance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Time Blocking is Better:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No need to store slots&lt;/li&gt;
&lt;li&gt;Slots are calculated dynamically&lt;/li&gt;
&lt;li&gt;System remains flexible&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4.3 Queue-Based System
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customers wait in order&lt;/li&gt;
&lt;li&gt;No fixed time is guaranteed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Poor user experience&lt;/li&gt;
&lt;li&gt;Unpredictable waiting times&lt;/li&gt;
&lt;li&gt;Not suitable for scheduled services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Time Blocking is Better:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provides certainty to customers&lt;/li&gt;
&lt;li&gt;Better time management for vendors&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4.4 Vendor Approval-Based System
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vendor manually approves each booking&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slow confirmation&lt;/li&gt;
&lt;li&gt;Increased operational load&lt;/li&gt;
&lt;li&gt;Poor scalability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Time Blocking is Better:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automated conflict checking&lt;/li&gt;
&lt;li&gt;Instant confirmation&lt;/li&gt;
&lt;li&gt;Scales better&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Technical Advantages of Time Blocking
&lt;/h2&gt;

&lt;h3&gt;
  
  
  5.1 Simple Overlap Logic
&lt;/h3&gt;

&lt;p&gt;Conflict detection uses a single condition:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Two appointments conflict if their time ranges overlap.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This makes implementation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple&lt;/li&gt;
&lt;li&gt;Efficient&lt;/li&gt;
&lt;li&gt;Reliable&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  5.2 Database-Friendly Design
&lt;/h3&gt;

&lt;p&gt;Only one table (&lt;code&gt;Booking&lt;/code&gt;) is required to manage conflicts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No redundant data&lt;/li&gt;
&lt;li&gt;Easy indexing&lt;/li&gt;
&lt;li&gt;Easy querying&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  5.3 Scalability
&lt;/h3&gt;

&lt;p&gt;Time blocking works equally well for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 vendor&lt;/li&gt;
&lt;li&gt;1,000 vendors&lt;/li&gt;
&lt;li&gt;Multiple service durations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No redesign is needed as the system grows.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Why Time Blocking is the Best Choice for This Application
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Reflects real-world service behavior&lt;/li&gt;
&lt;li&gt;Handles variable service durations naturally&lt;/li&gt;
&lt;li&gt;Avoids unnecessary database complexity&lt;/li&gt;
&lt;li&gt;Prevents double booking effectively&lt;/li&gt;
&lt;li&gt;Easy to explain, implement, and maintain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For an application like &lt;strong&gt;Justdial + Appointment Booking&lt;/strong&gt;, time blocking provides the best balance between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;realism&lt;/li&gt;
&lt;li&gt;simplicity&lt;/li&gt;
&lt;li&gt;scalability&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>backend</category>
      <category>productivity</category>
      <category>softwareengineering</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Using One Database for Two Apps: Should You Copy Your Models or Import Them?</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Sat, 29 Nov 2025 11:30:57 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/using-one-database-for-two-apps-should-you-copy-your-models-or-import-them-6g5</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/using-one-database-for-two-apps-should-you-copy-your-models-or-import-them-6g5</guid>
      <description>&lt;p&gt;Using One Database for Two Apps: Should You Copy Your Models or Import Them?&lt;/p&gt;

&lt;p&gt;When you work on a project that has one backend but multiple clients (like a web app + a mobile app), you eventually face this question:&lt;/p&gt;

&lt;p&gt;“I already have SQLAlchemy models in my Flask application. Now I’m building a FastAPI backend for mobile — should I copy the models into the FastAPI project or import them from my Flask project?”&lt;/p&gt;

&lt;p&gt;This sounds like a small decision.&lt;br&gt;
But it affects your entire project architecture, maintainability, and database safety.&lt;/p&gt;

&lt;p&gt;Let’s break it down in simple words.&lt;/p&gt;

&lt;p&gt;✅ The Two Options&lt;br&gt;
Option 1 — Copy the model files into the FastAPI app&lt;/p&gt;

&lt;p&gt;Just take the models.py files from your Flask project and paste them inside your FastAPI folder.&lt;/p&gt;

&lt;p&gt;Option 2 — Import the same models directly from the Flask app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your FastAPI app uses:

from flask_app.models import User, Vendor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so both apps share one source of truth.&lt;/p&gt;

&lt;p&gt;🔍 What Happens If You Copy the Models?&lt;/p&gt;

&lt;p&gt;Copying feels simple:&lt;/p&gt;

&lt;p&gt;Paste the models&lt;/p&gt;

&lt;p&gt;Make some modifications&lt;/p&gt;

&lt;p&gt;Done?&lt;/p&gt;

&lt;p&gt;Not really.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❌ 1. You’ll be maintaining two versions of every model
&lt;/h3&gt;

&lt;p&gt;If you add a new column in Flask:&lt;/p&gt;

&lt;p&gt;User.address = db.Column(...)&lt;/p&gt;

&lt;p&gt;you must also manually add it in FastAPI.&lt;/p&gt;

&lt;p&gt;Developers forget.&lt;br&gt;
Then two apps start thinking the database looks different.&lt;/p&gt;

&lt;p&gt;That’s where problems start.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❌ 2. Two separate migration systems
&lt;/h3&gt;

&lt;p&gt;Flask uses Flask-Migrate.&lt;br&gt;
FastAPI uses Alembic directly.&lt;/p&gt;

&lt;p&gt;If you copy models, you now have:&lt;/p&gt;

&lt;p&gt;two Alembic folders,&lt;/p&gt;

&lt;p&gt;two migration histories,&lt;/p&gt;

&lt;p&gt;two places to run migrations.&lt;/p&gt;

&lt;p&gt;One mistake?&lt;br&gt;
Inconsistent schemas → broken API.&lt;/p&gt;

&lt;h3&gt;
  
  
  ❌ 3. Risk of database mismatch
&lt;/h3&gt;

&lt;p&gt;Imagine Flask thinks:&lt;/p&gt;

&lt;p&gt;name = String(100)&lt;/p&gt;

&lt;p&gt;but FastAPI thinks:&lt;/p&gt;

&lt;p&gt;name = String(50)&lt;/p&gt;

&lt;p&gt;or one app adds a column and the other doesn't know about it.&lt;/p&gt;

&lt;p&gt;Results?&lt;/p&gt;

&lt;p&gt;Foreign key failures&lt;/p&gt;

&lt;p&gt;Missing column errors&lt;/p&gt;

&lt;p&gt;Mismatched constraints&lt;/p&gt;

&lt;p&gt;Strange bugs you cannot debug quickly&lt;/p&gt;

&lt;h3&gt;
  
  
  ❌ 4. More work today + even more work tomorrow
&lt;/h3&gt;

&lt;p&gt;Copying models looks easy in the beginning, but when your project grows, you’ll suffer from:&lt;/p&gt;

&lt;p&gt;duplicated code&lt;/p&gt;

&lt;p&gt;confusion&lt;/p&gt;

&lt;p&gt;extra debugging&lt;/p&gt;

&lt;p&gt;unpredictable errors&lt;/p&gt;

&lt;p&gt;🌟 Why Importing the Models Is the Better Solution&lt;/p&gt;

&lt;p&gt;Instead of copying, your FastAPI app can simply load the same models:&lt;/p&gt;

&lt;p&gt;from flask_app.models import User, Vendor&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;p&gt;✔ Only one version of models (no duplication)&lt;br&gt;
✔ Only one migration folder (no conflicts)&lt;br&gt;
✔ Both apps use the same Aiven database cleanly&lt;br&gt;
✔ You update models in one place&lt;br&gt;
✔ FastAPI and Flask stay in sync forever&lt;br&gt;
✔ No surprises or schema mismatches&lt;/p&gt;

&lt;p&gt;This approach is cleaner, scalable, and maintainable.&lt;/p&gt;

&lt;p&gt;🔧 How to Make This Work&lt;/p&gt;

&lt;p&gt;It’s surprisingly simple:&lt;/p&gt;

&lt;p&gt;Ensure your Flask project is structured like a real Python package.&lt;br&gt;
(it already is, if it has &lt;strong&gt;init&lt;/strong&gt;.py)&lt;/p&gt;

&lt;p&gt;Add the Flask project to Python path from FastAPI.&lt;/p&gt;

&lt;p&gt;Import models:&lt;/p&gt;

&lt;p&gt;from vendora_app.models import User&lt;/p&gt;

&lt;p&gt;Use the same database connection (Aiven, PostgreSQL, etc.)&lt;/p&gt;

&lt;p&gt;Your FastAPI app now uses the same models, same tables, same engine — with zero duplication.&lt;/p&gt;

&lt;p&gt;🎯 So What Should You Do?&lt;/p&gt;

&lt;p&gt;If your project will grow, if you care about maintainability, or if multiple developers will work on it:&lt;/p&gt;

&lt;p&gt;Always import the models. Do not copy them.&lt;/p&gt;

&lt;p&gt;Copying seems easy today but causes long-term technical debt.&lt;/p&gt;

&lt;p&gt;Importing is the clean, scalable, professional approach.&lt;/p&gt;

&lt;p&gt;📝 Conclusion&lt;/p&gt;

&lt;p&gt;When building multiple apps that share the same database:&lt;/p&gt;

&lt;p&gt;Copying models creates more problems than it solves.&lt;/p&gt;

&lt;p&gt;Importing models keeps everything consistent and future-proof.&lt;/p&gt;

&lt;p&gt;Always aim to maintain a single source of truth for your database schema.&lt;/p&gt;

&lt;p&gt;Your future self (and your teammates) will thank you&lt;/p&gt;

</description>
      <category>python</category>
      <category>database</category>
      <category>backend</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Foundational AWS Services for Dynamic Web Application Development</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Fri, 27 Jun 2025 05:02:33 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/foundational-aws-services-for-dynamic-web-application-development-36a1</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/foundational-aws-services-for-dynamic-web-application-development-36a1</guid>
      <description>&lt;p&gt;Foundational AWS Services for Dynamic Web Application Development&lt;/p&gt;

&lt;p&gt;I. Security &amp;amp; Identity Management&lt;/p&gt;

&lt;p&gt;AWS Identity and Access Management (IAM): Manages users, groups, roles, and permissions to control access to AWS resources. (Absolutely essential)&lt;/p&gt;

&lt;p&gt;II. Networking &amp;amp; Connectivity&lt;/p&gt;

&lt;p&gt;Amazon Virtual Private Cloud (VPC): Creates a private, isolated virtual network for your AWS resources.&lt;/p&gt;

&lt;p&gt;Components within VPC: Subnets (public/private), Internet Gateway (IGW), Route Tables, Security Groups, NAT Gateway. (Absolutely essential)&lt;/p&gt;

&lt;p&gt;Amazon Route 53: Provides highly available and scalable Domain Name System (DNS) services. Used for domain registration and routing traffic to your application. (Essential for public-facing apps)&lt;/p&gt;

&lt;p&gt;III. Compute (Where your code runs)&lt;/p&gt;

&lt;p&gt;Amazon EC2 (Elastic Compute Cloud): Provides resizable virtual servers (instances) to host your backend application code. (Commonly essential for traditional web apps)&lt;/p&gt;

&lt;p&gt;AWS Lambda (Serverless Compute): Runs your code without provisioning or managing servers. Great for event-driven APIs and microservices. (Alternative/Complement to EC2 for modern apps)&lt;/p&gt;

&lt;p&gt;IV. Databases (Where your data lives)&lt;/p&gt;

&lt;p&gt;Amazon RDS (Relational Database Service): A fully managed relational database service (e.g., MySQL, PostgreSQL, MariaDB). (Essential for relational data)&lt;/p&gt;

&lt;p&gt;Amazon DynamoDB (NoSQL Database): A fully managed, high-performance NoSQL database for key-value and document data. (Useful for specific use cases or serverless architectures)&lt;/p&gt;

&lt;p&gt;V. Storage &amp;amp; Content Delivery&lt;/p&gt;

&lt;p&gt;Amazon S3 (Simple Storage Service): Object storage for static content (images, videos, CSS, JS), backups, and logs. (Essential for any web app with static assets)&lt;/p&gt;

&lt;p&gt;Amazon CloudFront (Content Delivery Network - CDN): Speeds up content delivery by caching content globally at edge locations. (Highly recommended for performance)&lt;/p&gt;

&lt;p&gt;VI. Load Balancing &amp;amp; Scaling&lt;/p&gt;

&lt;p&gt;Elastic Load Balancing (ELB) - Application Load Balancer (ALB): Distributes incoming web traffic across multiple EC2 instances for high availability and performance. (Crucial for scalable web apps)&lt;/p&gt;

&lt;p&gt;AWS Auto Scaling (Groups): Automatically adjusts the number of EC2 instances in your application based on demand. (Crucial for scalable web apps)&lt;/p&gt;

&lt;p&gt;VII. Monitoring &amp;amp; Management&lt;/p&gt;

&lt;p&gt;Amazon CloudWatch: Monitors AWS resources and applications, collects logs and metrics, and enables setting alarms. (Essential for operations and troubleshooting)&lt;/p&gt;

&lt;p&gt;AWS Systems Manager (SSM) - Session Manager: Securely manages EC2 instances without needing public SSH ports. (Highly recommended for EC2 administration)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>EBS - An Hard-Drive to EC2 instance</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Sun, 08 Jun 2025 07:58:31 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/ebs-an-hard-drive-to-ec2-instance-4mm1</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/ebs-an-hard-drive-to-ec2-instance-4mm1</guid>
      <description>&lt;h2&gt;
  
  
  💾 Understanding Amazon EBS: The Hard Drive for Your EC2 Instance
&lt;/h2&gt;

&lt;p&gt;When you launch an Amazon EC2 instance (your virtual computer in the cloud), it needs a &lt;strong&gt;hard drive&lt;/strong&gt;—just like your laptop does. That’s where &lt;strong&gt;Amazon Elastic Block Store (EBS)&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;Think of &lt;strong&gt;EBS&lt;/strong&gt; as a &lt;strong&gt;virtual hard drive&lt;/strong&gt; for your EC2 instance. It stores your operating system, applications, logs, and files persistently—even after you stop or restart your EC2 machine.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔧 What Can You Do with EBS?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create, delete, resize, and take &lt;strong&gt;snapshots&lt;/strong&gt; (backups) of your storage&lt;/li&gt;
&lt;li&gt;Use it as the &lt;strong&gt;boot partition&lt;/strong&gt;—where the OS is installed&lt;/li&gt;
&lt;li&gt;Attach multiple EBS volumes to a single EC2 instance if needed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start and stop&lt;/strong&gt; EC2 instances freely because the OS and data stay saved in EBS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So in short:&lt;br&gt;
&lt;strong&gt;"EBS gives a hard drive to my EC2 processor."&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  📦 Creating Attaching and Using an EBS Volume
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzumkxf53ccawx17l1dg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzumkxf53ccawx17l1dg.png" alt=" " width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating a new EBS volume:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Attach&lt;/strong&gt; it to your EC2 instance (from AWS Console or CLI)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format&lt;/strong&gt; it – Choose a file system like &lt;code&gt;ext4&lt;/code&gt; or &lt;code&gt;xfs&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mount&lt;/strong&gt; it – Tell the OS where it should appear in the file directory
&lt;em&gt;(Just like plugging in a USB and seeing a new folder appear)&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F393agphhq4kx1d89besp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F393agphhq4kx1d89besp.png" alt=" " width="667" height="613"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  📸 Snapshots: Cloud Backups
&lt;/h3&gt;

&lt;p&gt;EBS allows you to create &lt;strong&gt;snapshots&lt;/strong&gt;, which are like full backups of your EBS volume at a point in time.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can even &lt;strong&gt;create a new volume from an existing snapshot&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Great for backups, recovery, and cloning environments&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🚀 Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Amazon EBS is the backbone of EC2 storage. It’s flexible, persistent, and behaves just like the physical hard disks we use every day—but in the cloud.&lt;/p&gt;

&lt;p&gt;Whether you're launching a web server or building a complex app, EBS makes sure your EC2 has the storage it needs to run smoothly.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🌐 I Created My First EC2 Instance Web Server on Amazon AWS</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Sat, 31 May 2025 08:06:16 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/i-created-my-first-ec2-instance-web-server-on-amazon-aws-1iek</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/i-created-my-first-ec2-instance-web-server-on-amazon-aws-1iek</guid>
      <description>&lt;p&gt;As part of the Ethnus AWS Internship Foundation Course, I got the chance to create my very first EC2 instance and turn it into a web server using Apache. At first, it seemed like a lot to take in — terms like EC2, web server, Apache, and security groups were new to me. But step by step, I understood how launching a cloud server is different from using a normal laptop, and how everything connects to make your website go live on the internet. This blog shares my beginner-friendly journey and explains all the basic concepts I learned along the way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3wfp0g398p6ny5u09kl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3wfp0g398p6ny5u09kl.png" alt=" " width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EC2 (Elastic Compute Cloud) is like a virtual computer provided by AWS. You can use it to host websites, run code, deploy servers, and more—just like you’d do with a physical laptop or desktop.&lt;/p&gt;

&lt;p&gt;But instead of unboxing a laptop, installing software, and connecting to Wi-Fi, EC2 needs a few extra steps — all done online!&lt;/p&gt;




&lt;h1&gt;
  
  
  Below is the simple table. Due to which I got attracted towards Understanding EC2
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Buying a Laptop&lt;/th&gt;
&lt;th&gt;Launching EC2 on AWS&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ownership&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Physical device you own&lt;/td&gt;
&lt;td&gt;Virtual machine you rent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Setup Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Plug in, boot up&lt;/td&gt;
&lt;td&gt;Multiple steps in the cloud&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Access&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Local, with physical access&lt;/td&gt;
&lt;td&gt;Remote via SSH from anywhere&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fixed hardware&lt;/td&gt;
&lt;td&gt;Can scale up/down in minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Firewall &amp;amp; Security&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pre-configured OS settings&lt;/td&gt;
&lt;td&gt;Must set up security groups manually&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One-time upfront cost&lt;/td&gt;
&lt;td&gt;Pay-as-you-go (hourly or monthly)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use case&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;General personal use&lt;/td&gt;
&lt;td&gt;Hosting web apps, backend APIs, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  🌍 So What Exactly Did I Create?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I created a web server hosted on AWS EC2. That means:&lt;/li&gt;
&lt;li&gt;A real virtual machine in the cloud is running 24/7.&lt;/li&gt;
&lt;li&gt;It’s accessible from anywhere via the internet.&lt;/li&gt;
&lt;li&gt;It serves a web page to anyone who visits its IP address.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Things I learned
&lt;/h1&gt;

&lt;h3&gt;
  
  
  💻 What is an EC2 Instance?
&lt;/h3&gt;

&lt;p&gt;Imagine you're renting a computer from Amazon that lives somewhere in a data center. That’s basically what &lt;strong&gt;EC2 (Elastic Compute Cloud)&lt;/strong&gt; is — a virtual machine you can use just like your laptop, but over the internet.&lt;/p&gt;

&lt;p&gt;When I launched my EC2 instance, I chose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The operating system (I used Amazon Linux)&lt;/li&gt;
&lt;li&gt;The hardware power (how much RAM, CPU, etc.)&lt;/li&gt;
&lt;li&gt;The security settings (who can access it and how)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s like building your own remote laptop, but with the flexibility to turn it off when you don’t need it (and save money!).&lt;/p&gt;




&lt;h3&gt;
  
  
  🌍 Turning It Into a Web Server with Apache
&lt;/h3&gt;

&lt;p&gt;Now, what’s a &lt;strong&gt;web server&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;A web server is just a computer that listens for people asking to visit a website — and then shows them the page.&lt;/p&gt;

&lt;p&gt;To make my EC2 instance a web server, I installed &lt;strong&gt;Apache&lt;/strong&gt;, which is free software that knows how to serve websites. It's like a waiter who listens to what people want and delivers the right dish — in this case, your website.&lt;/p&gt;

&lt;p&gt;So I did this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Logged into my EC2 using SSH (like remote terminal)&lt;/li&gt;
&lt;li&gt;Installed Apache using a simple command&lt;/li&gt;
&lt;li&gt;Uploaded an HTML page to Apache’s folder&lt;/li&gt;
&lt;li&gt;Modified the &lt;strong&gt;security group&lt;/strong&gt; to allow HTTP (port 80) so people could actually view my website&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And boom — when I typed my EC2’s public IP into a browser, my webpage appeared! 🚀&lt;/p&gt;




&lt;h3&gt;
  
  
  ⚙️ Why Not Just Use a Laptop?
&lt;/h3&gt;

&lt;p&gt;This was a question I had myself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why launch a whole EC2 when I have a laptop?&lt;/strong&gt;&lt;br&gt;
But here’s what I learned:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Laptop 🧑‍💻&lt;/th&gt;
&lt;th&gt;EC2 Instance ☁️&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Personal use&lt;/td&gt;
&lt;td&gt;Public access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shuts down often&lt;/td&gt;
&lt;td&gt;Always on (24/7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hard to scale&lt;/td&gt;
&lt;td&gt;Can scale to more users instantly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not made for hosting websites&lt;/td&gt;
&lt;td&gt;Designed for it&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An EC2 instance is made for &lt;strong&gt;hosting websites&lt;/strong&gt;, handling traffic, and being reliable all the time — unlike your personal computer.&lt;/p&gt;




&lt;h3&gt;
  
  
  🧠 Other Things I Learned Along the Way
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt;: They control who can access your EC2. I had to open port 80 (for HTTP) to let browsers connect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Termination Protection&lt;/strong&gt;: I enabled this so I don’t delete my instance by mistake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stop Protection&lt;/strong&gt;: Prevents me from accidentally shutting it down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apache vs. Flask/Node.js&lt;/strong&gt;: Apache is perfect for basic websites. If I build dynamic websites with Python or JavaScript, I might use &lt;strong&gt;Flask&lt;/strong&gt; or &lt;strong&gt;Node.js&lt;/strong&gt; instead.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Understanding Why AWS Skills Are So Valuable
&lt;/h1&gt;

&lt;p&gt;One of the most powerful things I realized while working with EC2 is how it gives you full control over your own network and security setup. When launching an EC2 instance, you don't just get a virtual computer — you also get to define who can access it, from where, and how, using things like Security Groups, Key Pairs, and VPCs (Virtual Private Clouds). It felt like setting up my own mini data center. This hands-on experience showed me why AWS-related jobs are in such high demand — because professionals who know how to manage these systems can build secure, scalable, and reliable infrastructure for companies around the world. You're not just using a service; you're designing the rules and architecture behind it.&lt;/p&gt;




&lt;h1&gt;
  
  
  ✅ Steps to Create an EC2 Instance (with Simple Explanations)
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Step&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;What You Do&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Why It’s Necessary (Simple Explanation)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Go to EC2 Dashboard&lt;/td&gt;
&lt;td&gt;This is the control panel for managing your virtual servers on AWS.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Click "Launch Instance"&lt;/td&gt;
&lt;td&gt;Starts the process to create your virtual server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Name Your Instance&lt;/td&gt;
&lt;td&gt;Helps you identify and manage your instances easily.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Choose AMI (Amazon Machine Image)&lt;/td&gt;
&lt;td&gt;Selects the operating system (like Ubuntu, Amazon Linux, Windows). It's like choosing the OS on a laptop.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Choose Instance Type&lt;/td&gt;
&lt;td&gt;Decides the virtual hardware power (CPU, RAM). Like choosing the performance level of a computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Create/Select Key Pair&lt;/td&gt;
&lt;td&gt;Used to securely connect to your instance (via SSH). Think of it as a digital door key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Configure Network Settings (VPC &amp;amp; Subnet)&lt;/td&gt;
&lt;td&gt;Places your server in a specific virtual network. Like assigning your laptop to a specific Wi-Fi zone.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Set Up Security Group&lt;/td&gt;
&lt;td&gt;Acts like a firewall. You define which ports (like SSH or HTTP) are allowed in and out.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;Add Storage (EBS Volume)&lt;/td&gt;
&lt;td&gt;Provides a virtual hard drive for your instance. Stores OS, files, and data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;(Optional) Enable Monitoring &amp;amp; Protection&lt;/td&gt;
&lt;td&gt;Add features like auto-monitoring and protection from accidental deletion.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;Review and Launch&lt;/td&gt;
&lt;td&gt;Final check to ensure everything is correct before launching.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;Connect to Instance (via SSH)&lt;/td&gt;
&lt;td&gt;Lets you access and control your server from your local computer or browser.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Understanding Cloud Computing Deployment Models</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Mon, 19 May 2025 13:39:04 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/understanding-cloud-computing-deployment-models-14hg</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/understanding-cloud-computing-deployment-models-14hg</guid>
      <description>&lt;h1&gt;
  
  
  🌐 Understanding Cloud Computing Deployment Models
&lt;/h1&gt;

&lt;p&gt;In today's digital world, cloud computing has revolutionized how businesses operate by offering scalable, on-demand access to computing resources. But before you dive into building on the cloud, it’s important to understand the different &lt;strong&gt;cloud deployment models&lt;/strong&gt; — the way cloud services are made available to users.&lt;/p&gt;

&lt;p&gt;There are &lt;strong&gt;four primary deployment models&lt;/strong&gt; in cloud computing: &lt;strong&gt;Public, Private, Hybrid,&lt;/strong&gt; and &lt;strong&gt;Community&lt;/strong&gt;. Each has its strengths and ideal use cases.&lt;/p&gt;




&lt;h2&gt;
  
  
  ☁️ 1. Public Cloud
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;public cloud&lt;/strong&gt; is owned and operated by third-party service providers like Amazon Web Services (AWS), Microsoft Azure, or Google Cloud Platform. These providers manage all infrastructure, and users access resources via the internet.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cost-effective (pay-as-you-go model)&lt;/li&gt;
&lt;li&gt;Scalable and flexible&lt;/li&gt;
&lt;li&gt;No need for hardware management&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔒 Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Limited control over data security&lt;/li&gt;
&lt;li&gt;Shared infrastructure may not suit highly sensitive applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Startups, SaaS products, and websites with variable traffic.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏢 2. Private Cloud
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;private cloud&lt;/strong&gt; is used exclusively by a single organization. It can be hosted on-premise or by a third-party provider but is isolated from public access.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Greater control over data and infrastructure&lt;/li&gt;
&lt;li&gt;High security and compliance&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔒 Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Expensive to maintain&lt;/li&gt;
&lt;li&gt;Requires in-house IT expertise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Banks, government agencies, or enterprises with strict data privacy needs.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔁 3. Hybrid Cloud
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;hybrid cloud&lt;/strong&gt; combines both public and private clouds. It allows data and applications to be shared between them, offering greater flexibility and optimized workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Balances cost and control&lt;/li&gt;
&lt;li&gt;Enables gradual cloud adoption&lt;/li&gt;
&lt;li&gt;Supports disaster recovery and data backup&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔒 Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Complex to manage&lt;/li&gt;
&lt;li&gt;Potential compatibility issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Organizations needing both security for sensitive data and scalability for public-facing services.&lt;/p&gt;




&lt;h2&gt;
  
  
  👥 4. Community Cloud
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;community cloud&lt;/strong&gt; is shared among organizations with common goals or requirements, such as security standards or compliance rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cost shared among users&lt;/li&gt;
&lt;li&gt;Customized for a specific group’s needs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔒 Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Less control compared to private cloud&lt;/li&gt;
&lt;li&gt;Limited scalability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Healthcare organizations, research institutions, or financial services firms.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Choosing the right cloud deployment model depends on your &lt;strong&gt;budget&lt;/strong&gt;, &lt;strong&gt;security needs&lt;/strong&gt;, and &lt;strong&gt;scalability requirements&lt;/strong&gt;. Many modern organizations are moving toward &lt;strong&gt;hybrid solutions&lt;/strong&gt; to get the best of both worlds. Understanding these models helps in making informed, strategic decisions for cloud adoption.&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Weaving Looms Led to Today’s Computers: A Simple History</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Mon, 19 May 2025 09:03:04 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/how-weaving-looms-led-to-todays-computers-a-simple-history-3mco</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/how-weaving-looms-led-to-todays-computers-a-simple-history-3mco</guid>
      <description>&lt;p&gt;Have you ever thought about how the simple act of weaving cloth is connected to the computers we use today? It might sound surprising, but the story of computers begins with weaving looms!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Beginning: Weaving and Patterns
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/MQzpLLhN0fY"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
Long ago, people used &lt;strong&gt;looms&lt;/strong&gt; to weave fabric. These looms created patterns by controlling how threads crossed each other. In the early 1800s, a clever inventor named &lt;strong&gt;Joseph-Marie Jacquard&lt;/strong&gt; invented a loom that used &lt;strong&gt;punched cards&lt;/strong&gt; to tell the machine which pattern to weave. These cards acted like instructions — telling the loom what to do step by step.&lt;/p&gt;

&lt;p&gt;This was one of the first examples of a &lt;strong&gt;programmable machine&lt;/strong&gt; — a machine that could follow a set of instructions automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mechanical Calculators: The First Computers?
&lt;/h2&gt;

&lt;p&gt;Around the same time, inventors were building machines to help with calculations. People like &lt;strong&gt;Blaise Pascal&lt;/strong&gt; and &lt;strong&gt;Gottfried Wilhelm Leibniz&lt;/strong&gt; made mechanical calculators that could add, subtract, multiply, and divide numbers. These machines were the ancestors of the computer calculators inside your phone or laptop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter Charles Babbage and Ada Lovelace
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/XSkGY6LchJs"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
Inspired by Jacquard’s loom, &lt;strong&gt;Charles Babbage&lt;/strong&gt; designed a mechanical computer called the &lt;strong&gt;Analytical Engine&lt;/strong&gt;. It was a machine that could do any kind of calculation if you gave it the right instructions — much like modern computers.&lt;/p&gt;

&lt;p&gt;His friend, &lt;strong&gt;Ada Lovelace&lt;/strong&gt;, wrote the very first computer program for this machine. That’s why she’s often called the world’s first programmer!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Theory Behind Computation
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/7TycxwFmdB0"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
Fast forward to the 1930s, when mathematicians like &lt;strong&gt;Alan Turing&lt;/strong&gt; and &lt;strong&gt;Alonzo Church&lt;/strong&gt; asked a big question: &lt;em&gt;What problems can machines solve?&lt;/em&gt; They created abstract ideas like the &lt;strong&gt;Turing Machine&lt;/strong&gt; — not a real machine, but a way to think about computation.&lt;/p&gt;

&lt;p&gt;These theories helped us understand what computers can and cannot do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Electronic Computers and the Digital Age
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/FU_YFpfDqqA"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
In the 1940s and 50s, electronic computers were built using vacuum tubes and later transistors. These machines were huge but much faster than mechanical calculators.&lt;/p&gt;

&lt;p&gt;With the invention of programming languages and better hardware, computers became smaller, faster, and more powerful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Today and Beyond
&lt;/h2&gt;

&lt;p&gt;Modern computers are everywhere — in our phones, cars, and even homes. The idea of programming with instructions, which started with punched cards in weaving looms, is still at the heart of everything computers do.&lt;/p&gt;

&lt;p&gt;Now, we’re exploring new frontiers like &lt;strong&gt;artificial intelligence&lt;/strong&gt; and &lt;strong&gt;quantum computing&lt;/strong&gt;, but it all started with a simple pattern on a loom.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why Does This Matter?
&lt;/h3&gt;

&lt;p&gt;Understanding this history shows us that technology builds on earlier ideas. Even simple inventions like a weaving loom paved the way for the complex machines we use today.&lt;/p&gt;

&lt;p&gt;Isn’t it amazing how something so old connects directly to the future?&lt;/p&gt;




</description>
    </item>
    <item>
      <title>SVD Application in Machine Learning</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Thu, 02 Jan 2025 17:06:39 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/svd-application-in-machine-learning-44oh</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/svd-application-in-machine-learning-44oh</guid>
      <description>&lt;p&gt;SVD is commonly used in collaborative filtering methods, especially for predicting ratings in recommendation systems (e.g., Netflix, Amazon).&lt;/p&gt;

&lt;p&gt;To make predictions using SVD, we use the decomposed matrices (U, S, and Vt) to approximate missing values (i.e., ratings that a user has not given for a movie). Here's how it works:&lt;/p&gt;

&lt;h2&gt;
  
  
  How Predictions Are Made with SVD:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Reconstruction of the Matrix: After applying SVD to the user-item matrix, you get three matrices: U (user features), S (singular values), and Vt (movie features).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Approximation: By multiplying these matrices back together, you get an approximation of the original matrix, where missing values are filled in with predicted ratings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prediction: The reconstructed matrix provides approximate values for missing ratings based on the latent patterns discovered in the data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9s2vly746uqtwp84yvif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9s2vly746uqtwp84yvif.png" alt=" " width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: SVD doesn't "know" where the ratings are missing, but we can use the fact that SVD approximates the original matrix based on the patterns it detects in the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  What SVD Does:
&lt;/h2&gt;

&lt;p&gt;SVD decomposes this matrix into three matrices: U, S, and Vt.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;U matrix: Represents user features (latent factors related to users).&lt;/li&gt;
&lt;li&gt;S matrix: Contains singular values, representing the importance of each latent factor.&lt;/li&gt;
&lt;li&gt;Vt matrix: Represents movie features (latent factors related to movies).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SVD's goal is to find the patterns in the user ratings and approximate the original matrix by breaking it down into these three matrices. When we multiply them together, we get an approximation of the original matrix. For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Original matrix ≈ U * S * Vt&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SVD and Missing Values:
&lt;/h2&gt;

&lt;p&gt;Here's the key: SVD doesn't directly "know" the missing values. It works with the zeros where the data is missing, but it doesn't treat them as actual ratings. Instead, it tries to approximate the entire matrix (including the zeros) based on patterns in the known data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When performing SVD, we decompose the matrix where the missing values are filled with zero.&lt;/li&gt;
&lt;li&gt;The decomposition identifies patterns across users and movies.&lt;/li&gt;
&lt;li&gt;Even though the values are missing (i.e., zero), SVD will approximate these missing values based on the relationship between the non-zero ratings. For example, it may find that a particular user tends to rate movies similarly, or that certain movies are rated similarly by many users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s a simple example of a movie recommendation system using SVD (Singular Value Decomposition). This program will predict movie ratings for a user and recommend movies based on those predictions.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Prepare the data: We'll use a simple movie rating dataset (in this example, we'll create a small user-item matrix manually).&lt;/li&gt;
&lt;li&gt;Apply SVD: Decompose the matrix using SVD.&lt;/li&gt;
&lt;li&gt;Reconstruct the matrix: Use the decomposed matrices to predict missing values (i.e., missing ratings).&lt;/li&gt;
&lt;li&gt;Recommend movies: Based on the predicted ratings, recommend the top N movies for a user.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="c1"&gt;# Step 1: Create a user-item matrix (ratings matrix)
# Rows: Users (0 to 4)
# Columns: Movies (0 to 4)
# Values: Ratings (1 to 5), 0 indicates a missing rating
&lt;/span&gt;
&lt;span class="n"&gt;ratings_matrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;  &lt;span class="c1"&gt;# User 0's ratings
&lt;/span&gt;    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;  &lt;span class="c1"&gt;# User 1's ratings
&lt;/span&gt;    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;  &lt;span class="c1"&gt;# User 2's ratings
&lt;/span&gt;    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;  &lt;span class="c1"&gt;# User 3's ratings
&lt;/span&gt;    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# User 4's ratings
&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;# Step 2: Perform SVD on the ratings matrix
# Decompose the matrix into three matrices: U, S, and Vt
&lt;/span&gt;&lt;span class="n"&gt;U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;S&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Vt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;linalg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;svd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ratings_matrix&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;full_matrices&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Step 3: Reconstruct the matrix by multiplying U, S, and Vt
# Note: We approximate the matrix by reducing the number of components (k)
&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;  &lt;span class="c1"&gt;# Use 2 latent factors for this example (you can experiment with this value)
&lt;/span&gt;&lt;span class="n"&gt;S_k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;diag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;S&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;  &lt;span class="c1"&gt;# Take the first 'k' singular values
&lt;/span&gt;&lt;span class="n"&gt;U_k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;U&lt;/span&gt;&lt;span class="p"&gt;[:,&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;        &lt;span class="c1"&gt;# Take the first 'k' columns of U
&lt;/span&gt;&lt;span class="n"&gt;Vt_k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Vt&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;:]&lt;/span&gt;      &lt;span class="c1"&gt;# Take the first 'k' rows of Vt
&lt;/span&gt;
&lt;span class="c1"&gt;# Reconstruct the matrix using the reduced matrices
&lt;/span&gt;&lt;span class="n"&gt;reconstructed_matrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;U_k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;S_k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Vt_k&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;# Step 4: Predict ratings for missing values (approximated ratings)
# Let's print the original matrix and the reconstructed matrix
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Original Ratings Matrix:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ratings_matrix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Reconstructed Ratings Matrix (Predictions for missing values):&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reconstructed_matrix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Step 5: Recommend movies for User 0 based on the predicted ratings
# For User 0, find the movies with the highest predicted ratings (excluding already rated ones)
&lt;/span&gt;&lt;span class="n"&gt;user_index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;  &lt;span class="c1"&gt;# User 0
&lt;/span&gt;&lt;span class="n"&gt;predicted_ratings_user_0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reconstructed_matrix&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;user_index&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Find movies with highest predicted ratings (we'll ignore already rated movies)
&lt;/span&gt;&lt;span class="n"&gt;rated_movies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ratings_matrix&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;user_index&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;predicted_ratings_user_0&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;rated_movies&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;  &lt;span class="c1"&gt;# Exclude already rated movies by setting them to -1
&lt;/span&gt;
&lt;span class="c1"&gt;# Get the indices of the top N recommended movies
&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;  &lt;span class="c1"&gt;# Recommend top 3 movies
&lt;/span&gt;&lt;span class="n"&gt;recommended_movie_indices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;predicted_ratings_user_0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;argsort&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;:][::&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Print recommended movies (indices of the movies)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Top 3 movie recommendations for User 0:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;idx&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;recommended_movie_indices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Movie &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: Predicted Rating = &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;predicted_ratings_user_0&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original Ratings Matrix:
[[5 0 0 2 0]
 [4 0 0 1 0]
 [1 1 0 5 4]
 [0 0 5 4 0]
 [0 3 4 0 5]]

Reconstructed Ratings Matrix (Predictions for missing values):
[[4.54577411 1.08670443 2.20015523 3.53068276 2.80830327]
 [4.24466444 1.12701613 1.98279903 3.2210786  2.73432993]
 [2.39280315 1.31704768 3.93904552 4.31580358 3.70635026]
 [1.24819589 1.23391165 4.26573872 4.30332321 2.62780186]
 [3.04222213 3.01697039 3.96412569 3.01974792 4.46130856]]

Top 3 movie recommendations for User 0:
Movie 2: Predicted Rating = 2.20
Movie 4: Predicted Rating = 2.81
Movie 3: Predicted Rating = 3.53
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>newyearchallenge</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Difference Between Merge Sort and Quick Sort</title>
      <dc:creator>Priyam Jain</dc:creator>
      <pubDate>Mon, 30 Dec 2024 04:21:33 +0000</pubDate>
      <link>https://forem.com/priyam_jain_f127ddf8c4d8d/difference-between-merge-sort-and-quick-sort-3npc</link>
      <guid>https://forem.com/priyam_jain_f127ddf8c4d8d/difference-between-merge-sort-and-quick-sort-3npc</guid>
      <description>&lt;p&gt;In &lt;strong&gt;Quick Sort&lt;/strong&gt;, we sort the array by selecting a pivot element and partitioning the array such that all elements smaller than the pivot are on its left and all elements larger are on its right. This process is repeated recursively for the subarrays on either side of the pivot until all elements are in their correct positions relative to each other. Through this process, the entire array gets sorted without requiring any additional array, as the sorting is done in-place.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Merge Sort&lt;/strong&gt;, the array is divided into two halves recursively until each half contains a single element or is empty. Then, the sorted halves are merged together by comparing elements from each half and arranging them in sorted order. This process continues until the entire array is merged and sorted. Unlike Quick Sort, Merge Sort requires additional memory to store temporary arrays during the merging process.&lt;/p&gt;

</description>
      <category>sorting</category>
      <category>algorithms</category>
    </item>
  </channel>
</rss>
