<?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 Sai Chinmay Tripurari on Medium]]></title>
        <description><![CDATA[Stories by Sai Chinmay Tripurari on Medium]]></description>
        <link>https://medium.com/@saichinmayt?source=rss-8be83b190d9e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ijK4k_0mqlZkas3hy1jyIw.jpeg</url>
            <title>Stories by Sai Chinmay Tripurari on Medium</title>
            <link>https://medium.com/@saichinmayt?source=rss-8be83b190d9e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:56:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saichinmayt/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[Gen AI Developer Week 2 — Day 5]]></title>
            <link>https://saichinmayt.medium.com/gen-ai-developer-week-2-day-5-354dea57d26b?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/354dea57d26b</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[knn-algorithm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Thu, 23 Jan 2025 11:46:46 GMT</pubDate>
            <atom:updated>2025-01-23T11:46:46.547Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 2 — Day 5</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/0*DKRwB8V7xPYRA_Uu.jpg" /><figcaption>Train Test Split Image</figcaption></figure><p>The <strong>machine learning workflow</strong> is a structured process that ensures models are both trained effectively and evaluated accurately. A key step is the <strong>train-test split</strong>, where the dataset is divided into training and testing sets to prevent overfitting and assess model performance on unseen data. Coupled with techniques like cross-validation and metrics such as accuracy, precision, and recall, model evaluation provides critical insights into how well a model generalizes. This article dives into these essential steps, forming the backbone of a robust machine learning pipeline.</p><p>Let’s get started with Practical Examples</p><pre># Train Test Split on Iris Dataset<br><br>from sklearn.model_selection import train_test_split<br>from sklearn.datasets import load_iris<br>import pandas as pd<br><br>iris = load_iris()<br>df_iris = pd.DataFrame(data=iris.data, columns=iris.feature_names)<br>df_iris[&#39;target&#39;] = iris.target<br><br>X = df_iris.drop(&#39;target&#39;, axis=1)<br>y = df_iris[&#39;target&#39;]<br><br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<br><br>print(&quot;Training set size:&quot;, X_train.shape)<br>print(&quot;Testing set size:&quot;, X_test.shape)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*WhWYiLPpP1-a_Ar7enKcZw.png" /></figure><pre>#  k-Nearest Neighbors Classification - On Iris Dataset<br><br>from sklearn.neighbors import KNeighborsClassifier<br>from sklearn.metrics import classification_report, confusion_matrix<br><br># Train k-NN model<br>knn = KNeighborsClassifier(n_neighbors=3)<br>knn.fit(X_train, y_train)<br><br># Predictions<br>y_pred_knn = knn.predict(X_test)<br><br># Evaluation<br>print(&quot;Classification Report:&quot;)<br>print(classification_report(y_test, y_pred_knn))<br><br>print(&quot;Confusion Matrix:&quot;)<br>print(confusion_matrix(y_test, y_pred_knn))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*Ovp33N-iFQK7eqEXlpY3Jw.png" /></figure><blockquote>What is k-NN ?<br>Imagine you have a group of friends with different hobbies. You want to know what hobbies a new friend might like. kNN is like asking your k closest friends what their hobbies are, and then assuming your new friend will like the most common hobbies among those k friends.<br><strong>In machine learning:<br> Data points:</strong> Your friends and their hobbies.<br> <strong>New data point:</strong> Your new friend.<br> <strong>k:</strong> The number of closest friends you ask.<br> <strong>Classification:</strong> Predicting the new friend’s hobbies based on their closest friends’ hobbies.</blockquote><p><strong>Deliverables for the day:</strong></p><ol><li>Training and testing data summary (e.g., size of splits).</li><li>Classification report for k-NN (Accuracy, Precision, Recall, F1-Score)</li></ol><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=354dea57d26b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 2 — Day 4]]></title>
            <link>https://saichinmayt.medium.com/gen-ai-developer-week-2-day-4-32736fb30e00?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/32736fb30e00</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Thu, 16 Jan 2025 13:58:13 GMT</pubDate>
            <atom:updated>2025-01-16T13:58:13.551Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 2 — Day 4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tULUB8jWNWdCb8r7nxRlVQ.jpeg" /></figure><p>Data preparation indeed serves as the most important step in making a dataset ready for machine learning models. The main objective of this is dealing with missing data accurately so as to preserve data integrity, create the names and labels of categorical variables through various mechanisms one-hot encoding and label encoding, and standardize features with tools such as StandardScaler and MinMaxScaler in order to achieve uniformity. From a more general perspective, not only does this improve the model performance but also make the knowledge extracted from the data it applies to better quality. The nuances of onehot encoding and label encoding are discussed, as well as strategies in managing this aspect of modelingit is used.</p><h3>Tasks</h3><ol><li><strong>Handle Missing Data<br></strong>Use the given dataset to fill in missing values with appropriate strategies.</li><li><strong>One-Hot Encode Categorical Data<br></strong>Convert categorical columns into numerical ones.</li><li><strong>Scale Features<br></strong>Apply <strong>StandardScaler</strong> and <strong>MinMaxScaler</strong> to a numerical dataset.</li></ol><pre>import pandas as pd<br>import numpy as np<br>from sklearn.preprocessing import StandardScaler, MinMaxScaler<br><br># Dataset<br>data = {<br>    &#39;Age&#39;: [25, 30, np.nan, 40, 50],<br>    &#39;Salary&#39;: [50000, 60000, 70000, np.nan, 90000],<br>    &#39;Country&#39;: [&#39;USA&#39;, &#39;Canada&#39;, &#39;Mexico&#39;, &#39;USA&#39;, np.nan]<br>}<br>df = pd.DataFrame(data)<br><br># Task 1: Handle Missing Data<br>df[&#39;Age&#39;] = df[&#39;Age&#39;].fillna(df[&#39;Age&#39;].mean())  # Fill Age with mean<br>df[&#39;Salary&#39;] = df[&#39;Salary&#39;].fillna(df[&#39;Salary&#39;].median())  # Fill Salary with median<br>df[&#39;Country&#39;] = df[&#39;Country&#39;].fillna(df[&#39;Country&#39;].mode()[0])  # Fill Country with mode<br><br>print(&quot;After Handling Missing Data:&quot;)<br>print(df)<br><br># Task 2: One-Hot Encode &#39;Country&#39;<br>df_encoded = pd.get_dummies(df, columns=[&#39;Country&#39;], drop_first=True)<br>print(&quot;\nAfter One-Hot Encoding:&quot;)<br>print(df_encoded)<br><br># Task 3: Scale Features<br>scaler_standard = StandardScaler()<br>scaler_minmax = MinMaxScaler()<br><br>df_encoded[[&#39;Age&#39;, &#39;Salary&#39;]] = scaler_standard.fit_transform(df_encoded[[&#39;Age&#39;, &#39;Salary&#39;]])<br>print(&quot;\nAfter Standard Scaling:&quot;)<br>print(df_encoded)<br><br>df_minmax = df_encoded.copy()<br>df_minmax[[&#39;Age&#39;, &#39;Salary&#39;]] = scaler_minmax.fit_transform(df_minmax[[&#39;Age&#39;, &#39;Salary&#39;]])<br>print(&quot;\nAfter Min-Max Scaling:&quot;)<br>print(df_minmax)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*sAJYGtssOwglNvNMPf821w.png" /><figcaption>Output</figcaption></figure><p><strong>Practice Task — 1</strong><br>Filling with zeros or custom values.</p><p><strong>Practice Task — 2<br></strong>Dropping rows with missing data.</p><p><strong>Deliverables for the day:</strong></p><ol><li>Submit a well-preprocessed dataset where:<br>Missing values are handled.<br>Categorical data is encoded.<br>Numerical features are scaled.</li><li>Experiment with both StandardScaler and MinMaxScaler and describe the differences.</li></ol><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32736fb30e00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local LLM Chat App]]></title>
            <link>https://saichinmayt.medium.com/local-llm-chat-app-e2eb88383ac4?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2eb88383ac4</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 06:50:30 GMT</pubDate>
            <atom:updated>2025-01-14T06:50:30.301Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QnIy9OT40QlYT2bSNSV8vw.png" /><figcaption>Local LLM Chat Application</figcaption></figure><p>The <strong>Local LLM Chat App</strong> is a new-age project spearheaded to bring the power of LLMs closer to the user in a real-time manner with a chat interface built upon Streamlit. The project relies on Ollama to integrate LLMs locally and tools such as Hugging Face to deploy real-time, enhancing efficiency in query processing. Using Python to manage dependencies, it allows you to experiment with various models (like Llama3, Phi3) and compare them. The intent behind this effort is to merge where AI stands now with what is good design to put cutting-edge LLMs within the reach of developers and enthusiasts.</p><p>🎯 <strong>Objective —</strong> Create a real-time, user-friendly chat application using Streamlit and Ollama’s local LLMs.<br>👉 <strong>Tech Stack —</strong> Streamlit, Ollama (e.g., Llama3, Phi3…), Python, Hugging Face, FastAPI.</p><p><strong>Set Up Your Environment</strong></p><pre>local-llm-chat-app/<br>│<br>├── app/<br>│   ├── main.py                # Streamlit app<br>│   ├── api/<br>│   │   ├── server.py          # FastAPI server<br>│   │   ├── models/            # LLM model integration<br>│   │   └── utils.py           # Helper functions<br>│   └── assets/                # Any static files (e.g., logos, images)<br>│<br>├── requirements.txt           # Dependencies<br>├── Dockerfile                 # For deployment on Hugging Face<br>├── .env                       # Environment variables<br>└── README.md                  # Project overview</pre><h4>Set Up Python Environment</h4><ol><li>Create Virtual Envirnoment</li></ol><pre>python -m venv env<br>source env/bin/activate  # Linux/Mac<br>.\env\Scripts\activate   # Windows</pre><p>2. Install essential libraries</p><pre>pip install streamlit fastapi uvicorn ollama huggingface_hub</pre><p>To get started with Ollama, you first need to download and install it from the official <a href="https://ollama.com/">Ollama website</a>. Follow the installation instructions provided on the website based on your operating system. Once installed, open your command prompt or terminal and download the desired model by running the following command:</p><pre>ollama pull &lt;model-name&gt;<br><br># Replace model-name you want to use ex.(ollama pull llama2)</pre><p><strong>Build the Chat Application<br>Streamlit UI Development</strong></p><pre># app/main.py<br><br>import streamlit as st<br>from api.utils import query_local_llm<br><br>st.set_page_config(page_title=&quot;Local LLM Chat&quot;, page_icon=&quot;:shark:&quot;, layout=&quot;wide&quot;)<br>st.title(&quot;Local LLM ChatAPP&quot;)<br>st.sidebar.header(&quot;Settings&quot;)<br><br>model_name = st.sidebar.selectbox(<br>    &quot;Choose a model&quot;,<br>    [&quot;llama3&quot;, &quot;phi4&quot;]<br>)<br><br>user_input = st.text_input(&quot;Enter your query&quot;, key=&quot;user_input&quot;)<br><br>if st.button(&quot;Submit&quot;):<br>    with st.spinner(&quot;Processing...&quot;):<br>        response = query_local_llm(model_name, user_input)<br>        st.write(f&quot;Response: {response}&quot;)<br><br>st.header(&quot;Compare Model Performance&quot;)<br>models = [&quot;llama3&quot;, &quot;phi4&quot;]<br>queries = st.text_area(&quot;Enter test queries (one per line)&quot;)<br><br>if st.button(&quot;Compare Models&quot;):<br>    for model in models:<br>        st.write(f&quot;Model: {model}&quot;)<br>        for query in queries.splitlines():<br>            with st.spinner(&quot;Processing...&quot;):<br>                response = query_local_llm(model, query)<br>                st.write(f&quot;{query}: {response}&quot;)</pre><p><strong>Set up a function to query Ollama’s LLMs</strong></p><pre># app/api/utils.py<br><br>import ollama<br><br>def query_local_llm(model_name, query):<br>    response = ollama.generate(model=model_name, prompt=query)<br>    return response[&#39;response&#39;]</pre><p><strong>FastAPI Integration for APIs</strong></p><pre># app/api/server.py<br><br>from fastapi import FastAPI<br>from pydantic import BaseModel<br>import ollama<br><br>app = FastAPI()<br><br>class QueryRequest(BaseModel):<br>    model: str<br>    query: str<br><br>@app.post(&#39;/query&#39;)<br>async def query_model(request: QueryRequest):<br>    response = ollama.generate(model=request.model, prompt=request.query)<br>    return response[&#39;response&#39;]</pre><p>Test server locally</p><pre>uvicorn app.api.server:app --reload</pre><p>Thank you for exploring this project! I hope you found it insightful and inspiring to build your own applications. For the complete source code, feel free to visit the <a href="https://github.com/saichinmay2000/Local-LLM-Chat-Application">GitHub repository</a>. If you’d like to connect, collaborate, or share feedback, you can find me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><p>Happy coding! 🚀✨</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2eb88383ac4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 2 — Day 3]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-2-day-3-cbbaa8ee7c09?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbbaa8ee7c09</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-preprocessing]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Mon, 13 Jan 2025 06:20:37 GMT</pubDate>
            <atom:updated>2025-01-23T06:23:12.516Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 2 — Day 3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tULUB8jWNWdCb8r7nxRlVQ.jpeg" /><figcaption>Data Pre Processing Image</figcaption></figure><p>Data is the fuel for any machine learning model, but very rarely does raw data lend itself to analysis. Data preprocessing is the all-important first step to ensure that your data is clean and consistent for the purpose of getting the most important insights from it. From handling missing values to scaling features, preprocessing modifies messy datasets into structured inputs that models understand. This article is a continuation of my journey through Generative AI Developer Week that introduces the key techniques and importance of data preprocessing in the machine-learning pipeline.</p><p><strong>Simulate Missing Data</strong></p><pre># Handelling Missing Data in Datasets<br>import pandas as pd<br>import numpy as np<br><br>data = {<br>    &#39;Age&#39; : [25, 30, np.nan, 40, 50],<br>    &#39;Salary&#39; : [50000, 60000, 70000, np.nan, 90000],<br>    &#39;Country&#39; : [&#39;USA&#39;, &#39;Canada&#39;, &#39;Mexico&#39;, &#39;USA&#39;, np.nan]<br>}<br><br>df = pd.DataFrame(data)<br>print(&quot;Dataset with missing values:\n&quot;, df)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZ_m8zT7QIjPgIU_cjVaTw.png" /></figure><p><strong>Handle Missing Values — Drop rows/columns</strong></p><pre>df_dropped = df.dropna() # Function used to remove or drop the missing values<br>print(&quot;\nDataset after dropping missing values:\n&quot;, df_dropped)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*9waYsE_YqCqbzYZEoGZVRQ.png" /></figure><p><strong>Handle Missing Values — Fill missing values with a strategy (e.g., mean, median, or mode)</strong></p><pre># Statergy based filling the missed values<br><br>df[&#39;Age&#39;] = df[&#39;Age&#39;].fillna(df[&#39;Age&#39;].mean())<br>df[&#39;Salary&#39;] = df[&#39;Salary&#39;].fillna(df[&#39;Salary&#39;].median())<br>df[&#39;Country&#39;] = df[&#39;Country&#39;].fillna(df[&#39;Country&#39;].mode()[0])<br><br>print(&quot;\nDataset after filling missing values:\n&quot;, df)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_myLvSp1cXOVsXSBLoN7Q.png" /></figure><p><strong>Encoding Categorical Variables — One-Hot Encoding</strong><br>Convert categorical features into numerical format for ML models.</p><pre># Encoding Categorical Variables<br><br>df_encoded = pd.get_dummies(df, columns=[&#39;Country&#39;], drop_first=True)<br>print(&quot;\nOne-hot encoded dataset:\n&quot;, df_encoded)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*mdjETPk1t1FGnZor3ugxsw.png" /></figure><p><strong>Feature Scaling Standardization (Z-Score Normalization)<br></strong>Ensure numerical features are on the same scale to avoid bias in ML models.</p><pre># Feature Scaling<br>from sklearn.preprocessing import StandardScaler<br>scaler = StandardScaler()<br># Standard Scaler<br># StandardScaler is a data preprocessing technique that scales <br># numerical features to have a mean of 0 and a standard deviation of 1.<br><br>df_encoded[[&#39;Age&#39;, &#39;Salary&#39;]] = scaler.fit_transform(df_encoded[[&#39;Age&#39;, &#39;Salary&#39;]])<br>print(&quot;\nDataset after feature scaling:\n&quot;, df_encoded)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*3_sR8UumN_Cg48Oki7pqYA.png" /></figure><p><strong>Practices Tasks</strong></p><p><strong>Task 1</strong> — Create a new dataset with at least 3 numerical and 2 categorical columns. Introduce missing values and preprocess the dataset.<br><strong>Task 2</strong> — Compare the effect of standardization and normalization (Min-Max scaling) on a dataset using MinMaxScaler from Scikit-learn.<br><strong>Task 3</strong> — Use the preprocessed dataset to train a Linear Regression model (revisit Day 2).</p><p><strong>Example of Task 3 — Model Trained on the Existing Dataset discussed above for this tutorial.</strong></p><pre>import pandas as pd<br>import numpy as np<br>from sklearn.preprocessing import StandardScaler<br>from sklearn.model_selection import train_test_split<br>from sklearn.linear_model import LinearRegression<br>from sklearn.metrics import mean_squared_error, r2_score<br><br>X = df_encoded.drop(&#39;Salary&#39;, axis=1) <br>y = df_encoded[&#39;Salary&#39;]<br><br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<br><br>model = LinearRegression()<br>model.fit(X_train, y_train)<br><br>y_pred = model.predict(X_test)<br><br>mse = mean_squared_error(y_test, y_pred)<br>r2 = r2_score(y_test, y_pred)<br><br>print(&quot;Coefficients:&quot;, model.coef_)<br>print(&quot;Intercept:&quot;, model.intercept_)<br>print(&quot;Mean Squared Error:&quot;, mse)<br>print(&quot;R-squared:&quot;, r2)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*PU0iP257GDj-URV0R6cTaw.png" /></figure><p><strong>Deliverables for the day:</strong><br>A clean dataset with missing values handled and categorical features encoded. <br>Standardized and/or normalized numerical features.</p><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbbaa8ee7c09" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-2-day-3-cbbaa8ee7c09">Gen AI Developer Week 2 — Day 3</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 2 — Day 2]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-2-day-2-8a827197644f?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a827197644f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[model]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 10:19:48 GMT</pubDate>
            <atom:updated>2025-01-10T10:19:48.282Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 2 — Day 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RXUzuQz4NrrZjJLN7uqOA.jpeg" /><figcaption>Intro to Linear Regression Model</figcaption></figure><p>Linear regression is a simple yet powerful method in machine learning and statistics. Many applications that use data are based on predictions and insights made possible by modeling the connection between variables that are dependent and independent. As part of my trip through Generative AI Developer Week, we discuss the fundamental ideas, real-world applications, and mathematical underpinnings of linear regression in this piece.</p><blockquote><strong>Let’s recap what is Linear Regression?</strong><br><strong>Linear Regression</strong> predicts a target <strong>y</strong> based on a linear combination of input features <strong>x1,x2,…,xn.</strong></blockquote><p>We’re going to train a Linear Regression Model with the Diabetes data.</p><p><strong>Load Dataset &amp; Create a DataFrame</strong></p><pre>from sklearn.datasets import load_diabetes # Get Diabetes Dataset<br>import pandas as pd<br><br>data = load_diabetes()<br><br># Create a dataframe with pandas<br>df = pd.DataFrame(data.data, columns=data.feature_names)<br>df[&#39;target&#39;] = data.target<br><br>print(df.head())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*JT5JaIqyfnfqzg0sWepLZw.png" /><figcaption>Dataframe output for Diabetes Dataset</figcaption></figure><p><strong>Split dataset to Training and Testing Data using Train-Test Split</strong></p><pre># Train Test Data Split<br>from sklearn.model_selection import train_test_split<br><br>X = df.drop(&#39;target&#39;, axis=1)<br>y = df[&#39;target&#39;]<br><br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)<br><br>print(X_train.shape, X_test.shape, y_train.shape, y_test.shape)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*uP3WieXhzD4AB6Of45ZF4Q.png" /><figcaption>Output of Train Test Split</figcaption></figure><p><strong>Train a Linear Regression Model</strong></p><pre># Preparing a Model<br>from sklearn.linear_model import LinearRegression<br><br>model = LinearRegression()<br><br>model.fit(X_train, y_train)<br><br>print(&quot;Coeff: &quot;, model.coef_)<br>print(&quot;Intercept: &quot;, model.intercept_)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*e-R3AkPKGjUC8wvmHpcK5Q.png" /><figcaption>Output of Coef &amp; Intercept</figcaption></figure><blockquote><strong>Coefficient: </strong>The dependent variable’s change for every unit change in the independent variable is indicated by the line’s slope.<br><strong>Intercept: </strong>The value of the dependent variable at the point where the line crosses the y-axis and the independent variable is zero.</blockquote><p><strong>Make Predictions</strong></p><pre># Predict on the test data<br>y_pred = model.predict(X_test)<br><br>print(&quot;Predictions:&quot;, y_pred[:5])<br>print(&quot;Actual values:&quot;, y_test.values[:5])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*bMKB7jEEWz0lG194fyM0ag.png" /></figure><p><strong>Evaluate the Model</strong></p><pre>from sklearn.metrics import mean_squared_error, r2_score<br><br># Calculate metrics<br>mse = mean_squared_error(y_test, y_pred)<br>r2 = r2_score(y_test, y_pred)<br><br>print(&quot;Mean Squared Error:&quot;, mse)<br>print(&quot;R^2 Score:&quot;, r2)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*as8E1PdK1wwK34k02x-kSQ.png" /></figure><p><strong>Mean Squared Error (MSE):<br></strong>calculates the mean squared variation between the expected and actual values. Better model fit is indicated by a lower MSE.<br><strong>R-squared:<br></strong>shows the percentage of the dependent variable’s variance that the model can account for, A better fit is indicated by a higher R-squared, which ranges from 0 to 1.</p><p><strong>Task — </strong>Plot the predicted vs. actual values for the test set.</p><pre>import matplotlib.pyplot as plt<br><br># Plot predicted vs actual values<br>plt.scatter(y_test, y_pred, alpha=0.7)<br>plt.xlabel(&quot;Actual Values&quot;)<br>plt.ylabel(&quot;Predicted Values&quot;)<br>plt.title(&quot;Predicted vs. Actual&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*F1tkCCZjWTVs_8MMPfEVAg.png" /></figure><p><strong>Deliverables for the day:</strong><br>Linear Regression model trained on the Diabetes dataset.<br>MSE and R2R²R2-score of the model.<br>A scatter plot of predicted vs. actual values.</p><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a827197644f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-2-day-2-8a827197644f">Gen AI Developer Week 2 — Day 2</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 2— Day 1]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-2-day-1-688dcbcae701?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/688dcbcae701</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[genarative-ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Wed, 08 Jan 2025 08:52:53 GMT</pubDate>
            <atom:updated>2025-01-08T08:52:53.547Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tUoTmccj0K-lPxfSkiL7sg.jpeg" /><figcaption>Intro to Machine Learning</figcaption></figure><p>We’ll go over the fundamental ideas of machine learning (ML) today, including its various forms and important terms. Recognize the definition of machine learning and its uses.Discover the distinctions between reinforcement learning, supervised learning, and unsupervised learning.<br>Examine the two main supervised algorithms, k-Nearest Neighbors (k-NN) and linear regression.</p><p><strong>What is Machine Learning ? <br></strong>A branch of artificial intelligence called machine learning uses data to teach machines how to perform efficiently without explicitly programming them.</p><p><strong>Few Applications of Machine Learning (ML)<br></strong>1. Image Recognition — Face Based Attendance System<br>2. Spam Email Filtering — Gmail Spam Email Filtering<br>3. Rcommender Systems — (Amazon &amp; Netflix)</p><p><strong>Types of Machine Learning</strong></p><p><strong>1. Supervised Learning — (Learns from Labelled Data)<br></strong>The model learns from labeled data. For example, predict house values based on factors such as size and location.</p><p><strong>2. Unsupervised Learning — (Learns from Unlabelled Data)<br></strong>The model recognizes patterns in unlabeled data.For example, clients can be grouped depending on their purchase habits.</p><p><strong>3. Reinforcement Learning — (Learns from its Surroundings)<br></strong>The model learns by interacting with its surroundings and getting input (rewards or punishments). Example: Teaching a robot to walk.</p><p><strong>Key Algorithms for Supervised Learning<br>1. Linear Regression</strong></p><pre>Predicts a continuous value<br>Equation: 𝑦=𝑚𝑥+𝑏<br>  y: Target (dependent variable)<br>  x: Features (independent variables)<br>  m: Slope (weights)<br>  b: Intercept (bias)</pre><p><strong>2. k-Nearest Neighbors (k-NN)<br></strong>A classification procedure that uses the majority label of the closest 𝑘 data points to determine a label. performs well with smaller datasets that have fewer characteristics.</p><p><strong>Explore the Scikit-learn Library</strong></p><pre># Scikit-learn, a powerful library for machine learning<br>pip install scikit-learn</pre><p><strong>Linear Regression Intuition</strong></p><pre># Plot a simple line 𝑦=2𝑥+3 using matplotlib<br><br>import numpy as np<br>import matplotlib.pyplot as plt<br><br>x = np.linspace(0, 10, 100)<br>y = 2 * x + 3<br><br>#Plotting<br><br>plt.plot(x,y label=&#39;y=2x+3&#39;)<br>plt.xlabel(&#39;x&#39;)<br>plt.ylabel(&#39;y&#39;)<br>plt.title(&#39;Linear Regression Line&#39;)<br>plt.legend()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*vnXxT-DVebkr6srRFfDFHw.png" /><figcaption>Linear Regression Plot</figcaption></figure><p><strong>Supervised Learning Example</strong></p><pre>from sklearn.datasets import load_diabetes<br><br>data = load_diabetes()<br><br># Features and Target Separation based on the dataset<br>x = data.data<br>y = data.target<br><br>print(&quot;Feature Names:&quot;, data.feature_names)<br>print(&quot;First 5 rows of features:\n&quot;, x[:5])<br>print(&quot;First 5 target values:&quot;, y[:5])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*v0tgfkvDxCGA7ogqXFCUQw.png" /><figcaption>Supervised Learning Dataset Example</figcaption></figure><p><strong>Deliverables for Today:<br></strong>1.<strong> </strong>Summary of ML Types.<br>2. Code for plotting a linear regression line.<br>3. Output from loading and exploring a dataset from sklearn.</p><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=688dcbcae701" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-2-day-1-688dcbcae701">Gen AI Developer Week 2— Day 1</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 1 — Day 6]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-6-63219c531838?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/63219c531838</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Tue, 07 Jan 2025 06:18:27 GMT</pubDate>
            <atom:updated>2025-01-07T06:18:27.292Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 1 — Day 6</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VIFOcIULHjnQqAHjw9smxg.jpeg" /><figcaption>Intro to NLP</figcaption></figure><p>Natural Language Processing (NLP) is the key to bridging the gap between human language and machine understanding. From chatbots to sentiment analysis, NLP enables computers to interpret, process, and generate human language with remarkable accuracy. As part of my Generative AI Developer Week journey, this article explores the fundamentals of NLP, its real-world applications, and how it forms the backbone of many AI-driven innovations today.</p><p>Let’s get started by first installing the necessary dependencies.</p><pre># Installing NLTK<br>pip install nltk<br><br># Installing Spacy<br>pip install spacy</pre><p>Some concepts to get familiar before proceeding.</p><p><strong>Tokenization</strong>: Splitting text into smaller units like words or sentences.</p><p><strong>Removing Stopwords</strong>: Eliminating common words that don’t add much meaning (e.g., “is”, “the”).</p><p><strong>Stemming</strong>: Reducing words to their root forms (e.g., “playing” → “play”).</p><p><strong>Lemmatization</strong>: Reducing words to their dictionary base forms (e.g., “mice” → “mouse”).</p><p><strong>Tokenization with NLTK</strong></p><pre>import nltk<br>from nltk.tokenize import word_tokenize, sent_tokenize<br><br># Download necessary data<br>nltk.download(&#39;punkt&#39;)<br>nltk.download(&#39;punkt_tab&#39;)<br><br>text = &quot;Natural Language Processing is amazing. It helps computers understand human language.&quot;<br><br># Sentence Tokenization<br>sentences = sent_tokenize(text)<br>print(&quot;Sentences:&quot;, sentences)<br><br># Word Tokenization<br>words = word_tokenize(text)<br>print(&quot;Words:&quot;, words)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KSzyPgxNxo8_LhjBEUP9Ww.png" /><figcaption>Tokenization Output</figcaption></figure><p><strong>Removing Stopwords</strong></p><pre>from nltk.corpus import stopwords<br><br># Download necessary data<br>nltk.download(&#39;stopwords&#39;)<br><br>stop_words = set(stopwords.words(&#39;english&#39;))<br>filtered_words = [word for word in words if word.lower() not in stop_words]<br><br>print(&quot;Filtered Words:&quot;, filtered_words)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJkmBUzompoIgE_ligb86A.png" /><figcaption>Stopwords Output</figcaption></figure><blockquote>Info: all the necessary data for nltk can be found <a href="https://www.nltk.org/nltk_data/">here</a>.</blockquote><p><strong>Stemming with NLTK</strong></p><pre>from nltk.stem import PorterStemmer<br><br>stemmer = PorterStemmer()<br>stemmed_words = [stemmer.stem(word) for word in filtered_words]<br>print(&quot;Stemmed Words:&quot;, stemmed_words)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiEUvMX2OOFbHdch3AMiPQ.png" /><figcaption>Stemming Output</figcaption></figure><p><strong>Lemmatization with spaCy</strong></p><pre>import spacy<br><br>nlp = spacy.load(&#39;en_core_web_sm&#39;) # Loads English model<br>doc = nlp(&quot; &quot;.join(filtered_words))<br><br>lemmatized_words = [token.lemma_ for token in doc]<br>print(&quot;Lemmatized Words:&quot;, lemmatized_words)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rWXYNr2JTH_bWkXys2Cskw.png" /><figcaption>Lemmatization Output</figcaption></figure><blockquote>Info: Get all models of spaCy from <a href="https://spacy.io/usage/models">here</a>.</blockquote><p><strong>Practice Task — 1 — Process a New Text</strong></p><p>Choose a paragraph of your choice.</p><p>Perform tokenization, stopword removal, stemming, and lemmatization.</p><p><strong>Practice Task — 2 — </strong>Count the frequency of each unique word in the text after preprocessing.</p><p><strong>Practice Task — 3— </strong>Create a bar chart of the top 10 most frequent words using <strong>Matplotlib</strong>.</p><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63219c531838" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-6-63219c531838">Gen AI Developer Week 1 — Day 6</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 1 — Day 5]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-5-9d6a3ffafbee?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d6a3ffafbee</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machinelerning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Sun, 05 Jan 2025 02:50:15 GMT</pubDate>
            <atom:updated>2025-01-05T02:50:15.394Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 1 — Day 5</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*jFT_Ifsn9TIEJbn6dpuRTQ.png" /></figure><p>Effective data visualization connects raw numbers with actionable insights. Libraries such as <strong>Matplotlib</strong> and <strong>Seaborn</strong> enable developers to produce clear, engaging, and insightful visualisations. While Matplotlib offers unparalleled versatility for constructing unique plots, Seaborn makes it easier to create visually appealing and statistically robust visualizations. As part of my <strong>Generative AI Developer Week</strong> adventure, this essay discusses how these libraries work together to transform data into interesting tales.</p><p>Let’s first install matplotlib and seaborn using the below pip command installation.</p><pre># Run the below command to install matplotlib and seaborn<br>pip install matplotlib<br>pip install seaborn</pre><p>Now lets import matplotlib and seaborn to get started for this day!</p><pre>import matplotlib.pyplot as plt<br>import seaborn as sns</pre><p>For Matplotlib basics you can refer this article <a href="https://saichinmayt.medium.com/gen-ai-developer-week-1-day-4-5ab16db9d404">here</a>.</p><p><strong>Seaborn Basics — Distribution Plot</strong></p><pre># Distribution Plot<br># Understand the distribution of a single variable.<br><br>import seaborn as sns<br>import numpy as np<br><br>data = np.random.randn(1000)  # Random data<br><br>sns.histplot(data, kde=True, color=&#39;purple&#39;)<br>plt.title(&#39;Distribution Plot Example&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*2hrn9ZCsYaJQ0rm4CUs6zg.png" /><figcaption>Distribution Plot</figcaption></figure><p><strong>Seaborn Basics — Heatmap</strong></p><pre># Heatmap<br># Visualize correlations or matrix-like data.<br><br>data = np.random.rand(5, 5)  # Random matrix<br>sns.heatmap(data, annot=True, cmap=&#39;coolwarm&#39;)<br>plt.title(&#39;Heatmap Example&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*i1-bUQkKfeXciNtWEKItDQ.png" /><figcaption>Heatmap</figcaption></figure><p><strong>Seaborn Basics — Pairplot</strong></p><pre># Pairplot<br># Explore relationships between multiple variables in a dataset.<br><br>iris = sns.load_dataset(&#39;iris&#39;) # Loading iris dataset<br>sns.pairplot(iris, hue=&#39;species&#39;)<br># plt.title(&#39;Pairplot Example&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*aypSybpJCB8d4HF65R49jw.png" /><figcaption>PairPlot</figcaption></figure><p><strong>Task — Heatmap</strong></p><pre># Task 3: Heatmap<br># Use the Iris dataset and create a heatmap showing correlations between features.<br><br>import matplotlib.pyplot as plt<br>import seaborn as sns<br><br>iris = sns.load_dataset(&#39;iris&#39;)  # Load Dataset<br>iris_numeric = iris.select_dtypes(include=[&#39;float64&#39;, &#39;int64&#39;]) # exclude non numeric data<br>correlation_matrix = iris_numeric.corr() # create correlational matrix<br>print(correlation_matrix)<br><br>sns.heatmap(correlation_matrix, annot=True, cmap=&#39;coolwarm&#39;, fmt=&#39;.2f&#39;, linewidths=0.5) # create heatmap with correlational matrix<br>plt.title(&#39;Heatmap of Iris Dataset Correlations&#39;)<br>plt.show()<br>plt.savefig(&#39;irisHeatMap.png&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*1fZky1d8OWSFrVyv4J5kRg.png" /><figcaption>Heatmap — Task</figcaption></figure><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d6a3ffafbee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-5-9d6a3ffafbee">Gen AI Developer Week 1 — Day 5</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 1 — Day 4]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-4-5ab16db9d404?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ab16db9d404</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Fri, 03 Jan 2025 14:25:08 GMT</pubDate>
            <atom:updated>2025-01-03T14:25:08.310Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 1 — Day 4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*_JhXaoYZakQB6NdGDh40Cw.png" /></figure><p>Visualization is a powerful way to understand and communicate data, and <strong>Matplotlib</strong> is the go-to Python library for creating stunning and informative visualizations. From simple line plots to complex multi-plot figures, Matplotlib provides the flexibility and tools to bring data to life. As part of my Generative AI Developer Week journey, this article explores how Matplotlib empowers developers to analyze trends, share insights, and prepare visualizations that complement AI and machine learning projects.</p><p>Let’s first install pandas using the below pip command installation.</p><pre># Install matplotlib using the below command<br>pip install matplotlib</pre><p>Now lets import matplotlib and get started for this day!</p><pre>import matplotlib.pyplot as plt</pre><p><strong>Key Concepts — Basic Plot</strong></p><pre># Basic Plot<br><br>x = [1, 2, 3, 4, 5]<br>y = [10, 20, 25, 30, 35]<br><br>plt.plot(x,y)<br>plt.title(&quot;Basic Line Plot&quot;)<br>plt.xlabel(&quot;X-axis&quot;)<br>plt.ylabel(&quot;Y-axis&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*25usxC-yUoG7Tb_WGSVaJQ.png" /><figcaption>Basic Plot</figcaption></figure><p><strong>Key Concepts — Scatter Plot</strong></p><pre># Scatter Plot<br><br>x = [5, 7, 8, 7, 2, 17, 2, 9]<br>y = [99, 86, 87, 88, 100, 86, 103, 87]<br><br>plt.scatter(x, y, color=&#39;red&#39;)<br>plt.title(&quot;Scatter Plot Example&quot;)<br>plt.xlabel(&quot;X-axis&quot;)<br>plt.ylabel(&quot;Y-axis&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*dHOGDsJ4MOnGxNM1JGjlQg.png" /><figcaption>Scatter Plot</figcaption></figure><p><strong>Key Concepts — Bar Plot</strong></p><pre># Bar Chart<br><br>categories = [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;]<br>values = [3, 7, 8, 5]<br><br>plt.bar(categories, values, color=&#39;blue&#39;)<br>plt.title(&quot;Bar Chart Example&quot;)<br>plt.xlabel(&quot;Categories&quot;)<br>plt.ylabel(&quot;Values&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*PQzKt1wXkPTjP_GZ-7o6Bw.png" /><figcaption>Bar Plot</figcaption></figure><p><strong>Key Concepts — Histogram Plot</strong></p><pre># Histogram Plot<br><br>data = [22, 87, 5, 43, 56, 73, 55, 54, 11, 20, 51, 5, 79, 31, 27]<br><br>plt.hist(data, bins=5, color=&#39;green&#39;, edgecolor=&#39;black&#39;)<br>plt.title(&quot;Histogram&quot;)<br>plt.xlabel(&quot;Bins&quot;)<br>plt.ylabel(&quot;Frequency&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*s97c34zrDNFNtjItX-tuhw.png" /><figcaption>Histogram Plot</figcaption></figure><p><strong>Key Concepts — Pie Chart Plot</strong></p><pre># Pie Chart Plot<br><br>sizes = [15, 30, 45, 10]<br>labels = [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;]<br>colors = [&quot;gold&quot;, &quot;yellowgreen&quot;, &quot;lightcoral&quot;, &quot;lightskyblue&quot;]<br><br>plt.pie(sizes, labels=labels, colors=colors, autopct=&quot;%1.1f%%&quot;)<br>plt.title(&quot;Pie Chart Example&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*myZD1KHANG7k5_Cv41rAzw.png" /><figcaption>Pie Chart</figcaption></figure><p><strong>Task 1: Line Plot</strong></p><pre># Create a line plot showing the trend of monthly expenses for 6 months: <br># [200, 250, 270, 300, 320, 310].</pre><pre>expenses = [200, 250, 270, 300, 320, 310]<br>months = [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;]<br><br>plt.plot(months, expenses, marker=&quot;o&quot;)<br>plt.title(&quot;Monthly Expenses&quot;)<br>plt.xlabel(&quot;Months&quot;)<br>plt.ylabel(&quot;Expenses ($)&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*CqEdKp3XaB_DyVWjxaLQJQ.png" /><figcaption>Task 1 Line Chart</figcaption></figure><p><strong>Task 2: Scatter Plot</strong></p><pre># Visualize the relationship between students study hours and their test scores:<br># Hours: [2, 3, 4, 5, 6, 7]<br># Scores: [50, 55, 65, 70, 80, 85]</pre><pre>hours = [2, 3, 4, 5, 6, 7]<br>scores = [50, 55, 65, 70, 80, 85]<br><br>plt.scatter(hours, scores, color = &quot;purple&quot;)<br>plt.title(&quot;Study Hours vs Test Scores&quot;)<br>plt.xlabel(&quot;Study Hours&quot;)<br>plt.ylabel(&quot;Test Scores&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*hF86dUjwBWUS-kPCjc7Ntg.png" /><figcaption>Task Scatter Plot</figcaption></figure><p><strong>Task 3: Bar Chart</strong></p><pre># Create a bar chart showing sales data for four products:<br># Products: [&quot;Product A&quot;, &quot;Product B&quot;, &quot;Product C&quot;, &quot;Product D&quot;]<br># Sales: [150, 200, 250, 180]</pre><pre>products = [&quot;Product A&quot;, &quot;Product B&quot;, &quot;Product C&quot;, &quot;Product D&quot;]<br>sales = [150, 200, 250, 180]<br><br>plt.bar(products, sales, color=&quot;orange&quot;)<br>plt.title(&quot;Product Sales&quot;)<br>plt.xlabel(&quot;Products&quot;)<br>plt.ylabel(&quot;Sales ($)&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*qLPVfYE9rJiGRnaEStDi5Q.png" /><figcaption>Task Bar Chart</figcaption></figure><p><strong>Task 4: Histogram</strong></p><pre># Generate a histogram for ages of a group:<br># Ages: [21, 22, 23, 24, 25, 22, 21, 23, 24, 25, 23, 24, 22, 21].</pre><pre>ages = [21, 22, 23, 24, 25, 22, 21, 23, 24, 25, 23, 24, 22, 21]<br><br>plt.hist(ages, bins=5, color=&quot;red&quot;, edgecolor=&quot;black&quot;)<br>plt.title(&quot;Age Distribution&quot;)<br>plt.xlabel(&quot;Age Groups&quot;)<br>plt.ylabel(&quot;Frequency&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*yy99_Ae-7g7zeNPzwBlAhg.png" /><figcaption>Task Histogram</figcaption></figure><p><strong>Task 5: Pie Chart</strong></p><pre># Create a pie chart showing market share percentages of 4 companies:<br># Companies: [&quot;Company A&quot;, &quot;Company B&quot;, &quot;Company C&quot;, &quot;Company D&quot;]<br># Shares: [40, 25, 20, 15]</pre><pre>shares = [40, 25, 20, 15]<br>companies = [&quot;Company A&quot;, &quot;Company B&quot;, &quot;Company C&quot;, &quot;Company D&quot;]<br>colors = [&quot;gold&quot;, &quot;blue&quot;, &quot;green&quot;, &quot;red&quot;]<br><br>plt.pie(shares, labels=companies, colors=colors, autopct=&quot;%1.1f%%&quot;)<br>plt.title(&quot;Market Share&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*47WBciXfqWhQxLFoX288TQ.png" /><figcaption>Task Pie Chart</figcaption></figure><h3>Practice Task Challenges</h3><ol><li>Use real-world data (e.g., from a CSV file) to create at least two visualizations.</li><li>Combine multiple plots into a single figure using plt.subplot.</li></ol><p>Happy Learning!😊.. For any questions or support, feel free to message me on <a href="https://www.linkedin.com/in/saichinmay/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ab16db9d404" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-4-5ab16db9d404">Gen AI Developer Week 1 — Day 4</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gen AI Developer Week 1 — Day 3]]></title>
            <link>https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-3-a8306d26374a?source=rss-8be83b190d9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8306d26374a</guid>
            <category><![CDATA[pandas-dataframe]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sai Chinmay Tripurari]]></dc:creator>
            <pubDate>Mon, 30 Dec 2024 14:25:26 GMT</pubDate>
            <atom:updated>2024-12-30T14:25:26.377Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gen AI Developer Week 1 — Day 3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWEjhNK5O_5zQI0edDGn3g.jpeg" /></figure><p>Welcome to the <strong>“Intro to Pandas”</strong> session in the GenAI Developer Series! Pandas is a powerful Python library for data analysis and manipulation, making it easy to clean, explore, and transform datasets. In this session, you’ll learn the basics of working with <strong>DataFrames</strong> and <strong>Series</strong>, importing and cleaning data, and performing operations like filtering and grouping. Whether you’re new to data science or enhancing your skills, Pandas will empower you to handle data efficiently. Let’s dive in and unlock its potential!</p><p>Let’s first install pandas using the below pip command installation.</p><pre># Install pandas using the below command<br>pip install pandas</pre><p>Now lets import pandas and get started for this day!</p><pre>import pandas as pd</pre><p>Key Concepts</p><p>Creating and Viewing DataFrames — Create a DataFrame from a dictionary</p><pre># Created a dictonary data below<br>data = {<br>    &quot;Name&quot;: [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;],<br>    &quot;Age&quot;: [25, 30, 35],<br>    &quot;Score&quot;: [85, 90, 88]<br>}<br><br>df = pd.DataFrame(data) #DataFrame is like a table with rows and columns<br>print(df)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*kcIlCu39MuYsFNxQ5GgVqg.png" /></figure><pre># View data from Dataframe<br>print(df.head())  # First 5 rows<br>print(df.tail())  # Last 5 rows<br>print(df.info())  # Overview of the DataFrame<br>print(df.describe())  # Summary statistics</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*9i0r_T2P66dR-OwFLbK3Gw.png" /></figure><p>Now we’ll take an example of <a href="https://github.com/saichinmay2000/GenAI-Developer-Notes/blob/master/Day-3/titanic.csv">Titanic Dataset</a> and perform tasks on it.</p><h4>Analyze a Dataset</h4><ol><li>Download a sample dataset, like titanic.csvKaggle Titanic Dataset</li><li>Load the dataset and display its first 5 rows.</li></ol><pre># Read CSV and print the first 5 rows of the file<br>data = pd.read_csv(&#39;titanic.csv&#39;) # Read the CSV File<br>print(data.head()) # First 5 rows</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*08vuB0MiuBN7PIG0btovJg.png" /></figure><h4>Filter Data</h4><p>Filter rows where passengers are older than 30 and survived.</p><pre># Filter the data who survived over 30 years<br>over_30 = data[(data[&quot;Age&quot;] &gt; 30) &amp; (data[&quot;Survived&quot;] == 1)]<br>print(over_30)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*_bwgxpagWnIBfkVQooG-gg.png" /></figure><h4>Add a New Column</h4><p>Add a column to the Titanic dataset indicating whether the fare was “High” (above 30) or “Low” (30 or below).</p><pre># Add a new Column if the fare is above 30 add High else Low <br>data[&quot;Fare_Category&quot;] = [&quot;High&quot; if fare &gt; 30 else &quot;Low&quot; for fare in data[&quot;Fare&quot;]]<br>print(data[[&quot;Fare&quot;, &quot;Fare_Category&quot;]].head())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*Gpy-ZR13Bn7bYZb2Z4rfxg.png" /></figure><h4>Group and Aggregate</h4><p>Group passengers by their embarkation point and find the average fare for each group.</p><pre># Group and aggregate<br>avg_fare_by_embark = data.groupby(&quot;Embarked&quot;)[&quot;Fare&quot;].mean()<br>print(avg_fare_by_embark)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*JK8y-G5BcnvgCoxorS7Naw.png" /></figure><h4>Save Filtered Data</h4><p>Save the rows of passengers who paid a fare greater than 50 to a new CSV file.</p><pre># Saving the filtered data<br>high_fare = data[data[&quot;Fare&quot;] &gt; 50]<br>high_fare.to_csv(&quot;high_fare_passengers.csv&quot;, index=False)</pre><p>Happy Learning!😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8306d26374a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gen-ai-developer-week-1-day-3-a8306d26374a">Gen AI Developer Week 1 — Day 3</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>