<?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 Hasnain Ali on Medium]]></title>
        <description><![CDATA[Stories by Hasnain Ali on Medium]]></description>
        <link>https://medium.com/@hasnainx42?source=rss-c47faae4e5a1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vX0DSg1CRda28Y97xs1PAQ.png</url>
            <title>Stories by Hasnain Ali on Medium</title>
            <link>https://medium.com/@hasnainx42?source=rss-c47faae4e5a1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:56:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hasnainx42/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[Building a Data Science Assistant with Llama 3 and Streamlit]]></title>
            <link>https://hasnainx42.medium.com/building-a-data-science-assistant-with-llama-3-and-streamlit-85df0b57db68?source=rss-c47faae4e5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/85df0b57db68</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Hasnain Ali]]></dc:creator>
            <pubDate>Sat, 03 Aug 2024 11:21:53 GMT</pubDate>
            <atom:updated>2024-08-03T11:21:53.661Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iM-nfa1azqY0NUie4QgnAg.jpeg" /><figcaption>Image: <a href="https://unsplash.com/photos/a-white-robot-with-blue-eyes-and-a-laptop--0xMiYQmk8g">https://unsplash.com/photos/a-white-robot-with-blue-eyes-and-a-laptop--0xMiYQmk8g</a></figcaption></figure><p>Large language models have started to affect all the major fields ranging from healthcare to agriculture and data science is no different. A major part of data scientist’s job is to deeply analyze the data and answer important questions about it. In this article, we will explore how to build a data science assistant using Llama 3 and Streamlit, enabling data scientists to focus on higher-level tasks.</p><h3>Step 1: Setting Up the Environment</h3><p>Create a virtual environment and install the required packages:</p><pre>conda create --name wizard<br>conda activate wizard<br>pip install -r requirements.txt</pre><h3>Step 2: Importing Libraries and Initializing the Model</h3><p>Import necessary libraries and initialize the Llama 3 model using the Together AI and Groq APIs:</p><pre>import streamlit as st<br>import pandas as pd<br>import pandasai<br>from pandasai import Agent<br>from langchain_groq import ChatGroq<br>from pandasai.responses.streamlit_response import StreamlitResponse<br>import io, json, os<br>from PIL import Image<br>from together import Together<br>from dotenv import load_dotenv<br><br>load_dotenv()<br>client = Together(api_key=os.environ.get(&#39;TOGETHER_API_KEY&#39;, &quot;&quot;))<br>model = ChatGroq(model_name=&#39;llama3-70b-8192&#39;, api_key=os.environ.get(&#39;GROQ_API_KEY&#39;, &quot;&quot;))</pre><h3>Step 3: Defining the System Prompt and Streamlit App</h3><p>Define the system prompt for the Llama 3 model and create the Streamlit app:</p><pre>SYSTEM_PROMPT_TOGETHER = &#39;&#39;&#39;You are an AI Query analyzer. Analyze given user query that whether it is related to any CSV, data or charts. If yes then return {&quot;status&quot;:True} else then make a reply for the query as polite and helpful member and also state &quot;I am a Data Wizard and I can only help you with Data Science task&quot; return response example as {&quot;status&quot;:false, &quot;message&quot;:&quot;How are you?&quot;}. If the user query contains Hi or greeting phrases then dont return status as False with relevant reply. The data contains following columns &#39;&#39;&#39;</pre><pre>st.title(&quot;DataWizard: Your DataScience Assistant&quot;)</pre><h3>Step 4: Creating the Chat Interface</h3><p>Create the chat interface using Streamlit’s expander and text_input components:</p><pre>with st.expander(&quot;Chat&quot;, expanded=True):<br>    prompt = st.text_input(&quot;Ask questions about your data:&quot;, value=&quot;&quot;, key=&quot;prompt_input&quot;, on_change=None)<br>    st.button(&quot;Generate&quot;, on_click=generate_response)</pre><h3>Step 5: Implementing the Response Generation</h3><p>Implement the response generation function using the Llama 3 model and pandasai agent:</p><pre>def generate_response():<br>    prompt = st.session_state.prompt_input<br>    if prompt:<br>        # Update chat history with the user&#39;s prompt<br>        st.session_state.chat_history.insert(0, {&quot;role&quot;: &quot;user&quot;, &quot;text&quot;: prompt})<br>        with st.spinner(&quot;Generating response...&quot;):<br>            try:<br>                # Analyze the user query and generate a response<br>                is_question_relevant = client.chat.completions.create(<br>                    model=&quot;mistralai/Mixtral-8x7B-Instruct-v0.1&quot;,<br>                    messages=[<br>                        {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: SYSTEM_PROMPT_TOGETHER + str(list(data.columns))},<br>                        {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}<br>                    ],<br>                    response_format={&quot;type&quot;: &quot;json_object&quot;}<br>                )<br>                # Process the response and update the chat history<br>                # ...<br>            except Exception as e:<br>                st.error(f&quot;Failed to generate response: {e}&quot;)</pre><h3>Step 6: Running the Application</h3><p>Run the application using Streamlit:</p><pre>streamlit run streamlit_app.py</pre><p>This will start the DataWizard application, allowing users to interact with the Llama 3 model and pandasai agent for data science tasks.</p><p>I developed this project as a part of <a href="https://lablab.ai/event/llama-3-ai-hackathon">Llama 3 Hackathon</a> by lablab.ai.<br>Here is the Github repository with complete code: <a href="https://github.com/hasnain3142/DataWizard">https://github.com/hasnain3142/DataWizard</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85df0b57db68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Traditional Machine Learning Approaches: Machine Learning apart from Deep Learning]]></title>
            <link>https://hasnainx42.medium.com/traditional-machine-learning-approaches-machine-learning-apart-from-deep-learning-de704127947c?source=rss-c47faae4e5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/de704127947c</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Hasnain Ali]]></dc:creator>
            <pubDate>Fri, 28 Jun 2024 14:32:47 GMT</pubDate>
            <atom:updated>2024-06-28T14:32:47.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctgnxhZaf_vulmdum1SN3g.jpeg" /><figcaption>Source: <a href="https://unsplash.com/photos/a-computer-on-a-desk-BTYss0CHM2w">https://unsplash.com/photos/a-computer-on-a-desk-BTYss0CHM2w</a></figcaption></figure><p>Machine learning has come a long way over the past few decades. These days, deep learning often gets all the attention, but before the big neural networks and data-driven algorithms, there were traditional machine learning methods that laid the groundwork for what we know today. These old-school ML algorithms were really important in moving the field forward, and they still play a big role in lots of different applications. In this article, we’ll dive into the history of traditional machine learning approaches, how they’ve impacted the field, and why they’re still relevant even in the age of deep learning.</p><h3>The Dawn of Machine Learning</h3><p>Before deep learning took over, the world of machine learning was dominated by a bunch of different classical algorithms. These methods relied heavily on statistics and math models. They were simpler compared to today’s deep learning models, but they were groundbreaking for their time.</p><h4>Classical Machine Learning Algorithms</h4><ul><li>Linear Regression</li><li>Logistic Regression</li><li>Decision Trees</li><li>Support Vector Machines (SVM)</li><li>k-Nearest Neighbors (k-NN)</li><li>Naive Bayes</li></ul><h3>The Advent of Deep Learning</h3><p>When deep learning took off in the 2010s, with advancements in neural networks and more computing power, a lot of the traditional ML algorithms started to lose their shine. Deep learning’s ability to process huge amounts of data and automatically extract features made it the go-to choice for complex tasks like image recognition, speech recognition, natural language processing, and self-driving cars.</p><p>Even though deep learning is dominating the scene, traditional machine learning algorithms haven’t become obsolete. They still have a lot to offer.<br>Algorithms like linear regression and decision trees provide clear, understandable models, which is really important in fields like healthcare and finance where you need to explain how the model works. Furthermore, traditional ML methods are often less computationally intensive than deep learning models. They can be trained and deployed quickly, making them a good fit for applications with limited resources or smaller datasets. In addition to this, combining classical ML algorithms with deep learning techniques can lead to better results. For example, you can use decision trees for feature engineering before feeding the data into a neural network.</p><p>While deep learning has transformed machine learning, the old-school algorithms are still valuable tools in the ML toolkit. Their simplicity, interpretability, and efficiency ensure they’ll keep playing an important role in various applications. By understanding and using these classical approaches alongside modern deep learning, we can build even more robust and effective solutions in the ever-evolving world of machine learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de704127947c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI/ML Everywhere: A Beginner’s Guide]]></title>
            <link>https://hasnainx42.medium.com/ai-ml-everywhere-a-beginners-guide-f997a7e31b7f?source=rss-c47faae4e5a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f997a7e31b7f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Hasnain Ali]]></dc:creator>
            <pubDate>Sun, 12 May 2024 11:11:29 GMT</pubDate>
            <atom:updated>2024-05-12T11:11:29.057Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3zm0xMSCBi-fB6Re6FY1Q.jpeg" /><figcaption>Source:<a href="https://unsplash.com/s/photos/ai-and-machine-learning"> https://unsplash.com/s/photos/ai-and-machine-learning</a></figcaption></figure><p>Let’s take a break from the buzz around LLMs and Diffusion Models and refocus our attention on the fundamental principles that have made this remarkable innovation possible. AI/ML tools have never been more accessible, as people from all walks of life are utilizing these tools. These technologies, which would have felt like magic only a few decades ago, have become so common and unsurprising nowadays. This fact encourages us to take a step back and analyze how we got here in the first place and what lies ahead in the future.</p><p>The term<strong><em> “Artificial Intelligence” </em></strong>was coined in 1956 by John McCarthy for machines <strong><em>“capable of doing tasks that require human intelligence”.</em></strong> One of these first AI programs was <em>Expert Systems </em>which tried to emulate the decision-making process of humans. These systems quite literally used if-then rules to make decisions. Yes, it’s not just a meme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*RX22oT_XNh9jKpWz7MQDhw.jpeg" /><figcaption><a href="https://www.reddit.com/r/ProgrammerHumor/comments/15t7vie/youknowitstrue/">https://www.reddit.com/r/ProgrammerHumor/comments/15t7vie/youknowitstrue/</a></figcaption></figure><p>So now if you want the machine to do some task, you code it. This is the traditional programming paradigm. But coding is not easy, right :) For some tasks, you can program these rules but some tasks are complex and it’s impossible to figure out all the possible rules. Thus, we want the machines to do these intelligent tasks without being explicitly programmed. But from where do we get these rules then? As we want the machines to do the tasks that we can do, then why not make them learn like we do? Humans learn from experience, when a human child sees a picture of a cat, it can learn to identify all the cats in the world. This idea gave birth to “<strong><em>Machine Learning” — a subfield of AI that enables computers to learn from data. </em></strong>After showing a large number of labeled images of a cat to a computer, it can identify the set of patterns and learn the rules that enables it to start identifying cat images. This type of algorithm was known as <strong><em>Perceptron</em></strong> developed by Frank Rosenblatt in 1957 which was designed to mimic the functioning of biological neuron. This marked the beginning of a long and fruitful journey in the field of machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6-Qgcz6JIH-kIS3y4VoRQ.png" /><figcaption>Source: <a href="https://www.analyticsvidhya.com/blog/2021/10/perceptron-building-block-of-artificial-neural-network/">https://www.analyticsvidhya.com/blog/2021/10/perceptron-building-block-of-artificial-neural-network/</a></figcaption></figure><p>After the Perceptron, many other important machine learning algorithms were developed, and all of them have contributed to the growth of the machine learning field which we see today. Here is a list of the most significant breakthroughs.</p><p>1960s: k-Nearest Neighbors (kNN)</p><p>1967: Support Vector Machine (SVM)</p><p>1970s: The Decision Tree Algorithm</p><p>1980s: The Backpropagation Algorithm (used for training neural networks)</p><p>1990: Kernel Methods</p><p>1995: Random Forests</p><p>1996: Deep Belief Networks</p><p>1997: Long Short-Term Memory (LSTM)</p><p>1999: AdaBoost</p><p>2012: The Convolutional Neural Network (AlexNet)</p><p>2014: The Generative Adversarial Network (GAN)</p><p>2014: Word2Vec</p><p>2015: ResNet (Residual Neural Network)</p><p>2016: The Recurrent Neural Network (RNN)</p><p>2016: AlphaGo (Reinforcement Learning)</p><p>2017: The Transformer Model</p><p>2018: Bidirectional Encoder Representations from Transformers (BERT)</p><p>I have only included major breakthroughs up to 2018 because after that the AI space boomed and is still a booming industry. The list above is extensive yet still not exhaustive because AI/ML is a really hot research topic and so many amazing research papers are published every week. If you want to stay up to date with the recent trends in AI/ML, I recommend you to stay active on X/Twitter and make sure to follow these accounts,</p><p><strong>Researchers and Academics</strong></p><ol><li><strong>Andrew Ng</strong> (@AndrewYNg) — AI pioneer and founder of AI Fund</li><li><strong>Yann LeCun</strong> (@ylecun) — Director of AI Research at Facebook and Turing Award winner</li><li><strong>Fei-Fei Li</strong> (@drfeifei) — Director of the Stanford AI Lab and former Chief Scientist of AI at Google Cloud</li><li><strong>Ian Goodfellow</strong> (@goodfellow_ian) — Research Scientist at Google Brain and GAN inventor</li><li><strong>Sebastian Thrun</strong> (@SebastianThrun) — Founder of Udacity and AI researcher</li><li><strong>Geoffrey Hinton</strong> (@geoffreyhinton) — Turing Award winner and AI pioneer</li><li><strong>Demis Hassabis</strong> (@demishassabis) — Co-founder and CEO of DeepMind</li><li><strong>David Silver</strong> (@DavidSilverUK) — Co-founder and CTO of DeepMind</li></ol><p><strong>AI/ML Influencers and Bloggers</strong></p><ol><li><strong>KDNuggets</strong> (@kdnuggets) — Popular AI/ML blog and news site</li><li><strong>AI Alignment</strong> (@AI_Alignment) — AI safety and ethics discussions</li><li><strong>AI Impacts</strong> (@AI_Impacts) — AI safety and ethics discussions</li><li><strong>Machine Learning Mastery</strong> (@MachineLearnin) — AI/ML tutorials and guides</li><li><strong>AI in Industry</strong> (@AI_in_Industry) — AI applications and industry trends</li><li><strong>AI Business News</strong> (@AIBusinessNews) — AI business news and trends</li><li><strong>AI Trends</strong> (@AITrends) — AI trends and insights</li><li><strong>The AI Alignment Podcast</strong> (@AI_Alignment_P) — AI safety and ethics discussions</li></ol><p><strong>AI/ML Companies and Organizations</strong></p><ol><li><strong>Google AI</strong> (@GoogleAI) — Official Google AI Twitter account</li><li><strong>DeepMind</strong> (@DeepMindAI) — AI research organization</li><li><strong>Facebook AI</strong> (@FacebookAI) — Official Facebook AI Twitter account</li><li><strong>Microsoft AI</strong> (@MicrosoftAI) — Official Microsoft AI Twitter account</li><li><strong>NVIDIA AI</strong> (@NVIDIAAI) — Official NVIDIA AI Twitter account</li><li><strong>Amazon AI</strong> (@AmazonAI) — Official Amazon AI Twitter account</li><li><strong>IBM Watson</strong> (@IBMWatson) — Official IBM Watson Twitter account</li><li><strong>AI for Everyone</strong> (@AI_for_Everyone) — AI education and awareness</li></ol><p><strong>Conferences and Events</strong></p><ol><li><strong>NeurIPS</strong> (@NeurIPSConf) — Conference on Neural Information Processing Systems</li><li><strong>ICML</strong> (@ICMLconf) — International Conference on Machine Learning</li><li><strong>ICCV</strong> (@ICCVconf) — International Conference on Computer Vision</li><li><strong>AAAI</strong> (@AAAIConference) — Association for the Advancement of Artificial Intelligence</li><li><strong>AI Summit</strong> (@AI_Summit) — AI conference and event</li></ol><p>Remember to also follow AI/ML-related hashtags, such as<br>#AI, #MachineLearning, #DeepLearning, #NLP, and #ComputerVision,<br>to stay updated with the latest news and discussions in the field.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f997a7e31b7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>