<?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 UMME HABIBA TANNY on Medium]]></title>
        <description><![CDATA[Stories by UMME HABIBA TANNY on Medium]]></description>
        <link>https://medium.com/@umme7072?source=rss-39c6ab4d526c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0Yea-hSWkSaR2uGn</url>
            <title>Stories by UMME HABIBA TANNY on Medium</title>
            <link>https://medium.com/@umme7072?source=rss-39c6ab4d526c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 12:10:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@umme7072/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[What is Superposition and Entanglement in Quantum Computing?]]></title>
            <link>https://medium.com/@umme7072/what-is-superposition-and-entanglement-in-quantum-computing-f6dcf815e4f3?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6dcf815e4f3</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Thu, 13 Jun 2024 16:20:16 GMT</pubDate>
            <atom:updated>2024-06-13T16:48:17.942Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*7ZWNOnzbrCSXTNFV1upknA.jpeg" /><figcaption>Superposition of qubits</figcaption></figure><p>Superposition is a fundamental principle in quantum mechanics that allows particles, such as electrons or qubits in quantum computing, to exist in multiple states at the same time. Here’s a simplified explanation:</p><h3>Classical vs. Quantum States</h3><p><strong>Classical State</strong>: In classical computing, a bit is either 0 or 1. Think of it like a switch that is either off or on.</p><p><strong>Quantum State</strong>: A qubit, on the other hand, can be in a state that is both 0 and 1 simultaneously. This is what we call superposition.</p><h3>Understanding Superposition with an Analogy</h3><p>Imagine you have a coin.</p><ul><li>In classical terms, the coin is either heads (0) or tails (1) when it lands.</li><li>In the quantum world, while the coin is spinning in the air, it can be thought of as being in a superposition of both heads and tails. It’s not just one or the other until you observe (measure) it.</li></ul><h3>How Superposition Works</h3><p>A qubit in superposition is described by a combination of its possible states. Mathematically, this is represented as:</p><p>∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle∣ψ⟩=α∣0⟩+β∣1⟩</p><p>Here:</p><ul><li>∣ψ⟩|\psi\rangle∣ψ⟩ is the state of the qubit.</li><li>∣0⟩|0\rangle∣0⟩ and ∣1⟩|1\rangle∣1⟩ are the basis states (like heads and tails of the coin).</li><li>α\alphaα and β\betaβ are complex numbers that describe the probability amplitudes of the qubit being in state 0 and state 1, respectively. The probabilities are found by squaring these amplitudes, such that ∣α∣2+∣β∣2=1|\alpha|² + |\beta|² = 1∣α∣2+∣β∣2=1.</li></ul><h3>Why Superposition is Powerful</h3><p>Superposition allows quantum computers to process a vast number of possibilities simultaneously. For instance, if you have multiple qubits in superposition, they can represent and compute all possible combinations of their states at once. This capability is what gives quantum computers their potential to solve complex problems much faster than classical computers.</p><h3>Observing Superposition</h3><p>When you measure a qubit in superposition, it “collapses” to one of its basis states (either 0 or 1) with a certain probability. The act of measurement forces the qubit out of superposition into a definite state.</p><p>In summary, superposition is like having many possibilities at once, which only become a single reality when observed. This property is essential for the power and efficiency of quantum computing.</p><p>Entanglement is a phenomenon in quantum mechanics where two or more particles become interconnected in such a way that the state of one particle instantaneously influences the state of the other, no matter how far apart they are. Here’s a simplified explanation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*XsNySmL22Xiu39wSQX7V4Q.jpeg" /><figcaption>Bit, Superposition, Entanglement</figcaption></figure><h3>Classical vs. Quantum Entanglement</h3><p><strong>Classical World</strong>: In the classical world, objects are independent of each other. The state of one object does not affect the state of another unless they physically interact.</p><p><strong>Quantum World</strong>: In the quantum world, entangled particles have linked properties. If you measure the state of one particle, you instantly know the state of the other, even if they are light-years apart.</p><h3>How Entanglement Works</h3><p><strong>Creation of Entanglement</strong>: Entanglement occurs when particles interact in specific ways. For example, two particles can become entangled through certain interactions or quantum processes.</p><p><strong>Linked States</strong>: Once entangled, the state of each particle cannot be described independently. Instead, the overall state of the system must be described as a whole. If you measure one particle and find it in a particular state, the other particle’s state is immediately known, regardless of the distance between them.</p><p><strong>Example with Qubits</strong>: Suppose you have two qubits, A and B, in an entangled state. If qubit A is measured and found to be in state 0, qubit B will instantaneously be in state 1, and vice versa. The entanglement means the qubits’ states are perfectly correlated.</p><h3>Visualization of Entanglement</h3><p>Imagine you have two magic dice that are entangled. If you roll one die and it lands on a 3, the other die, no matter where it is in the universe, will simultaneously show a 3. The outcomes are perfectly linked.</p><h3>Why Entanglement is Important</h3><ol><li><strong>Quantum Computing</strong>: Entanglement is essential for quantum computing, allowing qubits to work together in ways that classical bits cannot. This interdependence enables more powerful and efficient processing.</li><li><strong>Quantum Communication</strong>: Entanglement is the basis for quantum communication protocols, such as quantum key distribution for secure communication. Entangled particles can be used to transmit information in a way that is theoretically secure against eavesdropping.</li><li><strong>Quantum Teleportation</strong>: Entanglement allows for quantum teleportation, where the state of a particle can be transferred to another particle at a different location without moving through the intervening space.</li></ol><h3>Summary</h3><p>Entanglement is a unique and counterintuitive property of quantum mechanics where particles become interconnected so that the state of one instantly affects the state of the other, no matter the distance between them. This phenomenon is key to the power of quantum technologies, enabling advanced computing, secure communication, and novel forms of information transfer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6dcf815e4f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Qubit?]]></title>
            <link>https://medium.com/@umme7072/what-is-qubit-5a67cfda887d?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a67cfda887d</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Thu, 13 Jun 2024 16:16:44 GMT</pubDate>
            <atom:updated>2024-06-13T16:16:44.697Z</atom:updated>
            <content:encoded><![CDATA[<p>A qubit, or quantum bit, is the basic unit of information in quantum computing. Here’s a simple way to understand it:</p><p><strong>Classical Bit versus Qubit</strong></p><p><strong>Classical Bit</strong>: In traditional computing, a bit can be either a 0 or a 1. It’s like a simple switch that is either off (0) or on (1).</p><p><strong>Qubit</strong>: In quantum computing, a qubit can be both 0 and 1 at the same time, thanks to a property called superposition. It’s like a spinning coin that represents both heads (0) and tails (1) until you stop it and see the result.</p><p><strong>Key Properties of Qubits</strong></p><p><strong>Superposition</strong>: A qubit can be in a state where it is both 0 and 1 simultaneously. This allows quantum computers to process a vast amount of information at once.</p><p><strong>Entanglement</strong>: Qubits can be entangled, meaning the state of one qubit can depend on the state of another, no matter how far apart they are. This leads to correlations between qubits that classical bits can’t achieve.</p><p><strong>Interference</strong>: Qubits can interfere with each other, which can be used to amplify correct answers and cancel out incorrect ones in quantum algorithms.</p><h3>Visualization</h3><p>Imagine a qubit as a sphere. A classical bit can only be at the north or south pole of this sphere (0 or 1). A qubit, however, can be anywhere on the surface of the sphere, representing a combination of both 0 and 1.</p><h3>Why It Matters</h3><p>Qubits enable quantum computers to solve certain complex problems much faster than classical computers. For example, they could factor large numbers, simulate molecules for drug discovery, and optimize large systems in ways that are currently impractical with classical computers.</p><p>In summary, a qubit is like a flexible, multi-dimensional version of a classical bit, harnessing the principles of quantum mechanics to perform advanced computations.</p><p>4o</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a67cfda887d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cryptography vs Encryption vs Decryption]]></title>
            <link>https://medium.com/@umme7072/cryptography-vs-encryption-vs-decryption-3457d2518558?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3457d2518558</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Wed, 12 Jun 2024 05:28:09 GMT</pubDate>
            <atom:updated>2024-06-12T07:01:14.594Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Cryptography</h3><p><strong>Definition</strong>: Cryptography is the overall field of study and practice that involves techniques for secure communication in the presence of third parties, known as adversaries.</p><p><strong>Purpose</strong>: To protect information by transforming it into a secure format that cannot be easily understood by unauthorized users.</p><p><strong>Components</strong>:</p><ul><li><strong>Algorithms</strong>: Mathematical formulas used to encrypt and decrypt data.</li><li><strong>Keys</strong>: Secret values used in conjunction with algorithms to lock and unlock the data.</li><li><strong>Protocols</strong>: Rules that define how algorithms and keys are used to secure communications.</li></ul><p><strong>Examples</strong>:</p><ul><li><strong>Symmetric Key Cryptography</strong>: Uses the same key for both encryption and decryption (e.g., AES).</li><li><strong>Asymmetric Key Cryptography</strong>: Uses a pair of keys (public and private) for encryption and decryption (e.g., RSA).</li></ul><h3>2. Encryption</h3><p><strong>Definition</strong>: Encryption is the process of converting plaintext (readable data) into ciphertext (encoded data) using a cryptographic algorithm and an encryption key.</p><p><strong>Purpose</strong>: To protect the confidentiality of data by making it unreadable to anyone who does not have the decryption key.</p><p><strong>Process</strong>:</p><ol><li><strong>Plaintext</strong>: The original readable data.</li><li><strong>Encryption Algorithm</strong>: The method used to transform the plaintext.</li><li><strong>Encryption Key</strong>: A secret value used by the algorithm to encrypt the data.</li><li><strong>Ciphertext</strong>: The encrypted, unreadable data.</li></ol><p><strong>Examples</strong>:</p><ul><li><strong>AES (Advanced Encryption Standard)</strong>: A symmetric encryption algorithm.</li><li><strong>RSA (Rivest-Shamir-Adleman)</strong>: An asymmetric encryption algorithm.</li></ul><h3>3. Decryption</h3><p><strong>Definition</strong>: Decryption is the process of converting ciphertext back into plaintext using a cryptographic algorithm and a decryption key.</p><p><strong>Purpose</strong>: To revert the encrypted data back to its original readable form so it can be understood by the intended recipient.</p><p><strong>Process</strong>:</p><ol><li><strong>Ciphertext</strong>: The encrypted, unreadable data.</li><li><strong>Decryption Algorithm</strong>: The method used to transform the ciphertext back into plaintext.</li><li><strong>Decryption Key</strong>: A secret value used by the algorithm to decrypt the data.</li><li><strong>Plaintext</strong>: The original readable data after decryption.</li></ol><p><strong>Examples</strong>:</p><ul><li><strong>Decrypting AES</strong>: Using the same key that was used to encrypt the data to reverse the encryption.</li><li><strong>Decrypting RSA</strong>: Using the private key to decrypt data that was encrypted with the corresponding public key.</li></ul><h3>How They Relate</h3><ul><li><strong>Cryptography</strong>: The broader science and art encompassing encryption and decryption.</li><li><strong>Encryption</strong>: A specific cryptographic process to protect data by transforming it into an unreadable format.</li><li><strong>Decryption</strong>: The reverse process of encryption, converting the unreadable format back into readable data.</li></ul><h3>Analogy</h3><ul><li><strong>Cryptography</strong>: Think of it as the study of creating secure safes and the methods to lock and unlock them.</li><li><strong>Encryption</strong>: This is like locking your valuables in the safe using a key.</li><li><strong>Decryption</strong>: This is like using the key to open the safe and access your valuables.</li></ul><h3>Summary</h3><ul><li><strong>Cryptography</strong> is the overarching field that includes various techniques and principles for securing information.</li><li><strong>Encryption</strong> is the method used to convert readable data into a secure, unreadable format.</li><li><strong>Decryption</strong> is the method used to convert the unreadable data back into its original, readable form.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3457d2518558" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature Engineering in Machine Learning : 
