<?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 Manasa Somanchi on Medium]]></title>
        <description><![CDATA[Stories by Manasa Somanchi on Medium]]></description>
        <link>https://medium.com/@ManasaSomanchi?source=rss-3deeb064f436------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iCj4-2CzzsZy-LbGr1MV-g.jpeg</url>
            <title>Stories by Manasa Somanchi on Medium</title>
            <link>https://medium.com/@ManasaSomanchi?source=rss-3deeb064f436------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 17 May 2026 03:11:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ManasaSomanchi/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[Understanding Vectors from a Machine Learning Perspective]]></title>
            <link>https://medium.com/@ManasaSomanchi/understanding-vectors-from-a-machine-learning-perspective-fa28f41f5245?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa28f41f5245</guid>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Fri, 16 Feb 2024 13:26:34 GMT</pubDate>
            <atom:updated>2024-02-16T13:26:34.481Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Vector:</strong></p><p>· Mathematically, vectors encode length and direction.</p><p>· Theoretically, they represent a position or even a change in some mathematical framework or space.</p><p>· Vectors are used in machine learning as they form the most convenient way to organize data.</p><p>· We use vectors as inputs, the main use is their ability encode information in a format that our model can process, and then output something useful to our end goal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*7GfZl0-L3_412EbUv1b8lA.png" /><figcaption>Vectors as input and output</figcaption></figure><p>Examples where we use to represent input as vectors in</p><p>Machine learning:</p><p>1. Predict House prices</p><p>2. Create Bowie-esque lyrics</p><p>3. Sentence encoder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*1Q52n8lec0le37aIbK-U9g.png" /><figcaption>3-D Vectors</figcaption></figure><p><strong>Vector Operations:</strong></p><p>Addition:</p><p>We add two vectors together to create a third vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*_5K7aRlkGpF-nPu0CrZ-oQ.png" /><figcaption>Vector Addition</figcaption></figure><p>Vector addition plays a crucial role in various aspects of machine learning. Here are some applications:</p><ol><li>Feature Engineering: In machine learning, datasets are often represented as vectors where each feature is a dimension. Feature engineering involves adding, subtracting, or combining features to create new meaningful features. Vector addition can be used to combine features or create interaction terms, which can enhance the predictive power of a model.</li></ol><p>2. Word Embeddings: In natural language processing (NLP), words are often represented as vectors in high-dimensional space known as word embeddings. Vector addition can be used to perform operations such as word analogy (e.g., king — man + woman = queen) or sentiment analysis by combining word embeddings of individual words to represent sentences or documents.</p><p>3. Neural Networks: Neural networks, especially in deep learning, utilize vector addition extensively. In feedforward neural networks, weights are represented as vectors, and during the forward pass, vector addition is performed to compute the activations of each neuron. In recurrent neural networks (RNNs) and transformers, vector addition is used for combining information from different time steps or attention heads.</p><p>4. Gradient Descent: In optimization algorithms like gradient descent, vectors representing gradients are added to update model parameters iteratively. This process helps in minimizing the loss function and finding the optimal set of parameters for the model.</p><p>5. Ensemble Methods: Ensemble methods combine multiple base models to create a more robust and accurate model. Techniques like bagging and boosting involve combining predictions from individual models through operations like averaging or weighted averaging, which essentially involve vector addition.</p><p>6. Data Augmentation: Data augmentation techniques are used to artificially increase the size of the training dataset by applying transformations such as rotation, translation, or scaling to the input data. These transformations can be represented as vectors, and vector addition is used to apply these transformations to the original data.</p><p>7. Reinforcement Learning: In reinforcement learning, vectors are often used to represent states, actions, and rewards. Vector addition can be used to update the state representation based on the current state and action taken, or to combine multiple reward signals.</p><p>In summary, vector addition is a fundamental operation in machine learning and is used in various stages of the learning process, including data representation, feature engineering, optimization, and model combination.</p><p>Multiplication:</p><p>By scalar multiplication we change the magnitude of the vector.</p><p><strong>Dot product</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*bgI81Pv0jZ1p66d8D7y_nw.png" /><figcaption>Scalar — Dot Product</figcaption></figure><p><strong>Cross Product</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*LSYRF8gAOoqasalyttL8Dw.png" /><figcaption>Vector — Cross Product</figcaption></figure><p>Vector multiplication is also extensively utilized in various applications within machine learning. Here are some key areas where vector multiplication plays a crucial role:</p><ol><li>Matrix Operations in Neural Networks: Neural networks involve a significant amount of matrix operations, which inherently involve vector multiplication. Operations like matrix multiplication are used to compute the activations of neurons in different layers of a neural network during the forward pass. Additionally, during backpropagation, gradients are computed through matrix operations involving vector multiplication, such as matrix-vector products.</li></ol><p>2. Kernel Methods: Kernel methods, such as Support Vector Machines (SVMs) and kernelized versions of algorithms like principal component analysis (PCA) and ridge regression, rely on vector multiplication through the use of kernel functions. These functions implicitly map input data into high-dimensional feature spaces, where vector multiplication captures complex relationships between data points.</p><p>3. Graph-based Learning: In graph-based learning tasks such as graph neural networks (GNNs), vector multiplication is used to aggregate information from neighboring nodes in a graph. Techniques like message passing involve multiplying node features with adjacency matrices or learned weight matrices to update node representations.</p><p>4. Dimensionality Reduction: Techniques like Singular Value Decomposition (SVD) and Non-negative Matrix Factorization (NMF) utilize vector multiplication to decompose high-dimensional data matrices into lower-dimensional representations. These methods aim to capture the most important features of the data by multiplying the original data matrix with transformation matrices.</p><p>5. Recommender Systems: In collaborative filtering-based recommender systems, matrix factorization methods like Alternating Least Squares (ALS) and Singular Value Decomposition (SVD) are used to factorize the user-item interaction matrix into low-rank matrices. Vector multiplication is employed in these factorization processes to approximate the original matrix and generate recommendations.</p><p>6. Attention Mechanisms: Attention mechanisms, commonly used in sequence-to-sequence models like transformers, rely on vector multiplication to compute attention scores between different parts of input sequences. These attention scores are then used to weight the importance of different elements in the sequences during processing.</p><p>7. Graph Embeddings: Vector multiplication is used in graph embedding techniques such as node2vec and DeepWalk, where random walks are performed on graphs to generate sequences of nodes. These sequences are then used to learn embeddings for nodes by utilizing techniques like skip-gram models, which involve vector multiplication to train embeddings.</p><p>These are just a few examples of how vector multiplication is applied in machine learning. Overall, vector multiplication is a fundamental operation that enables various complex computations and transformations essential for many machine learning algorithms and models.</p><p>L1 Norm:</p><p>The L1 norm, also known as the Manhattan norm or taxicab norm, is a way of measuring the size of a vector in a space. It is defined as the sum of the absolute values of the components of the vector.</p><p>Mathematically, for a vector <strong>X</strong> with <strong><em>n</em></strong> components, the L1 norm (denoted as ||X||1​) is calculated as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/197/1*f92XIV1CKTZUdHQOmAFPtw.png" /><figcaption>L1 — Norm</figcaption></figure><p>Geometrically, the L1 norm represents the distance between the origin (0,0) and the point defined by the vector components in an <strong><em>n</em></strong>-dimensional space, measured along the axes, as if moving along the grid of a city street. Hence, it’s termed the Manhattan norm because it’s akin to the distance a taxi would travel along the streets of Manhattan from one point to another.</p><p>The L1 norm is often used in machine learning for various purposes, including:</p><ol><li>Sparse Solutions: The L1 norm tends to produce sparse solutions when used as a regularization term in optimization problems. This property is exploited in techniques like Lasso regression, where the L1 regularization term encourages sparsity by penalizing the absolute values of the coefficients.</li><li>Feature Selection: In feature selection tasks, the L1 norm can be used to rank features based on their importance. Features with higher L1 norm values are considered more important as they contribute more to the overall magnitude of the vector.</li><li>Robustness to Outliers: The L1 norm is more robust to outliers compared to the L2 norm (Euclidean norm). This robustness makes it suitable for applications where the data may contain outliers or noise.</li><li>Distance Metric: The L1 norm can be used as a distance metric in clustering algorithms such as k-means. When calculating distances between data points, using the L1 norm results in a different notion of similarity compared to the more commonly used Euclidean distance.</li></ol><p>Overall, the L1 norm is a useful mathematical tool in machine learning, offering distinct properties and applications compared to other norms like the L2 norm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*g41p8F0UF0SO3vQ2AwhOcQ.png" /><figcaption>L1 — Norm</figcaption></figure><p>L2 Norm:</p><p>The L2 norm, also known as the Euclidean norm or the Euclidean distance, is a way of measuring the size of a vector in a space. It is defined as the square root of the sum of the squares of the components of the vector.</p><p>Mathematically, for a vector <strong>X</strong> with <strong><em>n</em></strong> components, the L2 norm (denoted as ∣∣<strong>X</strong>∣∣2​) is calculated as:</p><p>square root of the sum of the squared values of the vector, also known as Euclidean distance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*zWPTb57lGuc4388xxWQBfw.png" /><figcaption>L — 2 Norm</figcaption></figure><p>Geometrically, the L2 norm represents the distance between the origin (0,0) and the point defined by the vector components in an �<em>n</em>-dimensional space, measured along a straight line. It’s termed the Euclidean norm because it corresponds to the usual distance metric in Euclidean space.</p><p>The L2 norm is widely used in various applications in machine learning, including:</p><ol><li>Least Squares Optimization: In regression problems, the L2 norm is commonly used as a regularization term in the form of Ridge regression. This regularization term penalizes the sum of the squares of the coefficients, helping to prevent overfitting and promote smoother solutions.</li><li>Neural Networks: The L2 norm is often used as a regularization technique in neural networks, known as weight decay. By adding a term proportional to the L2 norm of the weights to the loss function, the model’s weights are encouraged to stay small, preventing overfitting and improving generalization.</li><li>Distance Metric: The L2 norm is frequently used as a distance metric in clustering algorithms such as k-means. When calculating distances between data points, using the L2 norm results in a notion of similarity based on the straight-line distance between points in the feature space</li><li>PCA (Principal Component Analysis): In PCA, the L2 norm is used to calculate the variance of data along principal components. The principal components are chosen to maximize the variance of the data, which is calculated using the L2 norm.</li><li>Error Metrics: In various machine learning tasks, such as regression or classification, the L2 norm is used as an error metric to quantify the difference between predicted and actual values. This error, often referred to as the mean squared error (MSE) or the root mean squared error (RMSE), is minimized during model training.</li></ol><p>Overall, the L2 norm is a fundamental concept in machine learning, widely used for regularization, distance measurement, error calculation, and variance analysis, among other applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*RE0miZgsF0R3XHRFK_yTmQ.png" /><figcaption>L2 — Norm</figcaption></figure><p>Inner Product:</p><p>Geometrically, it is the product of the magnitude of the two vectors and the cosine of the angle between them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*see9K66h5z3uOdyXCZSWzw.png" /><figcaption>Inner Product</figcaption></figure><p>One brief application of the inner product, also known as the dot product, is in computing the similarity between two vectors in machine learning and data analysis.</p><p>Given two vectors <strong>x</strong> and <strong>y</strong>, the inner product is calculated as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*zEuQsg39QCVSegSiD6EOnw.png" /><figcaption>Inner Product</figcaption></figure><p>Cosine:</p><p>To know how close two vectors are we use cosine angle. The cosine angle between 2 vectors is same even if the size differs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*pGaWTuX5iaIYp5WzzvUZlg.png" /><figcaption>Cosine</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*Ig-yofXOpSRklD6HC_qpug.png" /></figure><p>The cosine similarity is a measure of similarity between two vectors in an inner product space, commonly used in machine learning, natural language processing, and information retrieval. It measures the cosine of the angle between the two vectors and ranges from -1 to 1.</p><p>For two vectors <strong>a</strong> and <strong>b</strong>, the cosine similarity is calculated as:</p><p><strong>Projections:</strong></p><p><strong>Projection of V into the direction of U</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*iFJ3trpufUd440wYG4wZ5w.png" /><figcaption>Projection Vector of V into the direction of U</figcaption></figure><p><strong>Component of V into the direction of U</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*fjJq6ZhZUePL_tk4e201zg.png" /><figcaption>Component Vector of V into the direction of U</figcaption></figure><p>This operation essentially calculates the projection of one vector onto another, measuring the similarity or alignment between them. Here’s a brief application scenario:</p><p>Document Similarity: In natural language processing (NLP), documents are often represented as vectors of word frequencies or embeddings. To measure the similarity between two documents, their vector representations can be compared using the inner product. If the documents have similar content, their vectors will be aligned in the vector space, resulting in a higher inner product value. This similarity measurement can be used in tasks such as document retrieval, clustering, or recommendation systems.</p><p>For instance, in information retrieval, given a query vector representing the user’s query and a set of document vectors representing the corpus, documents with higher inner product values with the query vector are considered more relevant to the query. This approach is often used in search engines to rank search results based on their similarity to the user’s query.</p><p>Projection is very useful concept and often applied in one of the famous dimensionality reduction technique known as PCA (Principal Component Analysis).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*70YcNBs7ytL-OxhkhUQ1Tg.png" /><figcaption>Projection Vector</figcaption></figure><p>Principal Component Analysis (PCA) is a dimensionality reduction technique commonly used in machine learning and data analysis to identify patterns in high-dimensional data and reduce its dimensionality while preserving most of its variance. Projections play a key role in PCA.</p><p>Here’s a brief application scenario of projections in PCA:</p><p>Image Compression: Consider a dataset consisting of images represented as high-dimensional arrays of pixel values. Each image can be viewed as a point in a high-dimensional space, with each dimension corresponding to a pixel. However, high-dimensional data can be computationally expensive to process and store.</p><p>PCA can be applied to this dataset to identify the principal components that capture the most variation in the images. These principal components form a set of orthogonal vectors in the high-dimensional space. By projecting the original images onto a lower-dimensional subspace spanned by these principal components, we can represent each image using a reduced set of features.</p><p>In the context of image compression, PCA can be used to reduce the dimensionality of the image data while preserving most of the information. The projected images, represented using a smaller number of principal components, can be stored more efficiently and transmitted more quickly. Despite the reduction in dimensionality, the projected images retain much of their visual quality, making PCA a valuable tool for image compression in applications such as digital photography, video streaming, and image processing.</p><p>That’s all folks…</p><p>see you again in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa28f41f5245" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Singular Value Decomposition]]></title>
            <link>https://medium.com/@ManasaSomanchi/singular-value-decomposition-291c7a686de7?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/291c7a686de7</guid>
            <category><![CDATA[svd]]></category>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 10:53:52 GMT</pubDate>
            <atom:updated>2024-01-02T10:53:52.643Z</atom:updated>
            <content:encoded><![CDATA[<p>In a nut shell…</p><p>To extract the important part of the matrix to make the computations easy, we make use of Singular Value Decomposition.</p><p>· It is a matrix factorization technique</p><p>· Can be applicable for matrix of any order.</p><p>· Should have the properties of Symmetric Matrix with respect to Eigen values and Eigen vectors.</p><p>· Overcomes the drawbacks of Eigen Decomposition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*QJw-gsinotH67ZR9nViFOQ.png" /></figure><p>Application in Data Compression:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*fNW-fLcAM7b4oiNFZyHMyg.png" /></figure><p>We see that about thirty or fifty components, adding more singular</p><p>values don’t seem to improve visually in quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*hrYDHqbN7Vx9keQ8-9mvzw.png" /></figure><p>But, by the application of SVD the Image is compressed from</p><p>500 X 800 pixel image into matrix 50 X 500 matrix (for U), 50 singular</p><p>values 800 X 50 matrix (for V).</p><p>The math behind SVD will be posted soon…</p><p>Please feel free to comment also seeking claps that will serve as motivation to work on more…</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=291c7a686de7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Principal Component Analysis]]></title>
            <link>https://medium.com/@ManasaSomanchi/principal-component-analysis-146e94285836?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/146e94285836</guid>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 10:29:09 GMT</pubDate>
            <atom:updated>2024-01-02T10:29:09.211Z</atom:updated>
            <content:encoded><![CDATA[<p>Understanding in simple sense!</p><p><strong>PCA</strong> is a dimensionality reduction technique used in ML including Feature Engineering and Feature Extraction.</p><p>It is a statistical procedure that transforms data linearly into new properties that are not correlated with each other.</p><p>The goal of PCA is to find a set of orthonormal bases of vectors for a given data matrix, such that the variance of the dataset projected onto the direction determined by the vectors is maximized.</p><p><strong>Steps for PCA:</strong></p><p>1. Compute the covariance matrix of the data</p><p>2. Compute the eigen values and vectors of this covariance matrix</p><p>3. Use the eigen values and vectors to select only the most important feature vectors and then transform your data onto those vectors for reduced dimensionality!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*pDvkh8U1FuiDrq7760KM2g.png" /><figcaption>Information preserved by F2 &gt;&gt; information preserved by F1</figcaption></figure><p>We can drop F1 and convert from 2D to 1D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*bODl5OMdMNZvQqj2B63itg.png" /><figcaption>Information preserved by F2 = information preserved by F1</figcaption></figure><p>Here, we can’t reduce the dimension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*-pl1heyodfiQWAz1lxUuQA.png" /></figure><p>PCA performs linear orthogonal transformation on the data to find features F1’ and F2’ such that the variance on F1’ &gt;&gt; variance on F2’</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=146e94285836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ML Decision Boundary with Python Code]]></title>
            <link>https://medium.com/@ManasaSomanchi/ml-decision-boundary-with-python-code-13d1eae461d4?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/13d1eae461d4</guid>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 08:08:28 GMT</pubDate>
            <atom:updated>2023-12-20T08:08:28.861Z</atom:updated>
            <content:encoded><![CDATA[<p>Decision boundary and plots — Part B</p><p>Bayes with joint, nonparametric (kernel density estimated) distributions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*UOLaoj7nKhAfCzUmdkVp8A.png" /><figcaption>Bayes Decision making with no normality assumption — (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*rkF24SVJzDHDUI33b1TDSA.png" /><figcaption>Bayes Decision making with no normality assumption — (b)</figcaption></figure><p>NN — Neural Networks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*3EHBmMVhJCwUTwm7dYPhBQ.png" /><figcaption>NN as the decision boundary (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*el6dK8oyyAkxUFWQLc7Yng.png" /><figcaption>NN as the decision boundary (b)</figcaption></figure><p>NN — Neural Networks with 2 Hidden Layers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*SdowiGbcfNR_ih9SoLLKqg.png" /><figcaption>NN with 2 Hidden Layers (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*-LfXcxEv6TkXB_QPPG_xnw.png" /><figcaption>NN with 2 Hidden Layers (b)</figcaption></figure><p>Moreover, the research scope can be expanded by exploring various activation functions. Additionally, the problem can be extended to accommodate more than two categories. While the same algorithms may not be directly applicable, clustering methods and neural networks offer potential solutions for classifying data across multiple categories.</p><p>And the research begins.. see you in the next article!</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13d1eae461d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ML Decision Boundary with Python Code]]></title>
            <link>https://medium.com/@ManasaSomanchi/ml-decision-boundary-with-python-code-bc6059d40f3e?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc6059d40f3e</guid>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 07:42:45 GMT</pubDate>
            <atom:updated>2023-12-20T07:54:15.046Z</atom:updated>
            <content:encoded><![CDATA[<p>Decision boundary and plots — Part A</p><p>In any organization, the main business problem is to conclude using the power of Data Science. Most of the algorithms depend on outputs such as probability (0 to 1), not a categorical classification but a ‘Decision Boundary’</p><p>While training a classifier on a dataset, using a specific classification algorithm, it is required to define a set of hyperplanes called Decision Boundary. Decision boundaries are not confined to just the data points provided; they span through the entire feature space you trained on. Here are some illustrations of different problems and how different algorithms work in the creation of decision boundaries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*dKXrZYYXt8_KslvrdMyeMQ.png" /></figure><p>All the Decision boundaries are explained using different kinds of problems through Python code</p><p>Generating a random scatter plot with distinct colors is instrumental in effectively illustrating the decision boundary algorithms applied to the provided dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*fLyjtCA6RgvythGZhlawIA.png" /><figcaption>Gihub — <a href="https://github.com/manasavamsi/ML-Decision-Tree/blob/main/Decision%20Boundary%20-%20Machine%20Learning.ipynb">https://github.com/manasavamsi/ML-Decision-Tree/blob/main/Decision%20Boundary%20-%20Machine%20Learning.ipynb</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*LyjCnTlJs5MBZ8-SdgI2Gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*3KzyV5F3d7EKQQGS21USmg.png" /><figcaption>Creating a problem</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*GbklLbdlFR7315TJ4VvsPw.png" /><figcaption>Problem- Scatter Plot</figcaption></figure><p>KNN — with k = 5</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*4KHiTNOFc_opfcxSKjCLkA.png" /><figcaption>KNN — Decision Boundary</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*DLe2Zj2HJkH7Z0bnldphpQ.png" /><figcaption>KNN — Decision Boundary with k =15</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*6QsfhGK5nenXXz8cNZHxlA.png" /></figure><p>Logistic Regression — Simple Linear</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*MNnSt7S9Ek1gbBpPbsj9KA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*46wPvZGsXkD9ASXjnev0JA.png" /><figcaption>Logistic Regression — Decision making</figcaption></figure><p>Logistic Regression — Polynomial</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*LEbnOl8clNZUIxhrmXZGAw.png" /><figcaption>Logisitic Regression — with basic polynomials</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*9t1SJSWL_nE4kVx-07IuQA.png" /></figure><p>Logistic Regression — with polynomials and interactions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*r4dcTIhHZEbPx4hhn-94ng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*fQYd9Km_62OhD9QTzxQDbw.png" /></figure><p>Logistic Regression — with polynomials, interactions, and regularisation applied</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*8hqxXS3sl9FW1CXtZGr1IA.png" /><figcaption>Logistic Regression — smaller alpha — weaker regularization (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*QSExMihX44mAq5WyYxwN2w.png" /><figcaption>Logistic Regression — smaller alpha — weaker regularization (b)</figcaption></figure><p>Tree Methods — Decision Tree</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*v9kKwVG0fyTkbPnBiPslaA.png" /><figcaption>Decision Tree — Decision Boundary (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*4172_ELBc4k03gPRouhQYw.png" /><figcaption>Decision Tree — Decision Boundary (b)</figcaption></figure><p>Tree Methods — Random Forest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*w4slEQgsnNROpqUD0lrE1A.png" /><figcaption>Random Forest Decision Boundary (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*iZZ58pUTnVW_osRNG__RUg.png" /><figcaption>Random Forest Decision Boundary — (b)</figcaption></figure><p>SVM — Support Vector Machine with 4th order polynomial</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*rjaHt8RvIJBda7sB13c74A.png" /><figcaption>SVM — 4th order</figcaption></figure><p>SVM — radial basis functions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*cPRglC6GFNtx7RTYpeI9BQ.png" /><figcaption>SVM — with radial basic function</figcaption></figure><p>Bayesian &amp; Probabilistic Methods</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*Wn6_ocEDr7xGZ7U8Zq7zPA.png" /><figcaption>Gaussian Naive Bayes — Bayesian &amp; Probabilistic methods</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*Uzu8CGj3m7-arRxc545P7g.png" /><figcaption>Gaussian Bayes, non-naive (joint distribution) (a)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*4bCNNEg-jlJxY3MS4AznYQ.png" /><figcaption>Gaussian Bayes, non-naive (joint distribution) (b)</figcaption></figure><p>Continuation in Part B</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc6059d40f3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Math Functions]]></title>
            <link>https://medium.com/@ManasaSomanchi/common-math-functions-4d2787ef3830?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d2787ef3830</guid>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Fri, 08 Dec 2023 08:46:47 GMT</pubDate>
            <atom:updated>2023-12-08T08:46:47.476Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Math for the day!</strong></p><p>This article gives a gist of the common functions used in Data Science while building a conceptual model for data beginning with finding the relationship between the dependent variables to that of the independent variables.</p><p><strong>What is a Function?</strong></p><p>A function is a rule that defines a relationship between independent variables to that of dependant variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/91/1*LWlSp3wtLqY5W8dKMYChZQ.png" /></figure><p>Mathematically, it is defined as a function f</p><p>is a relation from a set X to a set Y such that the domain of f is X and no two distinct ordered pairs in f have the same first element. Where X and Y are two non-empty sets.</p><p><strong>List of some functions:</strong></p><p>1. Linear Function</p><p>2. Square Function</p><p>3. Absolute Value Function</p><p>4. Logarithmic &amp; Exponential Function</p><p>5. Tangent Function</p><p>6. Sigmoid Function</p><p>7. Softmax Function</p><p>8. ReLU Function</p><p><strong>Linear Function:</strong></p><p>Imagine you’ve planned for a grand party on a yacht. The initial non-refundable deposit is $1500 plus a daily charge of $300.</p><p>Defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/1*mLf0N40HC4TpQznrtfR20w.png" /></figure><p>y - dependant variables that represent the final charges of the yacht</p><p>x - is the independent variable which represents, the number of days the yacht is hired for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*wG2VTgH98rzI1VdMcj4Dbw.png" /></figure><p><strong>Square Function:</strong></p><p>Imagine the entire path of a paper rocket projected upwards. This trajectory is plotted using the square function, which looks like an inverted parabola. The parabolic equation is :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*9mMilMi4VjGlf9S2RD-yDg.png" /></figure><p><strong>Absolute Value of a Function:</strong></p><p>A signed number whether it is positive or negative, specifies the direction. However, the absolute value of such numbers is still positive irrespective of the direction.</p><p>Defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*SbONCq7RYVIicZIS_gDPVA.png" /></figure><p>Example: Owing money to someone will be the same as someone owing money to you, as money is not considered negative.</p><p><strong>Exponential Function &amp; Logarithmic Function:</strong></p><p>The function whose derivative is itself is the exponential function. The inverse of the exponential function is the Logarithmic function.</p><p>The exponential function can be illustrated with the growth of the death rate due to COVID-19. It is exponentially increasing with that of the increase of virus spread. Whereas the logarithmic function can be illustrated with the survival rate based on the immunity. If the immunity is 0 the chances of survival are negative otherwise it is positive and stable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*knKPlOx6YiWWxhEiTBriRw.png" /></figure><p><strong>Tangent Function:</strong></p><p>The ratio of the sine function to that of the cosine function gives you the tan function. An interesting application is thatyou can find the height of any object by knowing the distance with which you are standing away from the object along with the angle you are looking up at the object.</p><p><strong>Sigmoid Function:</strong></p><p>Also named, is the Logic function. The function introduces a non-linear curve which helps in deciding on the values.</p><p>Defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/132/1*pjJOKn5K98_6fp4cdYPS6Q.png" /></figure><p>For example, based on the real data on the COVID patients this function is modelled in such a way that it predicts the chances of a new patient getting affected. It is also used in the classification model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*MbGOckVpxaamQlMW-KpnIA.png" /></figure><p><strong>Softmax Function:</strong></p><p>An activation function is used in deep learning that scales down the values into probabilities.</p><p>Defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/155/1*hh0KkiYu8QgWURt0C6gnkg.png" /></figure><p>x - input vector consisting of classes.</p><p>s(x)i -is the ratio of the exponent of the input value to that of the sum of all the input values which will be in the range 0 and 1.</p><p>For example, in the CNN model for image classification, the activation function results in the form of probabilities. These probabilities make predictions classifying the input image to its respective class which will range from 0 to 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*OfvsntmmD5CPjknZzG2NvQ.png" /></figure><p><strong>ReLU Function:</strong></p><p>It is also another activation function that gives the output either as a positive value or 0. Majorly used to function in NN. It’s advatageous because it overcomes the vanishing or exploding gradient problem where the sigmoid and tanh functions fail.</p><p>It is defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*m-9lk_DGPr1BtojMdgOu-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*rq4LWcH2xlB7uhJl22JlyA.png" /></figure><p>- computationally less expensive.</p><ul><li>Takes a few inputs at a time thus making the network sparse and easy to compute.</li></ul><p>Data is huge, as it is everywhere and is generated in every second or even in every Picosecond. The research encompasses the extraction of huge data, preparation of databased on Domain Knowledge, drawing out non-trivial information from implicit data through math, statistical ideas using the technical approach, identifying the patterns, constructing the data to build conceptual models, and setting a relationship between data items and lastly visualizing the data for further inference and decision making is called Data Science.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*U0QiMO6JstkgYkrPItCseg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d2787ef3830" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Math Behind TF-IDF!]]></title>
            <link>https://medium.com/@ManasaSomanchi/math-behind-tf-idf-ad657bf8e90?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad657bf8e90</guid>
            <category><![CDATA[tf-idf]]></category>
            <category><![CDATA[tf-idf-explained]]></category>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Fri, 26 Nov 2021 12:31:18 GMT</pubDate>
            <atom:updated>2023-03-28T09:36:56.192Z</atom:updated>
            <content:encoded><![CDATA[<p>Today i am going to explain the most popular topic in NLP which is “Sentiment Analysis” a branch of “Text Analysis”.</p><p>TF-IDF is the one of the methods used to analyse text and helps us understand the impact of word towards relevant sentiments.</p><p>We have different sentiments or other words emotions that can be understood by normal human brain. But if the same emotions have to be understood by a machine we have to import some techniques and one of it is our topic TF-IDF.</p><p>It’s easy if the data is always in the form of numbers, isn’t it? But do you get the way you wanted? The answer is “No”. Data that we see in plenty, can be in the form of text, images, audio, videos etc. But our brains are well programmed to understand any type of data… but what about machines?</p><p>The only language that they understand is numbers. So how do machines understand the if we give the input in other forms, apart from numbers?</p><p>But how do you convert the text form of data into numbers? Yes,</p><p>This is where we land on a discussion about TFIDF.</p><p>In NLP, (Natural Language Processing),one of the major challenges is how to represent the textual form of data into numerical form of data. There are some patterns, similarities of the strings that we need to model into the numerical form in order to perform predictions on the new text data. So the learning of the machines should be intact and not only with single textual data.</p><p>How do we construct the solution for such a scenario?</p><p>By converting text to numbers or vectors which conveys the best meaning such that the machine could respond exactly the way we require.</p><p>Now this sounds like a plan, hmm.. but where would you come across these applications..?</p><p>How about analysis on sentiments. Yes! Right. I need a machine to collect all the comments about a movie and give me a proper justification on, how likely is the movie to watch. So now, in order to predict the same, how should I use the idea of converting the text to numbers.</p><p>Now, let’s assume that I take 3 comments by different viewers:</p><p>Comment 1: The movie is calm and pleasant. Best music.</p><p>Comment 2: Dozed off. Not to the level expected.</p><p>Comment 3: Good film! Music is nice.</p><p>Now looking at them we can figure out the likelihood of watching this movie. That is again based on one’s interest.</p><p>If one, likes to watch a pleasant, calm going and a slow music lover then definitely these comments that is out of 3, 2 comments give good similarity into the respective genre, simultaneously less similarity towards other genres.</p><p>See this is exact idea how TF-IDF works.</p><p>TF-IDF means Term frequency and Inverse Document Frequency.</p><p>So here, we have 3 comments that commented on “music”. Though the second comment used the word “songs” these words fall into same meaning. So those words that are similar are given the same numerical value. Also, same for the words like “Best” the value is slightly high that the words like “Good, Nice” and they fall on the same category that is positive. But how more positive and how less also matters.</p><p>The TF-IDF is the product of Term Frequency and Inverse Document Frequency</p><p>Where TF also known as count vectorizer gives the number of times, the words appear in the given data.</p><p>Now let’s count the number of terms appearing in the relevant comment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*cbSerzFsgZEs7tbkrruPpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*ADZR3WTquDE6cnGXO-gOXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*Py8RNz58TiH8j8h1ACnXpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*vvjS407ajBPorxH3sVisoA.png" /></figure><p>The idea works if the less repeated words in the calculation of Tf-Idf are given more weights and vice versa. This leads to another topic which is TF-IDF weighing schemes. Which I shall talk about in detail in my next article.</p><p>Now, we have calculated the TF-IDF scores what’s next, how does it help me with showing the likelihood of the movie based on one’s interest.</p><p>Here, comes the query, your question that is: “Is the movie calm, pleasant nice etc”. Based on your query the TF-IDF is calculate as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*AUPrG-QwYujo2bHuxOQ7fQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*HDG0EdaadRatM4xZiy8rCQ.png" /></figure><p>What did we observe here, is that based on our query the value of those words that are relevant to our search has increased and the rest became zero.</p><p>This is how we filter the comments based on our query resulting to show how many such comments were alike with our search. From this we can conclude how many comments were given similar to our search.</p><p>This article is for all math lovers, who want to learn how words can be analysed on sentiments using numbers. I hope this article brings to a detailed and in depth math behind TF-IDF and it’s working. In the next article, i will be sharing how these different weighting schemes could change the weights of the words and how it is affected to the Text analysis. Appreciate your valuable feedback. Thank you!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad657bf8e90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability Distribution and its types]]></title>
            <link>https://medium.com/@ManasaSomanchi/probability-distribution-and-its-types-45d566f77b92?source=rss-3deeb064f436------2</link>
            <guid isPermaLink="false">https://medium.com/p/45d566f77b92</guid>
            <category><![CDATA[probability-distributions]]></category>
            <dc:creator><![CDATA[Manasa Somanchi]]></dc:creator>
            <pubDate>Fri, 26 Nov 2021 12:06:11 GMT</pubDate>
            <atom:updated>2021-11-26T12:06:11.768Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my first article and i wanted it to be less detail and easy way to understand with pictures.</p><p>A probability distribution is the mathematical function that gives the probabilities of occurrence of different possible outcomes for an experiment.</p><p><strong>Common Data Types:</strong></p><p><strong>Discrete Data</strong> — takes only specified values. Ex: Roll die possible outcomes are 1,2,3,4,5 or 6 not 1.5 or 2.45.</p><p><strong>Continuous Data</strong> — takes values within given range finite or infinite values. Ex: weight of a person 54Kgs, 54.5Kgs or 54.536Kgs and so on.</p><p><strong>Types of Probability Distribution:</strong></p><p>Frequency Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*Ud_dhx8tIp-hFj0XXCDT2A.png" /></figure><p>Bernoulli Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*cPS3v71uC0Z16gUOZ3rS8w.png" /></figure><p>Uniform Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*qaH2a6792bWayhv1FSAAkQ.png" /></figure><p>Binomial Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*_hbX6DOYjyDuGpFUvNLsMQ.png" /></figure><p>Normal Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*mUKGBefhuu7_2m3wjg3nrw.png" /></figure><p>Poisson Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*z8LasGfkcvK6gTL7NPdHXQ.png" /></figure><p>Exponential Distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*NVJIznY8vKzt9iu4EbYmZQ.png" /></figure><p>These are the picture form of different types of Probability Distribution. In the next article, i shall explain each kind of probability distribution in detail with suitable examples. Hope you like this crisp and handy information. Appreciate your valuable feedback. Thank you!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45d566f77b92" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>