Technique for finding the efficient feature for a task.]]></title>
            <link>https://medium.com/@umme7072/feature-engineering-in-machine-learning-technique-for-finding-the-efficient-feature-for-a-task-32ea5f401be1?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/32ea5f401be1</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Fri, 03 Nov 2023 14:00:15 GMT</pubDate>
            <atom:updated>2023-11-03T14:00:15.621Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Feature Engineering in Machine Learning : </strong><br>Technique for finding the efficient feature for a task.</h3><p>In machine learning, identifying major features or important variables is a critical step in the model development process. Feature selection and feature engineering are two common techniques for achieving this. Here’s an overview of these techniques:</p><h4>Feature Selection: Feature selection involves choosing a subset of the most relevant features from the original feature set. The goal is to reduce the dimensionality of the data while retaining the most important information. Common methods for feature selection include:</h4><p><strong>a. Filter Methods:</strong> These methods rank features based on statistical metrics and select the top-ranked features. Examples include chi-squared test, mutual information, and correlation analysis.</p><p><strong>b. Wrapper Methods:</strong> Wrapper methods use the machine learning model’s performance as a criterion for feature selection. Common techniques include forward selection, backward elimination, and recursive feature elimination (RFE).</p><p><strong>c. Embedded Methods:</strong> Embedded methods integrate feature selection into the model training process. Techniques like L1 regularization (Lasso) for linear models and tree-based methods like Random Forest can automatically select important features during training.</p><p><strong>d. Feature Importance Scores:</strong> Some machine learning algorithms, like decision trees and random forests, provide feature importance scores, which can be used to rank features based on their contribution to the model’s performance.</p><h4><strong>Feature Engineering:</strong> Feature engineering involves creating new features or transforming existing ones to enhance the predictive power of your model. It’s often an iterative process that requires domain knowledge and creativity. Some common techniques in feature engineering include:</h4><p><strong>a. Creating Interaction Terms:</strong> Combining two or more features to capture complex relationships that the model might not learn from individual features alone.</p><p><strong>b. Polynomial Features:</strong> Introducing polynomial terms (e.g., x², x³) to capture non-linear relationships between features and the target variable.</p><p><strong>c. Encoding Categorical Variables: </strong>Converting categorical variables into numerical representations, such as one-hot encoding or label encoding, to make them compatible with machine learning algorithms.</p><p>d<strong>. Binning and Discretization:</strong> Grouping continuous variables into bins or categories to simplify their representation and capture non-linear patterns.</p><p><strong>e. Time-Based Features:</strong> Extracting time-related features from date-time data, such as day of the week, month, or season, which can be valuable for time series analysis.</p><p><strong>f. Feature Scaling and Normalization:</strong> Scaling features to a common range (e.g., using Min-Max scaling or Z-score standardization) to ensure that they have similar importance within the model.</p><p>It’s important to note that the choice of feature selection and engineering techniques depends on the specific dataset, problem, and domain knowledge. Experimentation and iterative refinement are often required to find the most effective features for your machine-learning model. Additionally, the use of domain expertise can significantly aid in feature selection and engineering, as it can uncover meaningful relationships and insights that automated methods might miss.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32ea5f401be1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Slpoe?]]></title>
            <link>https://medium.com/@umme7072/what-is-slpoe-d698c776be86?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d698c776be86</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Wed, 04 Oct 2023 05:32:47 GMT</pubDate>
            <atom:updated>2023-10-04T05:32:47.937Z</atom:updated>
            <content:encoded><![CDATA[<p>In mathematics, the slope is a measure of the steepness or incline of a line on a graph. It describes how much a line rises or falls as you move from left to right along the x-axis. The slope of a line is typically represented by the letter “m” and is calculated as the change in the y-coordinate (vertical change) divided by the change in the x-coordinate (horizontal change) between two points on the line. The formula for calculating the slope (m) between two points, (x1, y1) and (x2, y2), is:</p><p><em>m</em>=<em>y</em>2​−<em>y</em>1​​/x2-x1</p><p>Here’s what the components of this formula represent:</p><ul><li><em>m</em> is the slope of the line.</li><li><em>x</em>1​ and <em>x</em>2​ are the x-coordinates of the two points.</li><li><em>y</em>1​ and <em>y</em>2​ are the y-coordinates of the two points.</li></ul><p>The slope can be positive, negative, zero, or undefined, depending on the relationship between the points on the line:</p><ol><li>Positive Slope: If the line rises as you move from left to right, the slope is positive.</li><li>Negative Slope: If the line falls as you move from left to right, the slope is negative.</li><li>Zero Slope: If the line is horizontal (neither rising nor falling), the slope is zero.</li><li>Undefined Slope: If the line is vertical (rising or falling infinitely), the slope is undefined.</li></ol><p>Slope is a fundamental concept in algebra and geometry and is used in various fields, including physics, engineering, economics, and more, to analyze and describe the relationship between variables and the inclination of lines or curves.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d698c776be86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How intercept and coefficient are learned during the training period in ML.]]></title>
            <link>https://medium.com/@umme7072/how-intercept-and-coefficient-are-learned-during-the-training-period-in-ml-5bde5ee7cf2b?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bde5ee7cf2b</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 16:28:26 GMT</pubDate>
            <atom:updated>2023-09-23T16:28:26.698Z</atom:updated>
            <content:encoded><![CDATA[<p>In machine learning, the values of b0 (intercept) and b1 (coefficients) are learned from the training data through a process called model training or model fitting. The goal of this process is to find the values of b0 and b1 that minimize the difference between the predicted values produced by the model and the actual target values in the training dataset. This process is often achieved using optimization techniques such as gradient descent or closed-form solutions.</p><p>Here’s a simplified overview of how these values are learned:</p><ol><li>Initialization: Initially, the values of b0 and b1 are typically set to some initial values, often chosen randomly or set to zero.</li><li>Prediction: The model uses these initial values to make predictions on the training data. For a simple linear regression model, the prediction for each data point would be y_predicted = b0 + b1 * x, where x is the feature and y_predicted is the predicted target value.</li><li>Loss Function: To measure how well the model is performing, a loss function (also known as a cost function) is used. The loss function quantifies the difference between the predicted values and the actual target values. Common loss functions for regression problems include mean squared error (MSE) and mean absolute error (MAE).</li><li>Gradient Descent (Optimization): The objective is to minimize the loss function. Gradient descent is a commonly used optimization algorithm for this purpose. It iteratively updates the values of b0 and b1 by moving them in a direction that reduces the loss. The direction and step size of these updates are determined by the gradients of the loss function with respect to b0 and b1.</li><li>Iterative Process: The optimization process continues iteratively, updating b0 and b1 until the loss converges to a minimum or reaches a predefined stopping criterion (e.g., a maximum number of iterations).</li><li>Learned Coefficients and Intercept: At the end of the training process, the values of b0 and b1 are the learned coefficients that best fit the training data according to the chosen loss function. These coefficients define the linear relationship between the features and the target variable as learned by the model.</li></ol><p>The key idea is that the model learns the values of b0 and b1 that minimize the error between its predictions and the actual target values in the training data. Once these values are learned, you can use the trained model to make predictions on new, unseen data. This process of learning coefficients is fundamental to supervised machine learning, and it allows the model to generalize its predictions to new, unseen examples.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bde5ee7cf2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the coefficient and intercept in Machine Learning and why do we use this concept in ML ?]]></title>
            <link>https://medium.com/@umme7072/what-is-the-coefficient-and-intercept-in-machine-learning-and-why-do-we-use-this-concept-in-ml-c1e5a4c7c36d?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1e5a4c7c36d</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 16:20:27 GMT</pubDate>
            <atom:updated>2023-09-23T16:20:27.312Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is the coefficient and intercept in Machine Learning and why do we use this concept in ML?</h3><p>In machine learning, coefficients and intercepts are terms commonly associated with linear models. Linear models are a class of algorithms used for various tasks, including regression and classification. Let’s explore what coefficients and intercepts mean in the context of machine learning:</p><p>1. Coefficients (Weights):</p><ul><li>In a linear model, coefficients are numerical values assigned to each feature (input variable) that the model uses to make predictions. These coefficients represent the “weight” or “importance” of each feature in the prediction.</li><li>The coefficients determine the slope or direction of the relationship between each feature and the target variable.</li><li>For example, in a simple linear regression model with one feature (univariate), the model equation might be: y = b0 + b1 * x, where b0 is the intercept and b1 is the coefficient of the feature x.</li></ul><p>2. Intercept (Bias or Constant):</p><ul><li>The intercept, often denoted as b0 or sometimes referred to as the bias or constant, is a constant term in the linear model equation that accounts for the value of the target variable when all the features are set to zero.</li><li>The intercept provides an offset or baseline prediction that the model starts with, even when all input features are zero. It allows the model to capture patterns that are not necessarily related to the input features.</li><li>For instance, in linear regression, the intercept represents the predicted target value when all predictor variables have values of zero. It helps the model capture the baseline trend or offset.</li></ul><p>Here’s an example to illustrate the concept:</p><p>Let’s say you’re building a linear regression model to predict house prices based on square footage (sqft) as the only feature. The model equation might look like this</p><pre>Price = b0 + b1 * sqft</pre><ul><li>b0 represents the intercept, which is the predicted house price when sqft is zero. In the real world, this might not make sense (houses usually have nonzero square footage), but the intercept is essential to account for baseline prices.</li><li>b1 is the coefficient of sqft, indicating how much the predicted price changes for each additional square foot of living space.</li></ul><p>In summary, coefficients and intercepts are crucial components of linear models in machine learning. They help determine the relationship between features and the target variable, allowing the model to make predictions based on weighted combinations of the input features. The coefficients indicate the feature importance, while the intercept accounts for the baseline prediction when all features are zero.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1e5a4c7c36d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction]]></title>
            <link>https://medium.com/@umme7072/introduction-987b2a432cac?source=rss-39c6ab4d526c------2</link>
            <guid isPermaLink="false">https://medium.com/p/987b2a432cac</guid>
            <dc:creator><![CDATA[UMME HABIBA TANNY]]></dc:creator>
            <pubDate>Sun, 16 Jul 2023 17:32:56 GMT</pubDate>
            <atom:updated>2023-07-16T17:32:56.209Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>K nearest neighbour (KNN)</strong> is one of the most widely used and simplest algorithms for classification problems under supervised Machine Learning.</p><p>Therefore it becomes necessary for every aspiring <strong>Data Scientist</strong> and <strong>Machine Learning Engineer </strong>to have a good knowledge of this algorithm.</p><p>In this article, we will discuss the most important questions on the <strong>K Nearest Neighbor (KNN) </strong>Algorithm which is helpful to get you a clear understanding of the algorithm, and also for <strong>Data Science Interviews</strong>, which covers its very fundamental level to complex concepts.</p><h3>Let’s get started,</h3><h3>1. What is the KNN Algorithm?</h3><p><strong>KNN(K-nearest neighbours)</strong> is a <strong>supervised </strong>learning and <strong>non-parametric</strong> algorithm that can be used to solve both classification and regression problem statements.</p><p>It uses data in which there is a target column present <strong>i.e, labelled data</strong> to model a function to produce an output for the unseen data. It uses the euclidean distance formula to compute the distance between the data points for classification or prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*HT_ClEbc7o_XAoLG.png" /></figure><p>The main objective of this algorithm is that similar data points must be close to each other so it uses the distance to calculate the similar points that are close to each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/0*J9WJwe8dFSONSfv5.png" /></figure><p><strong>Image Source: Google Images</strong></p><h3>2. Why is KNN a non-parametric Algorithm?</h3><p>The term “<strong>non-parametric”</strong> refers to not making any assumptions on the underlying data distribution. These methods do not have any fixed numbers of parameters in the model.</p><p>Similarly in KNN, the model parameters grow with the training data by considering each training case as a parameter of the model. So, KNN is a non-parametric algorithm.</p><h3>3. What is “K” in the KNN Algorithm?</h3><p>K represents the number of nearest neighbours you want to select to predict the class of a given item, which is coming as an unseen dataset for the model.</p><h3>4. Why is the odd value of “K” preferred over even values in the KNN Algorithm?</h3><p>The odd value of K should be preferred over even values in order to ensure that there are no ties in the voting. If the square root of a number of data points is even, then add or subtract 1 to it to make it odd.</p><h3>5. How does the KNN algorithm make the predictions on the unseen dataset?</h3><p>The following operations have happened during each iteration of the algorithm. For each of the unseen or test data point, the kNN classifier must:</p><p><strong>Step-1:</strong> Calculate the distances of test point to all points in the training set and store them</p><p><strong>Step-2:</strong> Sort the calculated distances in increasing order</p><p><strong>Step-3:</strong> Store the K nearest points from our training dataset</p><p><strong>Step-4: </strong>Calculate the proportions of each class</p><p><strong>Step-5: </strong>Assign the class with the highest proportion</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*jEZZi_ZNeLDoZgO5.png" /></figure><p>Become a Full Stack Data Scientist</p><p>Transform into an expert and significantly impact the world of data science.</p><p><a href="https://blackbelt.analyticsvidhya.com/plus?utm_source=blog_india&amp;utm_medium=banner_between_articles&amp;utm_campaign=24-Mar-2023&amp;utm_content=brochure">Download Brochure</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GVlr1wC76mMozWcj.jpg" /></figure><p><strong>Image Source: Google Images</strong></p><h3>6. Is Feature Scaling required for the KNN Algorithm? Explain with proper justification.</h3><p>Yes, feature scaling is required to get the better performance of the KNN algorithm.</p><p><strong>For Example,</strong> Imagine a dataset having n number of instances and N number of features. There is one feature having values ranging between <strong>0 and 1</strong>. Meanwhile, there is also a feature that varies from <strong>-999 to 999</strong>. When these values are substituted in the formula of Euclidean Distance, this will affect the performance by giving higher weightage to variables having a higher magnitude.</p><h3>7. What is space and time complexity of the KNN Algorithm?</h3><p><strong>Time complexity:</strong></p><p>The distance calculation step requires quadratic time complexity, and the sorting of the calculated distances requires an <strong>O(N log N)</strong> time. Together, we can say that the process is an <strong>O(N3 log N) </strong>process, which is a monstrously long process.</p><p><strong>Space complexity:</strong></p><p>Since it stores all the pairwise distances and is sorted in memory on a machine, memory is also the problem. Usually, local machines will crash, if we have very large datasets.</p><h3>8. Can the KNN algorithm be used for regression problem statements?</h3><p><strong>Yes</strong>, KNN can be used for regression problem statements.</p><p>In other words, the KNN algorithm can be applied when the dependent variable is continuous. For regression problem statements, the predicted value is given by the average of the values of its k nearest neighbours.</p><h3>9. Why is the KNN Algorithm known as Lazy Learner?</h3><p>When the KNN algorithm gets the training data, it does not learn and make a model, it just stores the data. Instead of finding any discriminative function with the help of the training data, it follows <strong>instance-based learning</strong> and also uses the training data when it actually needs to do some prediction on the unseen datasets.</p><p>As a result, KNN does not immediately learn a model rather delays the learning thereby being referred to as Lazy Learner.</p><h3>10. Why is it recommended not to use the KNN Algorithm for large datasets?</h3><p><strong>The Problem in processing the data:</strong></p><p>KNN works well with smaller datasets because it is a lazy learner. It needs to store all the data and then make a decision only at run time. It includes the computation of distances for a given point with all other points. So if the dataset is large, there will be a lot of processing which may adversely impact the performance of the algorithm.</p><p><strong>Sensitive to noise:</strong></p><p>Another thing in the context of large datasets is that there is more likely a chance of noise in the dataset which adversely affects the performance of the KNN algorithm since the KNN algorithm is sensitive to the noise present in the dataset.</p><h3>11. How to handle categorical variables in the KNN Algorithm?</h3><p>To handle the categorical variables we have to create <strong>dummy variables</strong> out of a categorical variable and include them instead of the original categorical variable. Unlike regression, create k dummies instead of (k-1).</p><p><strong>For example,</strong> a categorical variable named <strong>“Degree”</strong> has 5 unique levels or categories. So we will create 5 dummy variables. Each dummy variable has 1 against its degree and else 0.</p><h3>12. How to choose the optimal value of K in the KNN Algorithm?</h3><p>There is no straightforward method to find the optimal value of K in the KNN algorithm.</p><p>You have to play around with different values to choose which value of K should be optimal for my problem statement. Choosing the right value of K is done through a process known as <strong>Hyperparameter Tuning</strong>.</p><p>The optimum value of K for KNN is<strong> highly dependent on the data</strong> itself. In different scenarios, the optimum K may vary. It is more or less a hit and trial method.</p><p>There is no one proper method of finding the K value in the KNN algorithm. No method is the rule of thumb but you should try the following suggestions:</p><p><strong>1. Square Root Method:</strong> Take the square root of the number of samples in the training dataset and assign it to the K value.</p><p><strong>2. Cross-Validation Method:</strong> We should also take the help of cross-validation to find out the optimal value of K in KNN. Start with the minimum value of k <strong>i.e, K=1</strong>, and run cross-validation, measure the accuracy, and keep repeating till the results become consistent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*krjhOyszw2RJLskE.png" /></figure><p>Become a Full Stack Data Scientist</p><p>Transform into an expert and significantly impact the world of data science.</p><p><a href="https://blackbelt.analyticsvidhya.com/plus?utm_source=blog_india&amp;utm_medium=banner_between_articles&amp;utm_campaign=24-Mar-2023&amp;utm_content=brochure">Download Brochure</a></p><p>As the value of K increases, the error usually goes down after each one-step increase in K, then stabilizes, and then raises again. Finally, pick the optimum K at the beginning of the stable zone. This technique is also known as the <strong>Elbow Method.</strong></p><p><strong>Image Source: Google Images</strong></p><p><strong>3. Domain Knowledge:</strong> Sometimes with the help of domain knowledge for a particular use case we are able to find the optimum value of K (K should be an odd number).</p><p>I would therefore suggest trying a mix of all the above points to reach any conclusion.</p><h3>13. How can you relate KNN Algorithm to the Bias-Variance tradeoff?</h3><p><strong>Problem with having too small K:</strong></p><p>The major concern associated with small values of K lies behind the fact that the smaller value causes noise to have a higher influence on the result which will also lead to a large variance in the predictions.</p><p><strong>Problem with having too large K:</strong></p><p>The larger the value of K, the higher is the accuracy. If K is too large, then our model is under-fitted. As a result, the error will go up again. So, to prevent your model from under-fitting it should retain the generalization capabilities otherwise there are fair chances that your model may perform well in the training data but drastically fail in the real data. The computational expense of the algorithm also increases if we choose the k very large.</p><p>So, choosing k to a large value may lead to a model with a large bias(error).</p><p><strong>The effects of k values on the bias and variance is explained below :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*bKGgcZ9D7NSfAqke.png" /></figure><p>Become a Full Stack Data Scientist</p><p>Transform into an expert and significantly impact the world of data science.</p><p><a href="https://blackbelt.analyticsvidhya.com/plus?utm_source=blog_india&amp;utm_medium=banner_between_articles&amp;utm_campaign=24-Mar-2023&amp;utm_content=brochure">Download Brochure</a></p><ul><li>As the value of k increases, the bias will be increases</li><li>As the value of k decreases, the variance will increases</li><li>With the increasing value of K, the boundary becomes smoother</li></ul><p>So, there is a tradeoff between <strong>overfitting and underfitting</strong> and you have to maintain a balance while choosing the value of K in KNN. Therefore,<strong> K should not be too small or too large</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*99PdsDhdB62z2gLy.png" /></figure><p><strong>Image Source: Google Images</strong></p><h3>14. Which algorithm can be used for value imputation in both categorical and continuous categories of data?</h3><p>KNN is the only algorithm that can be used for the imputation of both categorical and continuous variables. It can be used as one of many techniques when it comes to handling missing values.</p><p>To impute a new sample, we determine the samples in the training set “nearest” to the new sample and averages the nearby points to impute. A <strong>Scikit learn library of Python</strong> provides a quick and convenient way to use this technique.</p><p><strong>Note:</strong> NaNs are omitted while distances are calculated. Hence we replace the missing values with the average value of the neighbours. The missing values will then be replaced by the average value of their “neighbours”.</p><p><strong>15. Explain the statement- “The KNN algorithm does more computation on test time rather than train time”.</strong></p><p>The above-given statement is <strong>absolutely true</strong>.</p><p>The basic idea behind the kNN algorithm is to determine a k-long list of samples that are close to a sample that we want to classify. Therefore, the training phase is basically storing a training set, whereas during the prediction stage the algorithm looks for k-neighbours using that stored data. Moreover, KNN does not learn anything from the training dataset as well.</p><h3>16. What are the things which should be kept in our mind while choosing the value of k in the KNN Algorithm?</h3><p>If K is small, then results might not be reliable because the noise will have a higher influence on the result. If K is large, then there will be a lot of processing to be done which may adversely impact the performance of the algorithm.</p><p><strong>So, the following things must be considered while choosing the value of K:</strong></p><ul><li>K should be the square root of n (number of data points in the training dataset).</li><li>K should be chosen as the odd so that there are no ties. If the square root is even, then add or subtract 1 to it.</li></ul><h3>17. What are the advantages of the KNN Algorithm?</h3><p>Some of the advantages of the KNN algorithm are as follows:</p><p><strong>1. No Training Period:</strong> It does not learn anything during the training period since it does not find any discriminative function with the help of the training data. In simple words, actually, there is no training period for the KNN algorithm. It stores the training dataset and learns from it only when we use the algorithm for making the real-time predictions on the test dataset.</p><p>As a result, the KNN algorithm is much faster than other algorithms which require training. <strong>For Example</strong>, SupportVector Machines(SVMs), Linear Regression, etc.</p><p>Moreover, since the KNN algorithm does not require any training before making predictions as a result new data can be added seamlessly without impacting the accuracy of the algorithm.</p><p><strong>2. Easy to implement and understand:</strong> To implement the KNN algorithm, we need only two parameters i.e. the value of K and the distance metric(e.g. <strong>Euclidean or Manhattan</strong>, etc.). Since both the parameters are easily interpretable therefore they are easy to understand.</p><h3>18. What are the disadvantages of the KNN Algorithm?</h3><p>Some of the disadvantages of the KNN algorithm are as follows:</p><p><strong>1. Does not work well with large datasets:</strong> In large datasets, the cost of calculating the distance between the new point and each existing point is huge which decreases the performance of the algorithm.</p><p><strong>2. Does not work well with high dimensions:</strong> KNN algorithms generally do not work well with high dimensional data since, with the increasing number of dimensions, it becomes difficult to calculate the distance for each dimension.</p><p><strong>3. Need feature scaling:</strong> We need to do feature scaling (standardization and normalization) on the dataset before feeding it to the KNN algorithm otherwise it may generate wrong predictions.</p><p><strong>4. Sensitive to Noise and Outliers:</strong> KNN is highly sensitive to the noise present in the dataset and requires manual imputation of the missing values along with outliers removal.</p><h3>19. Is it possible to use the KNN algorithm for Image processing?</h3><p>Yes, KNN can be used for image processing by converting a 3-dimensional image into a single-dimensional vector and then using it as the input to the KNN algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*1kOnFeW7d8O3leaj" /></figure><h3>20. What are the real-life applications of KNN Algorithms?</h3><p>The various real-life applications of the KNN Algorithm includes:</p><p><strong>1. </strong>KNN allows the calculation of the <strong>credit rating</strong>. By collecting the financial characteristics vs. comparing people having similar financial features to a database we can calculate the same. Moreover, the very nature of a credit rating where people who have similar financial details would be given similar credit ratings also plays an important role. Hence the existing database can then be used to predict a new customer’s credit rating, without having to perform all the calculations.</p><p><strong>2. In political science: </strong>KNN can also be used to predict whether a potential voter “will vote” or “will not vote”, or to “vote Democrat” or “vote Republican” in an election.</p><p>Apart from the above-mentioned use cases, KNN algorithms are also used for <strong>handwriting detection (like OCR)</strong>, <strong>Image recognition</strong>, and <strong>video recognition</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=987b2a432cac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>