<?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 Sahar Tosif Jamal on Medium]]></title>
        <description><![CDATA[Stories by Sahar Tosif Jamal on Medium]]></description>
        <link>https://medium.com/@sahar-tj?source=rss-de2e6ec15fcf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6OYug2JJesedwDyidsTDWw.jpeg</url>
            <title>Stories by Sahar Tosif Jamal on Medium</title>
            <link>https://medium.com/@sahar-tj?source=rss-de2e6ec15fcf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 09:47:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sahar-tj/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[Not Every AI Agent Needs an LLM: Building a Multi-Agent Travel Planner with LangGraph]]></title>
            <link>https://sahar-tj.medium.com/not-every-ai-agent-needs-an-llm-building-a-multi-agent-travel-planner-with-langgraph-23ff9a88cfb5?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/23ff9a88cfb5</guid>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[langgraph]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 03:44:30 GMT</pubDate>
            <atom:updated>2026-11-02T03:44:30.976Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Exploring agentic AI, multi-agent orchestration, external tool integration, state management and the architecture behind an intelligent travel-planning application.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ALZJJhiy6XJ2MeqaG2ZAIQ.png" /></figure><p>Planning a holiday sounds exciting. Until you get to the planning part.</p><p>The destination is picked, the dates are roughly settled, maybe there’s even a budget. Then comes the not-so-glamorous part: searching for flights, comparing hotels, working out which attractions are worth the trip, spreading activities across days, and making sure the whole thing actually fits together.</p><p>Plenty of websites help with individual pieces. Bringing them together is still manual work.</p><p>That got me thinking: what if an AI application could take one travel request and organise all the moving pieces into a single plan? Not a paragraph of generic recommendations, but a plan built from retrieved information, processed and structured into an itinerary.</p><p>Around the same time, I was exploring agentic AI and wanted to see how multiple AI agents could work together instead of leaning on one LLM for everything. A travel planner seemed like a practical place to try it.</p><p>And so, <strong>Itiner-AI</strong> was born.</p><p>Type a request, such as <em>“Plan a complete 7 days Japan trip from Australia under AUD 6000”</em>, and a team of specialised agents works through flights, hotels, itinerary and final presentation.</p><p><strong>The stack:</strong> FastAPI, LangGraph, LangChain, Groq (gpt-oss-120b), PostgreSQL, Tavily and AviationStack.</p><p><strong>Full code:</strong> <a href="https://github.com/Sahar-TJ/Itiner-AI">github.com/Sahar-TJ/Itiner-AI</a></p><p>Want to skip ahead? Try the live demo: <a href="https://itiner-ai-a-multi-agent-travel-planner.onrender.com/">Launch Itiner-AI</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3XeWjHmeJ8W9E4xgQnEdA.png" /></figure><h3>Why one prompt isn’t enough</h3><p>Take this request:</p><blockquote>“Plan a 7-day trip to Japan from Australia, including flights, accommodation, sightseeing and an estimated budget.”</blockquote><p>A traditional LLM application would answer from what it learned in training. The result might read well, but it wouldn’t reflect current flights or available hotels. The request also hides several separate jobs:</p><ul><li>understanding what the traveller wants</li><li>finding flight information</li><li>researching accommodation</li><li>combining everything into a practical itinerary</li><li>presenting it clearly</li></ul><p>Each job needs a different data source and a different kind of processing. Cramming them into one giant prompt works for demos, but it is hard to debug. When the output is wrong, there is no telling which part failed.</p><p>This is where <strong>agentic AI</strong> comes in. An agent is a component that works toward a goal, using an LLM, external tools, or both. A <strong>multi-agent system</strong> splits a big task across specialists, each with a defined responsibility. That gives:</p><ul><li><strong>Separation of concerns:</strong> each agent does one thing</li><li><strong>Easier maintenance:</strong> the flight integration can change without touching itinerary logic</li><li><strong>Better tool use:</strong> each agent talks to the API it needs</li><li><strong>Room to grow:</strong> a restaurant or weather agent could slot in later</li></ul><p>More agents don’t automatically mean a better system, though. For a simple task, one LLM with a couple of tools is often enough. The goal is to divide a complex task into manageable responsibilities, not to maximise the agent count.</p><h3>LangGraph: the traffic controller</h3><p>Specialists need coordination. Which one goes first? What does each receive? Where do results go? Without orchestration, the agents are just separate functions that never talk to each other.</p><p><strong>LangGraph</strong> handles this by modelling the application as a graph with three parts:</p><ul><li><strong>Nodes:</strong> units of work, such as a Python function, an LLM call or a tool call</li><li><strong>Edges:</strong> the connections that decide what runs next</li><li><strong>State:</strong> a shared data structure that carries information through the workflow</li></ul><p>In Itiner-AI, the state looks like this:</p><pre>class TravelState(TypedDict):<br>    messages: Annotated[list[AnyMessage], operator.add]<br>    user_query: str<br>    flight_results: str<br>    hotel_results: str<br>    itinerary: str<br>    llm_calls: int</pre><p>user_query holds the original request, and each stage fills in its own field. The messages field has a small trick worth knowing. operator.add is a <strong>reducer</strong>, which tells LangGraph to append new messages instead of replacing the list. Fields without a reducer, such as flight_results, are simply overwritten.</p><p>State is also the contract between stages. The itinerary node doesn’t know or care how the flights were fetched. It only knows that flight_results exists.</p><p>With state defined, the graph is assembled node by node:</p><pre>graph = StateGraph(TravelState)<br><br>graph.add_node(&quot;flight_agent&quot;, flight_agent)<br>graph.add_node(&quot;hotel_agent&quot;, hotel_agent)<br>graph.add_node(&quot;itinerary_agent&quot;, itinerary_agent)<br>graph.add_node(&quot;final_agent&quot;, final_agent)<br><br>graph.add_edge(START, &quot;flight_agent&quot;)<br>graph.add_edge(&quot;flight_agent&quot;, &quot;hotel_agent&quot;)<br>graph.add_edge(&quot;hotel_agent&quot;, &quot;itinerary_agent&quot;)<br>graph.add_edge(&quot;itinerary_agent&quot;, &quot;final_agent&quot;)<br>graph.add_edge(&quot;final_agent&quot;, END)</pre><p>That reads almost like the diagram:</p><pre>START → Flight → Hotel → Itinerary → Final → END.</pre><p>A sequential flow suits this project because the itinerary depends on what the earlier stages find. LangGraph also supports conditional routing, parallel branches and loops for more complex cases.</p><h3>Meet the four agents</h3><p>Here is the surprise: only two of the four agents use a language model.</p><ul><li><strong>Flight agent:</strong> calls the AviationStack API. No LLM.</li><li><strong>Hotel agent:</strong> runs a Tavily web search. No LLM.</li><li><strong>Itinerary agent:</strong> uses the LLM to combine everything into a plan.</li><li><strong>Final agent:</strong> uses the LLM to format the response.</li></ul><p>That is deliberate. Retrieving data is a job for plain code, which is faster, cheaper and more predictable than asking a model to do it. The model earns its place where the job is synthesis.</p><blockquote>Not every node in an agentic workflow needs to be an LLM-powered agent.</blockquote><p>Here, “agent” means a node with one defined responsibility. Strictly speaking, this is a fixed workflow rather than a fully autonomous agent, which keeps it predictable. The next few sections take the agents one at a time.</p><h4>The flight agent: where plain English meets airport codes</h4><p>The flight API doesn’t understand “Japan trip from Australia”. It wants IATA airport codes, such as SYD and NRT. The job is to extract a departure and destination, resolve them to codes, call AviationStack and return the results. The inputs and outputs are predictable, so a deterministic resolver fits better than a model: it is easier to test and never hallucinates an airport code.</p><p>So the flight tool uses a cascade of fallbacks, where each layer runs only if the previous one fails. First, regular expressions extract the route from common phrasings like “from X to Y”. Then each location is resolved:</p><pre>def resolve_location_to_iata(location: str):<br>    raw_location = location.strip()<br><br>    # Is it already an airport code?<br>    if re.fullmatch(r&quot;[A-Za-z]{3}&quot;, raw_location):<br>        code = raw_location.upper()<br>        if code in AIRPORTS:<br>            return code<br><br>    location_clean = clean_text(raw_location)<br><br>    # Is it a well-known city?<br>    if location_clean in CITY_MAIN_AIRPORT:<br>        return CITY_MAIN_AIRPORT[location_clean]<br><br>    # Is it a country?<br>    country_code = country_name_to_code(location_clean)<br>    if country_code:<br>        return get_best_airport_for_country(country_code)</pre><p>A hand-curated map handles famous cities and countries (Tokyo becomes NRT), while pycountry and airportsdata cover the long tail. If the user names only a destination, the origin falls back to a configurable default.</p><p>The result is that “Japan”, “Tokyo”, “Delhi” and “SYD” all work. The tool then calls the API and formats airline, flight number, airports, times and status into readable text.</p><p>One honest limitation: AviationStack returns live flight status and schedules, not ticket prices, so the application has no fare data, and the prompt tells the model not to invent any.</p><h4>The hotel agent: letting search do the searching</h4><p>Flights come from a structured API. Hotels come from web search through Tavily, a search API built for AI applications. Tavily performs the search, so there is no need for an LLM just to start one. The node simply asks for the best hotels for whatever the user requested:</p><pre>def hotel_agent(state: TravelState):<br>    query = f&quot;Best hotels for {state[&#39;user_query&#39;]}&quot;<br>    hotel_results = tavily_search(query)<br><br>    return {<br>        &quot;hotel_results&quot;: hotel_results,<br>        &quot;messages&quot;: [AIMessage(content=&quot;Hotel information fetched.&quot;)],<br>    }</pre><p>The wrapper keeps the top five results and trims each snippet to 300 characters, cutting at a word boundary so nothing ends mid-word. That keeps the downstream prompt compact.</p><p>A dedicated API returns data in a predictable shape, while web search returns pages that need interpreting. Both are useful, and the right choice depends on the information needed. Note that this is hotel <em>discovery</em>, not booking: no availability or live prices.</p><h4>The itinerary agent: where the LLM earns its place</h4><p>With flights and hotels in the state, the model gets to work. It receives the original request, the flight results and the hotel research in one prompt:</p><pre>def itinerary_agent(state: TravelState):<br>    prompt = f&quot;&quot;&quot;<br>Create a complete travel itinerary.<br><br>User Query:<br>{state[&#39;user_query&#39;]}<br><br>Flight Results:<br>{state[&#39;flight_results&#39;]}<br><br>Hotel Results:<br>{state[&#39;hotel_results&#39;]}<br><br>Make the itinerary practical, budget-aware, and easy to follow.<br>&quot;&quot;&quot;<br><br>    response = llm.invoke([<br>        SystemMessage(content=&quot;You are an expert travel planner.&quot;),<br>        HumanMessage(content=prompt)<br>    ])<br><br>    return {<br>        &quot;itinerary&quot;: response.content,<br>        &quot;messages&quot;: [response],<br>        &quot;llm_calls&quot;: state.get(&quot;llm_calls&quot;, 0) + 1<br>    }</pre><p>Tools retrieve information, and the model interprets and organises it. Because the prompt carries real retrieved data, the answer is <strong>grounded</strong> in it instead of being generated purely from memory.</p><h4>The final agent: shaping what the user sees</h4><p>The last agent has a different job: presentation. It takes everything and produces a consistent six-part response: Trip Summary, Flight Information, Hotel Suggestions, Day-by-Day Itinerary, Estimated Budget and Final Recommendations. Separating “build the plan” from “present the plan” makes the output structure much easier to control.</p><h3><strong>Where to draw the line</strong></h3><p>It’s easy to fall into the trap of making every component LLM-powered, but not every task needs reasoning, interpretation or generated language.</p><p>A step belongs to plain code when its input is predictable, it has one correct answer, and an ordinary test can verify it. Airport lookups and API calls pass that test. A step belongs to a model when it needs interpretation or synthesis. Turning flights, hotels and a budget into a day-by-day plan has no single correct answer, which is exactly where a language model helps.</p><p>It isn’t about using as much AI as possible. It’s about using the right tool for each part of the problem.</p><h3>Keeping the model honest</h3><p>Language models write confidently whether or not they have the facts. Ask for a budget when the data has no prices, and a plausible-sounding number appears anyway.</p><p>So the final prompt sets explicit boundaries:</p><pre>Important:<br>- Be clear and practical.<br>- Mention that live flight API may not provide ticket prices <br>  if pricing is unavailable.<br>- Keep the response concise. Do not invent flight prices or hotel prices.<br>- Clearly label estimates and identify missing information. <br>  Respect the user&#39;s requested budget.</pre><p>The call also caps output with max_tokens=1200.</p><p>A caveat: prompt instructions reduce the risk but don’t guarantee accuracy. A production version would add stronger validation, structured outputs and source attribution.</p><h3>Remembering conversations</h3><p>By default, a workflow forgets everything once it finishes. LangGraph supports <strong>checkpointing</strong>, which saves state as the graph runs. Itiner-AI stores checkpoints in PostgreSQL:</p><pre>checkpointer = PostgresSaver(_conn)<br>checkpointer.setup()<br><br>travel_graph = graph.compile(checkpointer=checkpointer)</pre><p>Each session gets a unique thread_id, which tells LangGraph which saved state belongs to which conversation:</p><pre>config = {&quot;configurable&quot;: {&quot;thread_id&quot;: thread_id}}<br>result = travel_graph.invoke({...}, config=config)</pre><p>On the frontend, the ID is kept in the browser’s local storage and sent with every request, so a returning browser picks up the same thread.</p><p>Saved workflow state isn’t the same as conversational memory, though. Right now each agent works from the latest request, so a follow-up like <em>“make it cheaper”</em> doesn’t yet refine the previous plan. Checkpointing is the foundation for that, not the finished feature.</p><h3>From graph to browser</h3><p>An AI workflow still needs a front door. <strong>FastAPI</strong> provides it, with a small, clean surface: GET / serves the page, and POST /api/travel runs the workflow. A Pydantic model validates the incoming request:</p><pre>class TravelRequest(BaseModel):<br>    message: str<br>    thread_id: str | None = None</pre><pre>@app.post(&quot;/api/travel&quot;)<br>async def travel_planner(request_data: TravelRequest):<br>    user_message = request_data.message.strip()<br>    if not user_message:<br>       return JSONResponse(status_code=400,<br>           content={&quot;success&quot;: False, &quot;error&quot;: &quot;Message cannot be empty.&quot;})<br><br>    result = run_travel_agent(<br>        user_input=user_message,<br>        thread_id=request_data.thread_id<br>    )<br>    return JSONResponse(content={&quot;success&quot;: True, &quot;answer&quot;: <br>           result[&quot;answer&quot;], ...})</pre><p>The frontend is plain HTML, CSS and JavaScript, served with Jinja2. It sends the request with the Fetch API, renders the Markdown response with the marked library, and exports a PDF in the browser with html2pdf. Ctrl+Enter works as a shortcut for the button.</p><p>FastAPI handles requests and responses, while LangGraph manages the processing steps, so the two concerns never tangle.</p><h3>One request, start to finish</h3><p>Here is what happens when someone clicks <strong>Generate Plan</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRa3bQvcDXu31EXd0JLG3g.png" /></figure><p>Seven technologies, each with one clear responsibility. That is the real lesson: an AI application is much more than an LLM and a prompt. It is workflow design, external services, state management and an application layer.</p><h3>What building it taught</h3><p><strong>External APIs fail.</strong> Requests time out, fields go missing, formats differ. The flight tool handles failures explicitly instead of assuming success:</p><pre>try:<br>    response = requests.get(BASE_URL, params=params, timeout=30)<br>    data = response.json()<br>except requests.exceptions.RequestException as e:<br>    return f&quot;Flight API request failed: {e}&quot;<br>except ValueError:<br>    return &quot;Flight API returned invalid JSON.&quot;</pre><p><strong>Users don’t follow formats.</strong> Nobody types airport codes. Input handling stays important even when an LLM is in the architecture.</p><p><strong>State beats loose variables.</strong> A shared, typed state keeps each stage’s output organised without passing a dozen variables between functions.</p><p><strong>Sounding right isn’t being right.</strong> For anything involving prices and schedules, the model needs boundaries and honest data.</p><h3>What could come next</h3><ul><li><strong>Conditional routing:</strong> decide whether more research is needed, or ask a clarifying question when a request is vague</li><li><strong>Parallel execution:</strong> flight and hotel lookups don’t depend on each other and could run side by side</li><li><strong>Pricing and booking APIs:</strong> real fares and hotel availability in place of status data and search results</li><li><strong>Real conversational memory:</strong> use saved thread history so follow-ups refine an existing plan</li><li><strong>Stronger validation:</strong> structured outputs that check dates, budgets and clearly labelled estimates</li><li><strong>Observability:</strong> logging node timings, API failures and token usage</li></ul><h4>Try it yourself</h4><p>Itiner-AI is deployed as a Docker image on Render, so there’s nothing to install. Open the app, type a travel request or tap one of the quick prompts, and watch the agents build a plan.</p><p><a href="https://itiner-ai-a-multi-agent-travel-planner.onrender.com/">Launch Itiner-AI</a></p><p>A few things to look for:</p><ul><li>The plan arrives in six sections, from trip summary to final recommendations.</li><li>Flight details are live status data, so you won’t see invented ticket prices.</li><li>The result can be copied or downloaded as a PDF.</li></ul><p>The demo runs on free-tier APIs, so it may occasionally be slow to wake up or hit a usage limit. If that happens, the <a href="https://github.com/Sahar-TJ/Itiner-AI">GitHub repo</a> has setup steps to run it yourself with your own keys.</p><h3>Final thoughts</h3><p>Building Itiner-AI reinforced an idea that is easy to overlook when working with LLMs: <strong>adding more AI doesn’t necessarily make an application better.</strong></p><p>Not every task needs a language model. Some problems are better handled with straightforward Python functions, structured API calls and deterministic logic. Others benefit from an LLM’s ability to interpret information, bring different sources together and generate meaningful responses.</p><p>The interesting part is knowing where each approach fits.</p><p>In Itiner-AI, flight and hotel information is retrieved through conventional code and external services, while LLMs handle itinerary generation and response formatting. LangGraph brings these components together, manages the shared state and controls how information moves through the workflow.</p><p>It’s a relatively simple sequential architecture, but it demonstrates an important principle: useful AI applications are built around the model, not just with the model.</p><p>There is still plenty of room to improve the application, from parallel execution and better data validation to richer conversational memory and more reliable pricing information. But that is part of what makes building these systems interesting.</p><p>What started as an experiment with agentic AI became an opportunity to explore the engineering behind it: breaking down tasks, choosing the right tools, managing state and connecting everything into an application people can actually use.</p><p>And perhaps the biggest takeaway is this:</p><blockquote><strong>The goal isn’t to make every component intelligent. It’s to design a system where every component does its job well.</strong></blockquote><h3><strong>Let’s Plan the Next Route Together</strong></h3><p>Agents may handle the flights and hotels, but the best ideas still come from conversations. If you’d like to swap thoughts on agentic AI, data and building things that actually work,</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23ff9a88cfb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Echo of the Algorithm: Did Human Conversation Just Get ‘GPTified’?]]></title>
            <link>https://sahar-tj.medium.com/the-echo-of-the-algorithm-did-human-conversation-just-get-gptified-1d76553d6da0?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d76553d6da0</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[linguistics]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 09:21:31 GMT</pubDate>
            <atom:updated>2025-11-26T09:21:31.929Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CUkrZGwU9aU6JuUsxwu1Ig.jpeg" /><figcaption>Source: Leonardo</figcaption></figure><p>Have you ever listened to a perfectly polite, empathetic response and felt something was off? The words are right, the grammar flawless, the tone balanced and yet somehow it feels hollow, almost mechanical. Increasingly, our everyday conversations carry an uncanny resonance: they sound less like us, and more like the polished cadence of a Large Language Model.</p><p>This isn’t just a funny observation anymore. We are in a subtle, fascinating, and perhaps unsettling feedback loop:</p><ol><li><strong>AI learns from us:</strong> LLMs digest billions of human conversations to become fluent.</li><li><strong>We learn from AI:</strong> We use LLMs daily for drafting, summarizing, and even emotional processing.</li></ol><p>The result? Phrases, sentence structures, and even a certain <em>generic professional empathy</em> are leaking from AI output back into human speech. We’re seeing the subconscious “GPT-ification” of our own language.</p><blockquote><em>Every time we polish our words to sound more like AI, we train ourselves out of sounding human.</em></blockquote><h3>The Uncanny Valley of Human Speech</h3><p>Sometimes human speech now triggers what feels like a “bot alert.” A response can sound flawlessly empathetic yet strangely empty, as if rehearsed. Phrases like <em>“It’s natural to feel the way you are feeling”</em> acknowledge emotions, but with such measured cadence and generalized reassurance that they feel more like outputs from a Large Language Model than spontaneous human dialogue.</p><p>The unsettling part is these moments aren’t coming from machines. They’re coming from us</p><p>This raises a critical question: Are we, through our pervasive interaction with AI, subtly and subconsciously “GPT-ifying” our own language? The relationship between humans and AI has always been a fascinating mirror, but perhaps now, the reflection is starting to speak back to us in our own voice, albeit a slightly more polished, generalized, and <em>statistically probable</em> one.</p><h3>The Algorithm’s Echo: How LLMs Shape Our Speech</h3><p>To understand why human conversation might be adopting an LLM cadence, we must first understand the fundamental nature of these models:</p><ol><li><strong>Statistical Plausibility over Genuine Intent:</strong> LLMs are, at their core, sophisticated pattern matchers. They predict the most probable next word based on billions of examples. This leads to outputs that are fluent, grammatically robust, and often highly generalized. They excel at producing the “average” or “most common” response to any given prompt.</li><li><strong>The RLHF Polishing Effect:</strong> Reinforcement Learning from Human Feedback (RLHF) fine-tunes models to be helpful, harmless, and universally agreeable. This eliminates controversial statements, strong opinions, and unique stylistic choices, pushing the output towards a blandly competent neutrality.</li><li><strong>Ubiquitous Exposure:</strong> We are constantly interacting with LLMs. We use them to draft emails, summarize documents, brainstorm ideas, and even for emotional processing. Each interaction subtly reinforces a particular mode of communication: clear, concise, logically structured, and devoid of ambiguity or strong personal voice.</li></ol><p>These characteristics, designed to make LLMs effective tools, are now starting to manifest in human-to-human interactions. We internalize the patterns, the safest phrases, and the most universally acceptable modes of expression.</p><h4>The Linguistic Footprints of the Bot: What to Listen For</h4><p>Several linguistic features, prevalent in LLM output, are increasingly audible in human speech:</p><ul><li><strong>The Empathetic Boilerplate:</strong> Phrases like “It’s natural to feel the way you are feeling,” “I understand your perspective,” or “It’s important to consider…” are classic LLM staples. They acknowledge emotions or situations without truly engaging with their specific, often messy, details. They offer surface-level validation without depth.</li><li><strong>Over-Qualifiers and Formal Transitions:</strong> The use of phrases such as “It is worth noting,” “Furthermore,” “In conclusion,” or “From my perspective,” which while technically correct, can make informal discourse sound overly formal and stiff. LLMs use these to establish authority and structure; we may adopt them to appear more articulate.</li><li><strong>Neutralized Tone and Vocabulary:</strong> The absence of slang, unique idiomatic expressions, regionalisms, or strongly opinionated language. LLMs are trained to be universally intelligible, leading to a flattening of linguistic diversity. When we aim for maximum clarity and minimum offense, we risk sounding generic.</li><li><strong>Logical, Step-by-Step Structuring:</strong> The tendency to break down complex ideas into numbered lists or bullet points, even in spontaneous conversation. While useful for clarity, it can sometimes feel overly didactic and less organic than typical human dialogue.</li></ul><blockquote><em>Language shaped by AI flows smoother, but may lose the river’s bends that make it wild and alive!</em></blockquote><h3>The Socio-Cultural Implications: Are We Losing Our Voice?</h3><p>If our conversations keep drifting toward polished, neutral, “safe” language, in other words the “GPT-ification” of human language what do we lose in the process?</p><ul><li><strong>Erosion of Authenticity:</strong> If our discourse becomes increasingly polished and generically empathetic, does it lead to a loss of genuine, messy, and sometimes imperfect human connection? The raw, unfiltered nature of human speech, the hesitations, the errors, the unique turns of phrase, often conveys more authenticity than perfect prose.</li><li><strong>The Value Proposition of Human Communication:</strong> In a world where an AI can generate flawlessly polite and coherent text instantly, what becomes the new currency of human communication? Perhaps it’s precisely the <em>imperfections</em>, the <em>idiosyncrasies</em>, and the <em>unpredictability</em> that will distinguish truly human interaction.</li><li><strong>A Feedback Loop of Mediocrity:</strong> If we train AI on our best, most polished writing, and then mimic the AI’s polished, averaged output, are we inadvertently training ourselves into a linguistic feedback loop that eventually prioritizes statistical average over unique, creative expression?</li></ul><h3>The Data Disaster: When AI Feeds On Itself (Model Collapse)</h3><p>The problem of humans sounding like bots is just one half of the danger, the other half is what happens to the machines themselves.</p><p>As more and more of the internet’s content, articles, forum posts, code, and summaries becomes <em>AI-generated</em>, future AI models face a terrifying challenge, <strong>Data Contamination. </strong>This happens when models are trained on data that is distorted, repetitive, or outright incorrect. Left unchecked, it creates a feedback loop where AI learns not from the richness of human thought, but from its own simplified imitations</p><p>If the next generation of LLMs is primarily trained on the content created by today’s LLMs, they will be feeding on their own exhaust. This process is known as <strong>Model Collapse</strong>.</p><p>Think of it like repeatedly making a photocopy of a photocopy: each time, the image loses a little detail, a little nuance, until all you’re left with is a blurry, distorted mess.</p><ul><li><strong>The Loss of the “Long Tail”:</strong> AI is trained on what is common (the head of the data distribution). Unique ideas, niche facts, minority perspectives, and rare language (the “long tail”) are often under-sampled. If subsequent AIs are trained on this already-narrowed data, those rare human details will eventually vanish entirely.</li><li><strong>A Slow Drift to Gibberish:</strong> Researchers have shown that training a model on its own output can lead to an exponential increase in errors, eventually causing the output to devolve into incoherent, nonsensical text. The AI, in its pursuit of the “statistically probable,” loses touch with the actual reality and diversity of human language.</li></ul><p>This means the very systems we rely on for information, efficiency, and communication risk becoming closed, generic, and disconnected from reality, essentially creating a self-referencing digital echo chamber. The lack of originality in human speech is mirrored by a loss of knowledge and diversity in the machine brain.</p><h3>Conclusion: Reclaiming the Human “Noise”</h3><p>As data scientists, we spend our lives trying to identify patterns and reduce noise. But in human language, the “noise”, the slang, the accents, the emotional inflections, the grammatical quirks, the run-on sentences born of passion — is often where the real, unique, high-value data of our humanity resides.</p><p>The rise of AI Influenced Language in our everyday conversations and the threat of model collapse in the digital world are two sides of the same warning: we risk prioritizing predictable patterns over genuine human connection.</p><p>The challenge ahead isn’t just about making AI sound more human; it’s about ensuring <strong>humans don’t start sounding more like AI.</strong> We must consciously resist the urge to conform to the algorithm’s linguistic averages.</p><p>After all, we can’t stop AI from shaping the world, but we <strong>can</strong> and <strong>must</strong> control how it shapes <em>us</em>. Our defense against the algorithm is the deliberate, messy, beautiful noise of authentic human speech.</p><h3>Let’s Keep the Conversation Human</h3><p>AI may echo us, but our voices still matter most. If you’d like to exchange ideas and perspectives on AI, data, and the human side of technology:</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d76553d6da0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talking to a Machine That Understands You! Welcome to the Future of Customer Support]]></title>
            <link>https://sahar-tj.medium.com/talking-to-a-machine-that-understands-you-welcome-to-the-future-of-customer-support-abf03a5c33cc?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/abf03a5c33cc</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 02:44:24 GMT</pubDate>
            <atom:updated>2025-04-15T02:44:24.736Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IAOA6zVJxXZjoCKZ2CH6Cw.jpeg" /><figcaption>Source: Leonardo AI (Prompted by me)</figcaption></figure><p><em>“I’m sorry, I didn’t understand that. Please repeat your request.”</em></p><p>Sounds familiar? Virtual assistants and IVR (Interactive Voice Response) systems are <em>supposed</em> to make our lives easier, but more often than not, they leave us frustrated. They misinterpret accents, fail to recognize intent, and force us through rigid menu structures that barely help. Instead of feeling assisted, we end up repeating ourselves, pressing buttons in frustration, or just yelling, <em>“Talk to a human!”</em></p><p><strong>So, why do so many IVAs struggle to understand humans?</strong></p><p>The problem lies in their <strong>inability to process natural speech the way real conversations work</strong>. Traditional systems rely on keyword detection and predefined responses, meaning they often miss context, tone, and intent. They can’t tell if a customer is frustrated or in a hurry. They don’t adapt, they just follow a script.</p><p>That got me thinking, <strong>what if we could build an IVA that actually listens, understands, and responds like a real assistant?</strong></p><p>That led to the development of the <strong>Aurora Airlines IVA</strong>, an AI-powered virtual assistant for an airline that can handle customer queries seamlessly, detect emotions and have more human-like interactions. But making it “intelligent” required more than just AI buzzwords, it needed deep work in <strong>speech recognition, sentiment analysis, intent classification, and model optimization</strong> to ensure it could handle real-world interactions effectively. Moreover it requires robust data, fine-tuned models and an optimized system that works efficiently even on resource-constrained devices like mobile applications. That’s why this project had two key parts:</p><ol><li><strong>Building the AI-Driven IVA</strong>: A virtual assistant capable of handling customer queries with speech recognition, sentiment analysis, and intent classification.</li><li><strong>Enhancing the Dataset &amp; Model Performance</strong>: A deep dive into dataset augmentation, multilingual audio processing, model evaluation, and deployment optimization, ensuring the IVA runs efficiently, even on mobile platforms.</li></ol><p>This article takes you through the flight path of developing the Aurora Airlines IVA, navigating the challenges encountered, and the milestones reached that ultimately brought this virtual assistant to cruising altitude.</p><h3>The Challenge: When “Smart” Assistants Just Aren’t That Smart</h3><p>You call customer support, hoping for a quick resolution, but instead, you’re trapped in an endless loop of robotic responses.</p><p>🤖 <em>“Press 1 for booking, Press 2 for flight status, Press 3 for baggage inquiries.”</em></p><p>You just want to <strong>change your flight, </strong>but where’s that option? You take a gamble and press 1.</p><p>🤖<em>“You have selected flight booking. Are you looking to book a new flight? Press 1 for yes, 2 for no.”</em></p><p>… <em>Sigh.</em></p><p>You try speaking instead. <em>“I want to change my flight.”</em></p><p>🤖 <em>“Did you mean ‘book a flight’?”</em></p><p>At this point, you’re either frantically pressing <strong>zero</strong> or yelling <strong>“agent!”</strong> into the void, hoping a real human saves you.</p><p>But why does this happen? Why do IVAs (Intelligent Virtual Assistants) feel anything <em>but</em> intelligent?</p><h3>The Three Big Problems</h3><ul><li><strong>They Don’t “Get” You</strong><br>Most systems rely on rigid keyword matching. If you don’t phrase your request exactly as expected, they break. Ask for “baggage policy” instead of “bag policy,” or use a plural form like “flights” instead of “flight,” and you might get an error or an irrelevant response. Context? Synonyms? Nope. You either speak their language, or you’re out of luck.</li><li><strong>They Lack Emotional Intelligence</strong><br>You could be calm or absolutely losing patience but to the IVA, you sound the same. No frustration detection, no adaptation. Just the same robotic responses, making things worse.</li><li><strong>They’re Stuck in the Past</strong><br>Traditional IVAs still work like old-school phone menus, linear, rigid, and painfully slow. If your request doesn’t fit into one of their predefined boxes, you’re forced to play menu roulette.</li></ul><p>And that’s exactly what this project is set out to fix.</p><h3>Building an AI That Actually Listens</h3><p>When designing the Aurora Airlines IVA, the goal was simple: create a voice assistant that <strong>actually understands</strong> users, rather than just reacting to keywords. This meant going beyond basic rule-based responses and integrating AI-driven natural language understanding.</p><p>Here’s how I tackled it:</p><ul><li><strong>Speech Recognition with Whisper ASR</strong> — Instead of struggling with rigid keyword inputs, the system transcribes and processes natural speech, allowing users to speak freely.</li><li><strong>Intent Recognition with AI Models</strong> — Instead of relying on fixed commands, the model was trained in a way that can <strong>interpret intent</strong> from various phrasings. Whether a user says, <em>“I want to check my flight”</em> or <em>“Where’s my plane?”</em>, the system understands both.</li><li><strong>Sentiment Analysis for Smarter Interactions</strong> — If a frustrated user says <em>“Just let me talk to an agent!” </em>or <em>swears like a trooper</em>, the IVA detects their frustration and prioritizes escalation rather than looping through menu options.</li><li><strong>Text-to-Speech for Human-Like Responses</strong> — Instead of robotic prompts, the system <strong>speaks naturally</strong>, improving the user experience.</li></ul><p>By combining these elements, the Aurora Airlines IVA transforms the typical voice assistant experience into something more <strong>intuitive, human-like, and frustration-free</strong>.</p><blockquote>A model can learn patterns, but intelligence comes from understanding humans.</blockquote><h4>Want to peek under the hood?</h4><p>Here’s a quick look at how some of it was built:</p><p><strong>Whisper ASR for Speech Recognition</strong></p><p>Used OpenAI’s Whisper to transcribe speech into text, enabling users to talk naturally — no need for rigid commands.</p><pre>def transcribe_audio(filename):<br>    # Initialize the ASR pipeline<br>    asr_pipeline = pipeline(&quot;automatic-speech-recognition&quot;,<br>        model=&quot;openai/whisper-base&quot;,<br>        device=0 if torch.cuda.is_available() else -1  # Use GPU if available<br>    )<br>    transcript = asr_pipeline(audio)[&quot;text&quot;]</pre><p><strong>Intent Recognition with Hugging Face Pipelines</strong></p><p>The system understands intent using a hybrid approach: first checking for known keywords, then falling back on a model-based classifier.</p><pre>def identify_intent(prompt, query, intent_keywords):<br>    # Extracting intent from keywords<br>    for intent, keywords in intent_keywords.items():<br>        if any(keyword in query.lower() for keyword in keywords):<br>            return intent<br><br>    # If intent not found in keywords, using prompt-based classification<br>    model = pipeline(&quot;text-classification&quot;, model=&quot;distilbert-base-uncased&quot;, tokenizer=&quot;distilbert-base-uncased&quot;)<br>    classification_input = prompt + &quot;\n\nUser: &quot; + query<br>    print(classification_input)<br>    classification_result = model(classification_input)<br>    print(classification_result)<br>    intent_label = classification_result[0][&#39;label&#39;]</pre><p><strong>Sentiment Analysis for Escalation Handling</strong><br>Detecting frustration early can improve user experience. If someone’s upset, the system fast-tracks them to a human instead of looping them through menus.</p><pre># Load pre-trained BERT model and tokenizer for sentiment analysis<br>sentiment_pipeline = pipeline(&quot;sentiment-analysis&quot;)<br># Perform sentiment analysis on the user&#39;s query<br>    sentiment_label, sentiment_score, sentiment_score_c = analyze_sentiment(transcript)<br><br>    # Perform further processing based on sentiment<br>    if sentiment_score_c &lt; -0.7:<br>        print(&quot;operator&quot;)<br>        text_to_speech(&quot;I&#39;m sorry to hear that you&#39;re upset. Let me transfer you to our customer support team.&quot;)</pre><p>A sentiment-analysis pipeline was used to analyse the sentiment of the user. A simple pipeline, but it adds a lot of emotional intelligence to the system.</p><p><strong>Natural-Sounding Responses with Text-to-Speech</strong><br>To make the IVA feel less robotic, Python TTS engine was used that can dynamically generate speech from responses.</p><pre><br>def text_to_speech(text, rate=150, volume=1):<br># Initialize the TTS engine<br>    engine = pyttsx3.init()<br># Set properties<br>    engine.setProperty(&#39;rate&#39;, rate)<br>    engine.setProperty(&#39;volume&#39;, volume)<br># Convert text to speech<br>    engine.say(text)<br># Wait for the speech to finish<br>    engine.runAndWait()</pre><h3>Taking It to the Next Level: Smarter Models, Better Data</h3><p>Building a smart IVA wasn’t just about <strong>designing an AI-driven system. </strong>It was about <strong>training the model on high-quality, diverse data</strong> to make it truly intelligent. That’s where the second phase came in: <strong>dataset augmentation, model evaluation, and optimization for mobile deployment.</strong></p><p>Here’s how the system was enhanced:</p><p><strong>-:-</strong> <strong>Multilingual Dataset Generation</strong> — Airlines serve passengers worldwide, so the <strong>Google Text-to-Speech (gTTS) </strong>was used to generate audio data in multiple language accents: Hindi, Tamil, Bengali, and British English, to make the model more inclusive.</p><p><strong>-:- Transcription &amp; Annotation — Transcriptions were handled using OpenAI’s Whisper ASR on the generated audio and manually labeled some of the transcribed data for accuracy. But labeling thousands of examples manually? Not scalable.</strong></p><p><strong>-:- LLM-Powered Automation</strong> — To speed things up, <strong>GROQ (a Large Language Model) </strong>was used <strong>to automate the annotation</strong> process, letting AI classify intents instead of manually tagging each line.</p><p><strong>-:- Data Augmentation — </strong>Here’s where things got interesting. A two-fold augmentation strategy was adopted to simulate real-world variability:</p><ol><li><strong>Multilingual Round-Trip Translation</strong><br>Original utterances were translated into multiple languages, and then back to English. This helped simulate natural linguistic variations in user queries. The model was then trained on this expanded dataset to handle global and diverse speech patterns better.</li><li><strong>Text Distortions with NLP Tricks</strong><br>Using the nlpaug library, utterances were augmented through techniques such as random spelling errors, synonym substitution, character deletions, and word swaps. Each distortion type was applied independently to observe its individual impact on model performance.</li></ol><p>Each distortion was applied individually to create different training variants. These distorted sets were <strong>not combined with the translated data. </strong>They served as a separate test of robustness against messy input.</p><p><strong>-:- Finding the Best Model</strong> — Multiple intent classification models were tested across original, translated, and distorted datasets. This helped benchmark their robustness and accuracy under varying conditions, from clean queries to noisy, real-world scenarios.</p><p><strong>-:-</strong> <strong>Optimizing for Mobile Deployment</strong> — Finally, to make the IVA <strong>run efficiently on mobile</strong>, <strong>model quantization </strong>was applied, reducing its size while maintaining accuracy. This ensured that even a lightweight version could deliver <strong>fast, reliable voice interactions on mobile apps</strong>.</p><p><strong>-:- Comparing with Traditional Models — </strong>To benchmark the performance of the AI-driven IVA, the fine-tuned deep learning models were compared with more traditional approaches like Logistic Regression with TF-IDF and Random Forest. These models offered valuable insights into performance under varying conditions and provided a solid baseline to evaluate the neural network’s effectiveness.</p><blockquote>Data is the foundation, but creativity is the architect. The best AI isn’t just trained, it’s sculpted by diverse data to truly understand the world around it.</blockquote><h4>Practical Approach: Model Configurations, Data Augmentation, and Quantization</h4><h4>Baseline Model</h4><p>Here’s how the baseline model was set up using the `MobileBertForSequenceClassification`</p><pre>from transformers import MobileBertTokenizer, MobileBertForSequenceClassification<br><br>tokenizer = MobileBertTokenizer.from_pretrained(&#39;google/mobilebert-uncased&#39;)<br>model = MobileBertForSequenceClassification.from_pretrained(&#39;google/mobilebert-uncased&#39;, num_labels=len(train_df[&#39;Intent&#39;].unique()))</pre><h4>Model Hyperparameters</h4><p>The model parameters were carefully tuned to balance training efficiency and performance:</p><pre>______________________________________________________________________________<br>|          |          |          | Train | Eval  |        |        |         |<br>|  Model   | Learning |  Eval    | Batch | Batch | Warmup | Weight | Logging |<br>|          |  Rate    | Strategy | Size  | Size  |  Steps | Decay  | Steps   |                   <br>|----------|----------|----------|-------|-------|--------|--------|---------|<br>| Model 1  | 5e-5     | Steps    | 8     | 8     | 10     | 0.1    | 10      |<br>| Model 2  | 1e-5     | Epoch    | 8     | 8     | 100    | 0.1    | 10      |<br>| Model 3  | 3e-5     | Epoch    | 16    | 16    | 500    | 0.01   | 100     |<br>| TinyBERT | 3e-5     | Epoch    | 16    | 16    | 500    | 0.01   | 100     |<br>|____________________________________________________________________________|<br></pre><h4>Data Augmentation</h4><p><strong>Translated data</strong></p><pre>#concatinating all the translations <br>df2 = pd.concat([df, pd.DataFrame(french_utterances), pd.DataFrame( english_utterances_via_french), <br>                pd.DataFrame(arabic_utterances), pd.DataFrame( english_utterances_via_arabic),<br>                pd.DataFrame(italian_utterances), pd.DataFrame( english_utterances_via_italian),<br>                pd.DataFrame(german_utterances), pd.DataFrame( english_utterances_via_german) ], ignore_index=True)<br><br>#Using baseline model <br>X_train_lang, X_test_lang = train_test_split(df2, test_size=0.3, random_state=42)<br>X_train_lang[&#39;Intent&#39;] = label_encoder.fit_transform(X_train_lang[&#39;Intent&#39;])<br>X_test_lang[&#39;Intent&#39;] = label_encoder.transform(X_test_lang[&#39;Intent&#39;])<br><br>translate_model = train_and_evaluate_model(X_train_lang, X_test_lang)<br>translate_model</pre><h4><strong>Distortion Data</strong></h4><p>The distortion process was handled using the following code:</p><pre>train2_df = pd.concat([df, spelling_adjusted, synonym_adjusted, delete_adjusted, swap_adjusted])<br><br>X_train_dist, X_test_dist = train_test_split(train2_df, test_size=0.3, random_state=42)<br>X_train_dist[&#39;Intent&#39;] = label_encoder.fit_transform(X_train_dist[&#39;Intent&#39;])<br>X_test_dist[&#39;Intent&#39;] = label_encoder.transform(X_test_dist[&#39;Intent&#39;])<br>#Baseline Model <br>dist_model = train_and_evaluate_model(X_train_dist, X_test_dist)<br>dist_model</pre><h4>Model Benchmarking</h4><p>Several intent classification models were tested across datasets. Here’s a snapshot of their performance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xp_73jpKFCuCPck8122EIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tpyomIII7snDIhfOWOc37Q.png" /></figure><h4>Quantization the Model</h4><p>Quantization in machine learning refers to the process of reducing the precision of the model’s weights and activations to lower-bit representations, such as converting floating-point numbers (e.g., 32-bit) to integers (e.g., 8-bit). This reduces the model size and speeds up inference without significantly affecting its accuracy, making it more efficient for deployment on resource-constrained devices like mobile phones or embedded systems.</p><pre># Quantization of the Model Dynamically <br>quantized_trained_model = torch.quantization.quantize_dynamic(model_architecture,  # the original trained model<br>                                                              {torch.nn.Linear},  # a set of layers to dynamically quantize<br>                                                              dtype=torch.qint8  # the target dtype for quantized weights<br>                                                             )</pre><p>By quantizing the model the size of the original model was reduced significantly.</p><ul><li>Original Model Size: 54.777 MB</li><li>Quantized Model Size: 41.487 MB</li></ul><h4>Deep Learning vs Traditional Models</h4><p>Choosing the right model architecture isn’t just about performance, it’s about aligning capabilities with real-world constraints. For an AI-driven IVA intended for mobile deployment, this meant balancing computational efficiency with intelligent, human-like responses.</p><p>Quantized deep learning models offered robust performance, especially with complex or multilingual inputs. However, they still demand more memory and processing power than some mobile devices can afford. On the other hand, traditional models like Logistic Regression with TF-IDF and Random Forest were far more lightweight and faster in execution, making them ideal for on-device applications. Yet, they lacked the depth of understanding required for nuanced, dynamic conversations.</p><p>This highlighted the trade-off: traditional models offer speed and efficiency, while deep learning models bring contextual intelligence. Future iterations of the system could benefit from hybrid strategies — using deep learning for language understanding and traditional models for quick intent routing — offering the best of both worlds.</p><h3>The Impact: From Concept to Execution, A Seamless Experience</h3><p>After rounds of training, data augmentation, model testing, and optimization, the result was more than just a working prototype, it was a <strong>powerful AI-driven voice assistant</strong> that could:</p><ul><li><strong>Understand diverse user intents</strong> and <strong>respond naturally</strong>, rather than just spitting out pre-recorded menu options.</li><li><strong>Detect user emotions</strong> to route queries effectively and provide personalized service.</li><li><strong>Handle multilingual interactions</strong>, breaking down barriers for global travelers.</li><li><strong>Operate smoothly on mobile devices</strong>, giving users a seamless experience on the go.</li></ul><p>But the impact goes beyond just functionality. This project demonstrates the potential of integrating cutting-edge AI technologies to improve user experiences across industries. Whether it’s for an airline, a bank, or any other service provider, this IVA system can pave the way for <strong>intelligent, human-like interactions at scale</strong>. The scalability and adaptability of the system make it <strong>ready for deployment in various industries</strong> — without the need for extensive human support.</p><h3>Closing Thoughts</h3><p>At its core, this project wasn’t just about building another AI assistant. It was about <strong>rethinking how machines understand and respond to people</strong> — especially in high-stress, real-world scenarios like travel.</p><p>Working on <a href="https://github.com/Sahar-TJ/Aurora-Airlines-IVA">Aurora Airlines’ IVA</a> taught me that great tech isn’t just built with powerful models, it’s built with empathy, user understanding, and the grit to fine-tune every detail until it <em>feels</em> right.</p><p>As AI continues to evolve, so will our expectations of it. And I believe intelligent voice assistants like this are just the beginning. The future of AI isn’t just in smarter algorithms, it’s in making technology feel like a conversation, not a command. This project was a small step in that direction.</p><p>There’s more work ahead (smarter dialogs, more languages, real-time systems), but this was one step closer to making tech <em>feel</em> human. For a closer look at the code behind this project, head over to the <a href="https://github.com/Sahar-TJ/Aurora-Airlines-IVA">repository</a> where all the details are laid out!</p><p>And hey, next time you say <em>“I want to change my flight”</em>, maybe you won’t have to scream it five times.</p><h3>Building better AI isn’t a solo mission</h3><p>The world of AI is brimming with endless possibilities, and the journey toward innovation is never one we take alone. Let’s dive into the evolving world of AI, data, and beyond. Don’t miss out on the next wave of innovation:</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li><li>Check my <a href="https://github.com/Sahar-TJ">Github</a> for more projects</li></ul><p>The adventure is just beginning. Let’s shape the future together!</p><blockquote>Special thanks to Professor Greg Baker for his guidance and to my friends for their support throughout the project. This article reflects my personal understanding and perspective on the work.</blockquote><blockquote>All code snippets and visualizations in this article are based on my own implementation and data from the project. Results may vary depending on datasets, model configurations, or environments.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abf03a5c33cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI directs, NLP Scripts: Behind the Genres of Prediction and Show Discovery]]></title>
            <link>https://sahar-tj.medium.com/ai-directs-nlp-scripts-behind-the-genres-of-prediction-and-show-discovery-c823255c8187?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/c823255c8187</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Thu, 18 Jul 2024 14:14:02 GMT</pubDate>
            <atom:updated>2024-07-19T13:56:14.365Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kv-tgp0d4xFPZsQznMzCxQ.jpeg" /><figcaption>Source: Erik Hollander Design</figcaption></figure><p>In the vast ocean of entertainment, discovering the perfect TV show or movie that resonates with our preferences can be like finding a needle in a haystack. With countless titles across various genres, platforms, and themes, the task of narrowing down options to find that one captivating piece can be daunting. However, what if there was a way to streamline this process, allowing viewers to delve into a treasure trove of content tailored to their tastes effortlessly?</p><p>Welcome to the realm of the AI Movie Genre Predictor, where cutting-edge Artificial Intelligence (AI) and Natural Language Processing (NLP) technologies converge to revolutionize the way we discover and explore entertainment. This innovative project harnesses the power of machine learning algorithms to predict, classify, and search for TV shows and movies based on their descriptions, offering users a personalized and immersive viewing experience like never before.</p><p>With the AI Movie Genre Predictor, users can bid farewell to endless scrolling and arbitrary selection processes. Instead, they embark on a journey where every recommendation is carefully curated, unveiling hidden gems and undiscovered masterpieces tailored to their unique preferences. By analyzing the intricate nuances of plotlines, character dynamics, and thematic elements embedded within descriptions, this project brings forth a dynamic and intuitive platform where entertainment meets precision.</p><p>Let’s delve deeper into the intricate workings of AI and NLP, unravel the mysteries behind genre prediction and show discovery. From behind-the-scenes insights to captivating plot twists, embark on a cinematic adventure where the future of entertainment lies at your fingertips.</p><h3>The Genesis of ReelReveal</h3><p>The inception of ReelReveal was driven by a desire to merge my technical skills with my curiosity about the world of movies besides the fact that it was also an assignment for my course. Navigating the vast world of movies and television shows can be overwhelming, even for someone deeply involved in technology. I frequently found myself grappling with the dilemma of choosing what to watch, asking others for movie recommendations, spending more time browsing than actually enjoying movies and TV shows. This personal frustration fueled my exploration of new ways to enhance our entertainment experiences.</p><h3>How ReelReveal Works</h3><p><strong>Data Collection and Preprocessing:</strong> The journey of creating ReelReveal began with collecting data from TVmaze. Using NLTK, I meticulously cleaned and preprocessed the text data, which involved removing stopwords, tokenizing, lemmatizing, and ensuring the data was in its most useful form.</p><p><strong>Model Training:</strong> I employed TensorFlow to train a neural network capable of understanding and classifying movie genres. The architecture included a TextVectorization layer to handle text input, an Embedding layer for creating dense word representations, a GlobalAveragePooling1D layer for dimensionality reduction, and Dense layers for the final classification.</p><p><strong>Genre Prediction:</strong> The core of ReelReveal is its ability to predict genres based on movie descriptions. Using advanced AI algorithms, the model analyzes the text to determine the most fitting genres, providing accurate and insightful recommendations.</p><h3>Advanced Features and Functionalities</h3><p><strong>Search Engine:</strong> The search functionality of ReelReveal allows users to find movies based on specific criteria. Utilizing TF-IDF for indexing and cosine similarity for search, ReelReveal efficiently retrieves relevant movies, making the search process seamless and intuitive.</p><p><strong>User Experience:</strong> ReelReveal is designed with user-friendliness in mind. The platform’s interface is straightforward and engaging, allowing users to easily input their preferences and receive tailored recommendations. The combination of intuitive design and advanced technology ensures an unparalleled user experience.</p><p><strong>Personalized Recommendations:</strong> By analyzing user preferences and past interactions, ReelReveal provides highly personalized movie recommendations. This feature ensures that each user receives suggestions that align closely with their unique tastes.</p><h3>The Technologies Behind ReelReveal</h3><p><strong>Artificial Intelligence and Machine Learning:</strong> At the heart of ReelReveal are the AI and machine learning techniques powered by TensorFlow. These technologies enable the neural network to learn from data and make accurate predictions.</p><p><strong>Natural Language Processing:</strong> NLP techniques with NLTK are crucial for text analysis in ReelReveal. These methods allow the system to understand and process textual descriptions, ensuring accurate genre classification and search functionality.</p><p><strong>Integration and Deployment:</strong> The integration of various technologies and the deployment of ReelReveal were achieved through meticulous planning and execution. Challenges were met and overcome, resulting in a robust and reliable platform.</p><h3>Getting started with the Project</h3><h4>Train.py File</h4><p>The project consists of 4 different python file. The first step in creating ReelReveal involves collecting and preprocessing the data. The train.py script handles this by connecting to a SQLite database, extracting the necessary data, and cleaning it using natural language processing techniques.</p><h4>Data Collection</h4><p>To collect the data, we connect to a SQLite database and fetch information about TV shows and their associated genres. Here’s a snippet of the code that handles data loading:</p><pre>def load_data(sqlite_file):<br>    connection = sqlite3.connect(sqlite_file)<br>    df = pd.read_sql(&quot;SELECT * FROM tvmaze&quot;, con=connection)<br>    df2 = pd.read_sql(&quot;SELECT * FROM tvmaze_genre&quot;, connection)<br>    df3 = pd.read_sql(&quot;SELECT t.description as Description, GROUP_CONCAT(tg.genre) as Genre from tvmaze t JOIN tvmaze_genre tg on t.tvmaze_id = tg.tvmaze_id group by description;&quot;, connection)<br>    connection.close()<br>    return df, df2, df3</pre><p>This function establishes a connection to the SQLite database. It reads tables containing TV show descriptions and genres into pandas DataFrames. The GROUP_CONCAT function is used to aggregate genres associated with each description.</p><h4>Data Preprocessing</h4><p>After collecting the data, the next step is to clean and preprocess it. This involves removing unnecessary elements and preparing the text for analysis.</p><pre>def clean_data(df3):<br>    nltk.download(&#39;stopwords&#39;)<br>    nltk.download(&#39;punkt&#39;)<br>    nltk.download(&#39;wordnet&#39;)<br><br>    # Operate on a copy to prevent SettingWithCopyWarning<br>    df3 = df3.copy()<br>    df3[&#39;Description&#39;] = df3[&#39;Description&#39;].apply(clean_text)<br>    df3[&#39;Description&#39;] = df3[&#39;Description&#39;].apply(remove_stopwords)<br>    df3 = df3[~(df3[&#39;Description&#39;].isin([&#39;&#39;, &#39;dupe:&#39;]) | df3[&#39;Description&#39;].str.endswith(&#39;dupe:&#39;))]<br>    df3.reset_index(drop=True, inplace=True)<br>    df3[&#39;Description&#39;] = df3[&#39;Description&#39;].apply(tokenize_and_lemmatize)<br>    df3[&#39;Genre&#39;] = df3[&#39;Genre&#39;].str.split(&#39;,&#39;)<br><br>    return df3</pre><p>This function is to clean the dataset by importing the necessary NLTK libraries like stopwords and wordnet. The clean_text function removes URLs and unnecessary whitespace from the descriptions. Commonly used words that do not carry significant meaning (stopwords) are removed by using the remove_stopwords function. The tokenize_and_lemmatize function breaks down the text into individual words (tokens) and converts them to their base forms (lemmas).</p><p>By following these steps, we ensure that the data is clean and ready for the next stages of model training and genre prediction. This meticulous preprocessing is essential for achieving high accuracy in genre classification and efficient movie searches.</p><h3>Model Training</h3><p>With the data collected and preprocessed, the next step is to train a neural network model to predict movie genres based on descriptions. This involves preparing the target data, creating the model architecture, training the model, and evaluating its performance.</p><p>To train the model, we need to prepare the target data by one-hot encoding the genres. This converts the genre information into a binary matrix format that the model can understand.</p><pre>def prepare_target(df3, df2):<br>    # Ensure &#39;Genre&#39; column exists in df2<br>    if &#39;genre&#39; not in df2.columns:<br>        raise KeyError(&quot;The &#39;Genre&#39; column is not found in df2. Please check the DataFrame structure.&quot;)<br><br>    genres = df2[&#39;genre&#39;].unique()<br>    target = np.zeros((df3.shape[0], len(genres)))<br>    categories_forward_lookup = {genre: i for i, genre in enumerate(genres)}<br>    for i, cs in zip(df3.index, df3.Genre):<br>        for c in cs:<br>            category_number = categories_forward_lookup[c]<br>            target[i, category_number] = 1<br>    return target, categories_forward_lookup</pre><p>Here we are extracting the unique genres from the dataset. Creating a binary matrix where each row corresponds to a movie description and each column represents a genre. This function maps each genre to an index for easy reference.</p><p>The neural network model is designed using TensorFlow. The architecture includes a TextVectorization layer to handle text input, an Embedding layer for creating dense word representations, a GlobalAveragePooling1D layer for dimensionality reduction, and Dense layers for classification.</p><pre>def train_model(X_train, y_train, X_validation, y_validation):<br>    max_tokens = 50000<br>    output_sequence_length = 100<br>    embedding_dim = 32<br><br>    vectorizer = TextVectorization(max_tokens=max_tokens, output_sequence_length=output_sequence_length)<br>    vectorizer.adapt(X_train)<br><br>    inputs = Input(shape=(1,), dtype=tf.string)<br>    vectorized = vectorizer(inputs)<br>    embedded = Embedding(max_tokens + 1, embedding_dim)(vectorized)<br>    averaged = GlobalAveragePooling1D()(embedded)<br>    layer1 = Dense(128, activation=&#39;relu&#39;)(averaged)<br>    output = Dense(len(categories_forward_lookup), activation=&#39;sigmoid&#39;)(layer1)<br><br>    model = Model(inputs=[inputs], outputs=[output])<br>    model.compile(optimizer=&#39;adam&#39;, loss=&#39;binary_crossentropy&#39;, metrics=[&#39;accuracy&#39;])<br><br>    early_stopping = keras.callbacks.EarlyStopping(monitor=&#39;val_loss&#39;, patience=20, restore_best_weights=True)<br>    model.fit(X_train, y_train, epochs=200, validation_data=(X_validation, y_validation), callbacks=[early_stopping])<br>    return model</pre><p>After the preprocessing, the data is split into training, validation, and test sets in the main function and the train_model is called. The model is trained on the training set and validated on the validation set. The model is trained on the training set with early stopping to prevent overfitting.</p><p>The <strong>TextVectorization Layer</strong> converts raw text into sequences of integers, known as token vectors. The vectorizer object tokenizes the text and then maps these tokens to integer indices. By configuring the max_tokens parameter, we limit the number of unique tokens, and the output_sequence_length ensures that all sequences are of the same length by either truncating or padding them.</p><p>The <strong>Embedding Layer</strong> transforms the integer token vectors into dense vectors of fixed size, capturing the semantic meaning of the words. This allows the model to learn word embeddings that capture semantic relationships between words. The embedding dimension (embedding_dim) determines the size of the dense vector for each token, which directly influences the richness of the word representations learned by the model.</p><p>The <strong>GlobalAveragePooling1D Layer</strong> plays a critical role in reducing the dimensionality of the embeddings by computing the average of all vectors in the sequence. It helps in reducing the complexity and size of the data passed to the dense layers. This averaging operation captures the overall meaning of the entire text by considering all tokens equally, providing a concise representation of the input sequence.</p><p>The <strong>Dense Layers</strong> perform the final classification task. The first dense layer has 128 neurons with ReLU activation, which introduces non-linearity and helps the model learn complex patterns from the data. This layer processes the averaged embeddings and learns higher-level features. The output dense layer, with neurons equal to the number of genres and sigmoid activation, produces probabilities for multi-label classification. This means that for each genre, the model outputs a probability indicating the likelihood that a movie belongs to that genre, allowing for accurate multi-genre predictions.</p><p>Finally, the trained model is evaluated on the test set to measure its accuracy, ensuring it generalizes well to new data. The trained model and genre mappings are saved for future use in predicting genres for new movie descriptions. With this we will move to the next file.</p><h3>Genre Prediction</h3><p>After training the neural network model, the next step is to use this model to predict genres for new movie descriptions. The classify.py script handles this task. It involves loading the trained model, preprocessing the new description, making predictions, and outputting the results.</p><p>The first step in genre prediction is to load the previously trained model and the genre-index mapping. This ensures that the new descriptions are processed and classified using the same model and genre mappings. The genre-index mapping is loaded using the pickle library to ensure consistent genre predictions.</p><p>Next, the script reads the new TV show description from a text file and preprocesses it to match the format used during training.</p><ul><li><strong>Reading Description:</strong> The read_description function reads the movie description from a file.</li><li><strong>Text Cleaning:</strong> The clean_text function removes URLs and unnecessary whitespace.</li><li><strong>Stopwords Removal:</strong> The remove_stopwords function filters out common stopwords to retain meaningful words.</li><li><strong>Preprocessing:</strong> The preprocess_description function combines cleaning and stopwords removal to prepare the text for prediction.</li></ul><h4>Making Predictions</h4><p>The script then uses the loaded model to predict the genres of the given description. It also ranks the genres based on their probabilities.</p><pre>def predict_genre(model, categories_forward_lookup, description):<br>    predictions = model.predict([description])[0]<br>    genres = {genre: predictions[i] for genre, i in categories_forward_lookup.items()}<br>    sorted_genres = sorted(genres.items(), key=lambda x: x[1], reverse=True)<br>    return genres, sorted_genres[:3]</pre><ul><li><strong>Genre Prediction:</strong> The model.predict function outputs probabilities for each genre.</li><li><strong>Probability Mapping:</strong> The predicted probabilities are mapped to their respective genres using the genre-index mapping.</li><li><strong>Ranking:</strong> The genres are sorted based on their probabilities, with the top genres being the most likely ones for the given description.</li></ul><h4>Outputting Results</h4><p>Finally, the predicted genres and their probabilities are saved to a JSON file. Additionally, an explanation of the prediction can be generated using LIME (Local Interpretable Model-agnostic Explanations).</p><pre>def classify_tv_show(input_file, output_json_file, encoding=&#39;UTF-8&#39;, explanation_output_dir=None):<br>    try:<br>        # Read the description from the input file<br>        description = read_description(input_file)       <br>        model, categories_forward_lookup = load_model_and_lookup()<br>        <br>        _, top_genres = predict_genre(model, categories_forward_lookup, description)<br>        genres_with_probabilities = {genre[0]: float(&quot;{:.2f}&quot;.format(genre[1])) for genre in top_genres}<br><br>        # Write the identified genres with their probabilities to the output JSON file<br>        with open(output_json_file, &#39;w&#39;, encoding=encoding) as json_file:<br>            json.dump(genres_with_probabilities, json_file, ensure_ascii=False)<br><br>        <br>        if explanation_output_dir:<br>            class_names = list(categories_forward_lookup.keys())<br>            explainer = lime_text.LimeTextExplainer(class_names=class_names)<br>            exp = explainer.explain_instance(description, lambda x: predict_fn(x, model), num_features=10)<br>            explanation_filename = os.path.join(explanation_output_dir, &quot;explanation.html&quot;)<br>            exp.save_to_file(explanation_filename)</pre><ul><li><strong>Reading and Preprocessing:</strong> The script reads and preprocesses the new description.</li><li><strong>Model and Genre Lookup Loading:</strong> The trained model and genre mappings are loaded.</li><li><strong>Prediction and Ranking:</strong> The genres are predicted and ranked based on their probabilities.</li><li><strong>Saving Results:</strong> The predicted genres and probabilities are saved to a JSON file.</li><li><strong>Explanation: </strong>An explanation of the prediction is generated using LIME and saved as an HTML file.</li></ul><h3>Indexing TV Show Data</h3><p>Indexing the data is a crucial step for efficient retrieval and search functionality. The index.py script handles the process of extracting, preprocessing, and indexing TV show data using TF-IDF (Term Frequency-Inverse Document Frequency) to facilitate quick and accurate searches.</p><h4>Data Extraction</h4><p>The first step is to extract data from the SQLite database. This involves connecting to the database and fetching TV show descriptions and other relevant information.</p><pre>def index_data(sqlite_file):<br>    connection = sqlite3.connect(sqlite_file)<br>    cursor = connection.cursor()<br>    query = &quot;SELECT tvmaze_id, showname, description FROM tvmaze&quot;<br>    cursor.execute(query)<br>    data_to_index = []<br>    texts = []<br>    for row in cursor.fetchall():<br>        processed_data = preprocess_data(row)<br>        data_to_index.append(processed_data)<br>        texts.append(processed_data[&#39;description&#39;])<br>    connection.close()<br>    return data_to_index, texts</pre><ul><li><strong>Database Connection:</strong> Establishes a connection to the SQLite database.</li><li><strong>Query Execution:</strong> Executes a query to fetch TV show IDs, names, and descriptions.</li><li><strong>Data Collection:</strong> Collects and processes each row of data, storing the processed descriptions and other relevant information.</li></ul><h4>Data Preprocessing</h4><p>Preprocessing ensures that the text data is clean and consistent, making it suitable for indexing. This involves tokenizing and lemmatizing the descriptions.</p><p>Here the description is split into individual words (tokens). The function then converts each token to its base form, ensuring uniformity. It then combines the lemmatized description with the show ID and title.</p><h4>Indexing with TF-IDF</h4><p>The TF-IDF approach converts text data into numerical representations, capturing the importance of each term in the context of the entire dataset. This enables efficient and meaningful searches.</p><pre>def create_index(texts):<br>    vectorizer = TfidfVectorizer()<br>    X = vectorizer.fit_transform(texts)<br>    return vectorizer, X</pre><ul><li><strong>TF-IDF Vectorization:</strong> Converts the cleaned text descriptions into a matrix of TF-IDF features.</li><li><strong>Vectorizer Fit:</strong> Fits the vectorizer to the text data and transforms the texts into TF-IDF vectors.</li></ul><h4>Saving the Indexed Data</h4><p>The indexed data, along with the TF-IDF matrix and the vectorizer, is saved to a file for future retrieval. The pickle library is used to serielize the index data.</p><h3>Searching for TV Shows</h3><p>With the data indexed, the final step is to enable searching for TV shows based on user queries. The search.py script facilitates this by loading the indexed data, preprocessing user queries, and finding the most relevant TV shows based on textual similarity.</p><p>The first step is to load the previously saved indexed data, which includes the processed TV show descriptions, the TF-IDF matrix, and the vectorizer.</p><p>User queries need to be preprocessed in the same way as the TV show descriptions to ensure consistency. This involves cleaning the text, tokenizing and lemmatizing it.</p><h4>Searching for TV Shows</h4><p>The search functionality involves transforming the user query into a TF-IDF vector, calculating the cosine similarity between the query vector and the indexed data, and ranking the TV shows based on their similarity scores.</p><pre>def search_tv_shows(query, index):<br>    preprocessed_query = preprocess_data(query)<br>    query_vector = index[&#39;vectorizer&#39;].transform([preprocessed_query])<br>    similarities = cosine_similarity(query_vector, index[&#39;tfidf_matrix&#39;])<br>    sorted_shows = sorted(zip(similarities[0], index[&#39;data&#39;]), key=lambda x: -x[0])<br>    top_5_matches = [{&#39;tvmaze_id&#39;: show[&#39;id&#39;], &#39;showname&#39;: show[&#39;title&#39;]} for _, show in sorted_shows[:5] if _ &gt; 0]<br>    return top_5_matches</pre><ul><li><strong>Query Vectorization:</strong> Converts the preprocessed user query into a TF-IDF vector using the loaded vectorizer.</li><li><strong>Cosine Similarity:</strong> Computes the cosine similarity between the query vector and the TF-IDF vectors of the indexed descriptions.</li><li><strong>Ranking and Retrieval:</strong> Ranks the TV shows based on their similarity scores and selects the top matches. The most relevant TV shows that best match the query are returned.</li></ul><p>Finally, the search.py script brings all these steps together to search for TV shows based on a user query and save the results to a JSON file. The search.py script enables efficient and accurate retrieval of TV shows based on textual queries, providing users with relevant and personalized recommendations.</p><h3>Conclusion</h3><p>ReelReveal leverages advanced AI and NLP technologies to transform how we discover and interact with movies and TV shows. By accurately predicting genres and providing personalized recommendations, ReelReveal offers a more intuitive and engaging way to explore content. This can significantly enhance user satisfaction by reducing the time spent searching for suitable content and increasing the likelihood of finding something enjoyable.</p><p>As Katniss Everdeen wisely stated in <em>The Hunger Games</em>, “May the odds be ever in your favor.” ReelReveal strives to ensure that the odds of finding your next favorite movie or show are significantly improved.</p><p>While ReelReveal is already a powerful tool, there are several potential enhancements that could make it even more effective:</p><ul><li><strong>Incorporating User Feedback:</strong> Integrating a feedback loop where users can rate the accuracy of genre predictions and recommendations can help refine the model and improve future suggestions.</li><li><strong>Expanding the Dataset:</strong> Including a wider variety of data sources and updating the dataset regularly can enhance the model’s ability to predict genres and recommend content accurately.</li><li><strong>Advanced NLP Techniques:</strong> Implementing more advanced NLP techniques such as transformer models (e.g., BERT, GPT-3) could further improve the accuracy and relevance of predictions and recommendations.</li></ul><blockquote>“AI is the new electricity.” — Andrew Ng</blockquote><p>ReelReveal exemplifies the potential of combining AI and NLP to create meaningful and impactful applications. By simplifying the process of discovering movies and TV shows, it offers a glimpse into the future of personalized entertainment. Whether you’re a movie enthusiast looking for your next favorite film, a content provider seeking to enhance user engagement, or a developer exploring the capabilities of AI, ReelReveal has something to offer.</p><h3>Hope you find this article useful!</h3><p>Thank you for diving into the world of ReelReveal with me! If this project sparked your interest or inspired you, let’s stay connected:</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li><li>Check my <a href="https://github.com/Sahar-TJ">Github</a> for more projects</li></ul><p>Exciting times lie ahead — let’s explore them together!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c823255c8187" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unraveling Rainfall Patterns: A Data Science Journey through Australia’s Weather Data]]></title>
            <link>https://sahar-tj.medium.com/unraveling-rainfall-patterns-a-data-science-journey-through-australias-weather-data-ade28df98348?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ade28df98348</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[weather-forecasts]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Fri, 21 Jul 2023 13:27:34 GMT</pubDate>
            <atom:updated>2023-07-21T13:27:34.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HszIdq26AFIrrzCbhVNFCA.jpeg" /></figure><h3>Introduction</h3><p>After migrating to Australia from a place that is famous for its desert and hot climate, I noticed one thing — the weather here is the most unpredictable one. It’s fascinating how the climate varies from region to region, making it a captivating topic of exploration.</p><p>Australia is a country that is well-known for its diverse landscapes and weather patterns. One of the most significant weather phenomena that affect the country is rainfall. Rainfall in Australia varies significantly by region and season, making it a crucial factor for various industries, including agriculture, tourism, and infrastructure development.</p><p>I have found myself constantly curious about what the weather will bring, not just for the next day, but even in the next few hours. This curiosity led me to delve into weather data analysis, and I stumbled upon an intriguing dataset on Kaggle — Rain in Australia.</p><p>As we work on the project, we will notice the rain patterns and predict the possibility of rain on the following day using various modelling techniques. We will discuss the key aspects of the data, including data cleaning, feature analysis, model selection, and evaluation.</p><h3>Dataset Description</h3><p>The dataset in this project is collected from <a href="https://www.kaggle.com/datasets/jsphyg/weather-dataset-rattle-package">Kaggle</a>. The dataset contains the data of rainfall from 2007 to 2017. It stores the rainfall patterns of various cities of Australia. There are 23 features in the data.</p><h4><strong>Features:</strong></h4><ul><li><strong>Date:</strong> The date of observation</li><li><strong>Location:</strong> The common name of the location of the weather station</li><li><strong>MinTemp:</strong> The minimum temperature in degrees celsius</li><li><strong>MaxTemp:</strong> The maximum temperature in degrees celsius</li><li><strong>Rainfall:</strong> The amount of rainfall recorded for the day in mm</li><li><strong>Evaporation:</strong> The so-called Class A pan evaporation (mm) in the 24 hours to 9am</li><li><strong>Sunshine:</strong> The number of hours of bright sunshine in the day.</li><li><strong>WindGustDir:</strong> The direction of the strongest wind gust in the 24 hours to midnight</li><li><strong>WindGustSpeed:</strong> The speed (km/h) of the strongest wind gust in the 24 hours to midnight</li><li><strong>WindDir9am:</strong> Direction of the wind at 9am</li><li><strong>WindDir3pm:</strong> Direction of the wind at 3pm</li><li><strong>WindSpeed9am:</strong> Wind speed (km/hr) averaged over 10 minutes prior to 9am</li><li><strong>WindSpeed3pm:</strong> Wind speed (km/hr) averaged over 10 minutes prior to 3pm</li><li><strong>Humidity9am:</strong> Humidity (percent) at 9am</li><li><strong>Humidity3pm:</strong> Humidity (percent) at 3pm</li><li><strong>Pressure9am:</strong> Atmospheric pressure (hpa) reduced to mean sea level at 9am</li><li><strong>Pressure3pm:</strong> Atmospheric pressure (hpa) reduced to mean sea level at 3pm</li><li><strong>Cloud9am:</strong> Fraction of sky obscured by cloud at 9am. ***</li><li><strong>Cloud3pm:</strong> Fraction of sky obscured by cloud (in “oktas”: eighths) at 3pm. See Cload9am for a description of the values</li><li><strong>Temp9am:</strong> Temperature (degrees C) at 9am</li><li><strong>Temp3pm:</strong> Temperature (degrees C) at 3pm</li><li><strong>RainToday:</strong> Boolean: 1 if precipitation (mm) in the 24 hours to 9am exceeds 1mm, otherwise 0</li><li><strong>RainTomorrow:</strong> The amount of next day rain in mm. Used to create response variable RainTomorrow. A kind of measure of the “risk”. This feature would be the <strong><em>target variable</em></strong></li></ul><p>* <em>This is measured in “oktas”, which are a unit of eigths. It records how many eigths of the sky are obscured by cloud. A 0 measure indicates completely clear sky whilst an 8 indicates that it is completely overcast.</em></p><h3>Getting started with the Project</h3><p>To get started with any Data Science Project, our very first step is to identify the problems. We already know that the dataset is supposed to be used in order to predict the rain on the following day. Once all the libraries and the dataset is imported we check all the features and how they affect the other features. Using the .<em>describe()</em> functions gives a statistical report of the dataset. Other than that we can also use the .<em>info()</em> function to the datatype and the count of each column.</p><pre>#Reading the Data<br>data = pd.read_csv(&#39;weatherAUS.csv&#39;)<br>data.head()<br>#Understanding the Data<br>data.describe().transpose()<br>#Checking if there are any Missing Values<br>data.info()</pre><h4><strong>Missing Values</strong></h4><p>After understanding the dataset, we have to look out for the missing values. Missing Values in a dataset play a very important role in a project. If they are not treated, the results may not be accurate. As mentioned, we identify the missing values in each column by using .<em>info() </em>function. We can also use the .<em>isna()</em> function. Other than that we can visualize the missing values in the dataset by using the <em>missingno.matrix()</em> function which comes from the <em>missingno </em>library.</p><pre>#Finding number of Misssing Values in each column<br>data.isna().sum()<br><br>#visualizing missing values in each column<br>missingno.matrix(data, figsize = (30,20))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDq3GmUlX5bP4GcuONU-pA.png" /><figcaption>Visualization of Missing Values — the white spaces show Null values</figcaption></figure><p>With 145460 rows, we check how the missing values are effecting the columns. It is best that each column is normally distributed. To check the distribution of each column we would use the <em>.hist()</em> function. This would visualize each feature’s distribution.</p><pre>#Plotting each column<br>data.hist(bins=10 ,figsize=(16,12), color = &#39;royalblue&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kb-ysq5u720xF4dJvFzBA.png" /><figcaption>Distribution of features</figcaption></figure><p>We can notice only some of them are almost normally distributed (like, MinTemp, Humidity3pm, MaxTemp, Temp9am) while others are either right skewed or left skewed. We need to clean the dataset in order to make them normally distributed.</p><h4><strong>Treating Missing Values</strong></h4><p>There are different ways to treat missing values. The most common way to treat them is by deleting the missing values. However, it would be useful when there are only few missing values. Another technique is by adding the most common values to the null values. This way our dataset remains the same size and the missing values are treated.</p><pre># Treating missing values<br># missing numerical columns replaces with median<br>def r_num(df):<br>    for i in df.select_dtypes([&#39;int&#39;, &#39;float&#39;]):<br>        df[i] = df[i].fillna(df[i].median())<br>    return df<br><br># Replace missing object columns with mode<br>def r_obj(df):<br>    for i in df.select_dtypes(&#39;object&#39;):<br>        df[i] = df[i].fillna(method=&#39;ffill&#39;)<br>    return df<br><br>df = r_num(df)<br>df = r_obj(df)<br>df.info()</pre><p>There are 2 types of data in the dataset. The Numerical datatype missing values are treated by the use of median while the Object datatype values are treated by mode.</p><p>While checking the Normality of each column, some of the columns again show skewness and are not normally distributed. This can be due to the outliers present in them. We will treat them as we perform Exploratory data analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69yHuENS1mVqJRBXtkl_iw.png" /></figure><h4><strong>Correlation</strong></h4><p>Correlation refers to the statistical relationship between the two entities. It measures the extent to which two variables are linearly related.</p><pre>#Correlation<br>corr = df.corr()<br>#Plotting the Correlation<br>plt.subplots(figsize=(11,9))<br>sns.heatmap(corr,annot=True, square=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*jPnzchMAkB4pkis2-MDx9g.png" /><figcaption>Heatmap</figcaption></figure><p>Since our aim is to deal with the rain, we will check the collinearity of the features with the Rainfall. By this we can know which columns to keep and which ones to drop.</p><pre># extract the correlation coefficients for Rainfall column<br>rainfall_corr = corr[&#39;Rainfall&#39;]<br><br># print the correlation coefficients in descending order<br>print(rainfall_corr.sort_values(ascending=False))</pre><h3>Exploratory data analysis (EDA)</h3><p>EDA is an approach of analyzing data sets to summarize their main characteristics, often using statistical graphics and other data visualization methods.</p><p>We will be going through each feature and analyze them both statistically and visually.</p><h4><strong>Location</strong></h4><p>Plotting the dataset according to the location.</p><pre>#Counting the number of data in each place<br>df.Location.value_counts()<br>#plotting the location of the data where it is collected from<br>sns.set(rc={&#39;figure.figsize&#39;:(15,6)})<br>sns.countplot(data=df, x=&quot;Location&quot;)<br>plt.xticks(rotation=90)<br>plt.grid(linewidth = 0.6)<br>plt.show()</pre><p><em>Seaborn allows us to plot the graph in a colourful manner.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I_c6UggxoBnaD_b7OWO-Pg.png" /></figure><h4><strong>Wind Direction</strong></h4><p>We try to understand the direction of the wind through out the day that could encourage Rainfall.</p><pre>sns.set(rc={&#39;figure.figsize&#39;:(13,6)})<br>fig, ax =plt.subplots(3,1)<br><br>sns.countplot(data=df,x=&#39;WindDir9am&#39;,ax=ax[0])<br>sns.countplot(data=df,x=&#39;WindDir3pm&#39;,ax=ax[1])<br>sns.countplot(data=df,x=&#39;WindGustDir&#39;,ax=ax[2])<br>fig.tight_layout()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_iYLD40j52rd9JYL0EKwBg.png" /></figure><p>We have 3 graphs showing the wind direction at different times of the day. First at 9 AM , 3 PM and then we have the Wind Gust Direction.</p><ul><li>At 9 AM the wind direction is mostly in the North and least in the West Southwest.</li><li>Similarly, the wind at 3pm is mostly in the South East and least in the North Northeast.</li><li>The Wind Gust Direction is mostly in the West and least in the North Northeast like the 3PM wind</li></ul><h4><strong>Rain Today and Rain Tomorrow</strong></h4><p>We are grouping 2 features and analyzing them.</p><pre>fig, ax =plt.subplots(1,2)<br>print(&quot;Rain Today Value Count: \n&quot;, df.RainToday.value_counts())<br>print(&quot;\nRain Tomorrow Value Count: \n&quot;,df.RainTomorrow.value_counts())<br><br>plt.figure(figsize=(19,18))<br>sns.countplot(data=df,x=&#39;RainToday&#39;,ax=ax[0])<br>sns.countplot(data=df,x=&#39;RainTomorrow&#39;,ax=ax[1])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MA_la0tI9Gx-mqsyxFz8Ng.png" /></figure><h4><strong>Rainfall</strong></h4><p>Even though we found the linearity of Rainfall with the other features, we still need to analyze it in other aspects. We will be finding the Rain in different periods of time.</p><pre>#Rainfall per month<br>df[&#39;Date&#39;] = pd.to_datetime(df[&#39;Date&#39;], errors=&#39;coerce&#39;)<br>rainfall =[df[&#39;Date&#39;].dt.year, df[&#39;Date&#39;].dt.month, df[&#39;Rainfall&#39;]]<br>headers = [&#39;Year&#39;, &#39;Month&#39;, &#39;Rainfall&#39;]<br>rainfall_df = pd.concat(rainfall, axis=1, keys=headers)<br><br>plt.figure(figsize=(10,8))<br>a = rainfall_df.groupby(&#39;Month&#39;).agg({&#39;Rainfall&#39;:&#39;sum&#39;})<br>a.plot(kind=&#39;bar&#39;, color=&#39;blue&#39;)<br>plt.title(&#39;Rainfall distribution in each month&#39;, fontsize=15)<br>plt.xlabel(&#39;Month&#39;, fontsize=10)<br>plt.ylabel(&#39;Rainfall (in mm)&#39;, fontsize=10)<br>plt.xticks(rotation=0)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1GYsY46T2nyV2QyoCAC1Q.png" /></figure><p>With the graph we see that October has the least amount of Rain. However March experiences the most rain throughout the year. It might be due to the seasonal changes.</p><pre>#Rainfall per year<br>a = rainfall_df.groupby(&#39;Year&#39;).agg({&#39;Rainfall&#39;:&#39;count&#39;})<br>a.plot(kind=&#39;bar&#39;, color=&#39;green&#39;)<br>plt.title(&#39;Rainfall distribution in each year&#39;, fontsize=15)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QABfpZojkwrVvtY_ekHHjQ.png" /></figure><p>As for Year, 2008 appears to be the least rained year that can be because the dataset starts from the middle of the year 2008. We can see that 2014, 2015, 2016 are the most rained years and have almost equal rain counts.</p><pre>#plotting Rainfall by Location<br>plt.figure(figsize=(13,8))<br>plt.scatter(df[&#39;Location&#39;],df[&#39;Rainfall&#39;], color=&#39;darkgoldenrod&#39;)<br>plt.xlabel(&quot;Location&quot;)<br>plt.xticks(rotation=90)<br>plt.title(&#39;Rainfall(mm) in each location&#39;, fontsize=15)<br>plt.ylabel(&quot;Rainfall&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWmi-b85CrDwlfJQmoqheg.png" /></figure><p>By analyzing the rainfall in different areas we can see that Crains, Brisbane, Townville, Darwin, and CoffsHarbours have experienced more rain as compared to other locations. The driest rain being in Nhil that may be because it has less data.</p><h4>Outliers</h4><p>Once we have analyzed various features of Data, it’s time to treat the outliers that had caused abnormality of the columns. The best way to check the outliers is by plotting boxplots. Scatterplots also help in visualizing the outliers. But, here we would use boxplots for each features of the data.</p><pre>#outliers<br>plt.figure(figsize=[25,15])<br>df.boxplot(column= [&#39;MinTemp&#39;, &#39;MaxTemp&#39;, &#39;Rainfall&#39;, &#39;Evaporation&#39;, <br>                    &#39;Sunshine&#39;, &#39;WindGustSpeed&#39;, &#39;WindSpeed9am&#39;, <br>                    &#39;WindSpeed3pm&#39;, &#39;Humidity9am&#39;, &#39;Humidity3pm&#39;, <br>                    &#39;Cloud9am&#39;, &#39;Cloud3pm&#39;, &#39;Temp9am&#39;, &#39;Temp3pm&#39;])<br>plt.xticks(rotation=50)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Czp1JctfTrAZIdeyAuBWkQ.png" /><figcaption>Boxplot of all the columns</figcaption></figure><p>Instead of visualizing we can also find the outliers by checking the z-score of the data or using the IQR method to extract them.</p><h4><strong>Treating the Outliers</strong></h4><p>There are many ways to treat the outliers. The most common way to deal with outliers is by deleting them. This method is useful when there are less amount of outliers as the loss of few data points would not affect the analysis. Another common method is by rescaling the outliers. This way, the data doesn’t get deleted and is further normalized.</p><p>In this project, we will drop the outliers as we don’t have to worry about data points being lost.</p><pre>#treating the outliers<br>threshold = 0.04<br>for col in df:<br>    if df[col].dtype==&#39;float64&#39;:   <br>    # Lower and upper threshold<br>        lower_threshold = df[col].quantile(threshold)<br>        upper_threshold = df[col].quantile(1-threshold)<br>    <br>    # Dropping the values below lower threshold and beyond upper threshold<br>        df = df[(df[col]&gt;=lower_threshold) &amp; (df[col]&lt;=upper_threshold)]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kAdzWlNCECICB0d_kN1kKA.png" /><figcaption>Boxplot after treating the Outliers</figcaption></figure><p>We are setting the threshold and calculating the IQR. With the IQR set, we will be dropping the values that are out of the range. Even though the outliers are treated, there are still some left. We won’t handle them as the remaining outliers are barely few, it will not be affecting the overall data by a large scale.</p><p>If we check the distribution of each feature now, it would appear as though all of them are normally distributed.</p><h3>Data Encoding</h3><p>As we performed the EDA, we noticed each feature is of different datatype. We will need to convert them in a single format in order to perform further analysis — this method is called data encoding.</p><pre>#Converting into numerical<br>df[&#39;RainTomorrow&#39;] = df[&#39;RainTomorrow&#39;].map({&#39;Yes&#39;: 1, &#39;No&#39;: 0})<br>df[&#39;RainToday&#39;] = df[&#39;RainToday&#39;].map({&#39;Yes&#39;: 1, &#39;No&#39;: 0})<br>print(df[&#39;RainToday&#39;].head(3))<br>print(df[&#39;RainTomorrow&#39;].head(3))<br><br>#Encoding categorical variables to numeric ones<br>from sklearn.preprocessing import LabelEncoder<br>for c in df.columns:<br>#Since we are encoding object datatype to integer/float<br>    if df[c].dtype==&#39;object&#39;:    <br>        lbl = LabelEncoder()<br>        lbl.fit(list(df[c].values))<br>        df[c] = lbl.transform(df[c].values)</pre><p>Once the Data is encoded, we will be dropping the Date column, as we won’t be needing it.</p><h3>Splitting Data</h3><p>With the pre-processed data, we will be splitting the data into training and test set to perform different modelling techniques. We can also set a validation set on the data. However, it is necessary when we perform Hyperparameter tuning and the validation set is extracted from the training set.</p><p>Here we won’t be needing a validation set. So, the data is split into training and test split in the ratio of 70:30.</p><pre># spliting training and testing data<br>X = df.drop([&#39;RainTomorrow&#39;], axis = 1)<br>y = df[&#39;RainTomorrow&#39;]<br><br>X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.3,random_state=27)<br><br>print(&#39;x_train shape is: &#39;, X_train.shape)<br>print(&#39;y_train shape is: &#39;, y_train.shape)<br>print(&#39;x_test shape is: &#39;, X_test.shape)<br>print(&#39;y_test shape is: &#39;, y_test.shape)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*C2EQ8ofx6lhIs3cWM9gkag.png" /></figure><p>Since the target variable is RainTomorrow, we will be dropping it and only having it in the ‘y’ data frame.</p><h3>Data Modelling</h3><p>There are various kinds of models that can be used. However, we will be using only a few models to predict the Rain.</p><h4><strong>Gaussian Na</strong>ï<strong>ve Bayes</strong></h4><p>It is a very common machine learning classification algorithm that assumes naïve independence between features. It simplifies the modeling process, is efficient, and can handle large datasets with many features. In the Rainfall data, some of the features, such as temperature, humidity, and wind speed, can be assumed to follow a Gaussian distribution. Gaussian NB takes advantage of this assumption to estimate the likelihood of rain. The probabilistic nature allows for easy interpretation and understanding of the model’s predictions.</p><pre>#GaussianNB Model<br>model = GaussianNB()<br>model.fit(X_train, y_train) # Train the model on the training data<br>  <br>predicted = model.predict(X_test)  <br>#classification Report    <br>from sklearn.metrics import classification_report<br>print(classification_report(y_test, predicted))<br><br>print(&quot;The accuracy of Gaussian Naive Bayes model is : &quot;, accuracy_score(y_test, predicted)*100, &quot;%&quot;)<br>print(&quot;\nF1 score for Gaussian Naive Bayes is :&quot;,f1_score(y_test, predicted,)*100, &quot;%&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*Ne4i_1WZbmNYj1N5R_wZyA.png" /></figure><p>The model was evaluated using a classification report that said the model was 81% accurate. We still need to look at other models’ performance to find the best fit model.</p><h4><strong>Linear Regression</strong></h4><p>Linear regression allows us to assess the linear relationship between the independent variables and the dependent variable (RainTomorrow). It is efficient and simple compared to other complex modeling techniques. It is used for predictive purposes by estimating the probability of rain tomorrow based on other features.</p><pre># Create a linear regression model<br>model = LinearRegression()<br><br># Train the model on the training data<br>model.fit(X_train, y_train)<br><br># Make predictions on the test data<br>predicted = model.predict(X_test)<br><br># Evaluate the model using R-squared<br>r2 = r2_score(y_test, predicted)<br>print(&quot;The R-squared score of the linear regression model is:&quot;, r2)<br>mse = mse_(y_test, predicted)<br>print(&quot;Mean squared error: &quot;, mse)<br><br># Evaluate the model using RMSE<br>rmse = np.sqrt(mse)<br>print(&quot;Root Mean Squared Error: &quot;, rmse)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*8qcl9_0GKLHUYMWGPHM-lg.png" /></figure><p>In order to evaluate the model’s performance, we are using R-sqaured, MSE and RMSE.</p><ul><li>The R-squared score of the linear regression model is a measure of how well the model fits the data. It ranges from 0 to 1, higher values is equals to better fit. Here the R-squared score is 0.156, which means that the model explains only 15.6% of the variability in the target variable.</li><li>The mean squared error (MSE) is a measure of the average squared difference between the predicted values and the actual values. A lower MSE always have better performance. In this case, the MSE is 0.107, meaning, the predicted values are about 0.107 units away from the actual values.</li><li>The root mean squared error (RMSE) is the square root of the MSE and is also a measure of the average difference between the predicted and actual values, but it is in the same units as the target variable. Here, the RMSE is 0.327, which means that, the predicted values are about 0.327 units away from the actual values.</li></ul><h4><strong>Logistic Regression</strong></h4><p>This statistical technique is widely used for binary classification problems. It models the relationship between predictor variables (e.g., temperature, humidity) and the probability of rain. It can handle imbalanced datasets, capture non-linear relationships, and allows the modeling of complex relationships.</p><pre># Initiatlize the model<br>logreg = LogisticRegression(solver=&#39;liblinear&#39;, random_state = 0)  <br>#liblinear is optimized for high dimensionality and can handle sparse input data. <br><br>logreg.fit(X_train, y_train) # Fit the model<br>y_pred_test = logreg.predict(X_test) # Predict data points <br><br>print(classification_report(y_test, y_pred_test))<br># Print accuracy scores<br>print(f&#39;Model accuracy score: {round(accuracy_score(y_test, y_pred_test) * 100, 3)}%&#39;)<br>print(f&#39;Training set score: {round(logreg.score(X_train, y_train) * 100, 3)}%&#39;)<br>print(f&#39;Test set score: {round(logreg.score(X_test, y_test) * 100, 3)}%&#39;)<br>print(&quot;F1 score for Logistic Regression model is :&quot;,f1_score(y_test, y_pred_test,)*100, &quot;%&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*5LARw5ZixpjPd5VWGkxSVw.png" /></figure><p>We evaluated the model by extracting the classification report of the model that tells us about the accuracy, F1 score, precision, and Recall. Moreover, we perform a cross-validation on the model and visualize it.</p><pre>#Cross Validation for logistic regression<br>from sklearn.model_selection import cross_validate<br>results = cross_validate(estimator = logreg,<br>                        X = X_train,<br>                        y = y_train,<br>                        cv = 9,<br>                        scoring = [&#39;accuracy&#39;, &#39;precision&#39;, &#39;recall&#39;,&#39;f1&#39;],<br>                        return_train_score = True)<br>results</pre><pre>labels = [&#39;1st Fold&#39;, &#39;2nd Fold&#39;, &#39;3rd Fold&#39;, &#39;4th Fold&#39;, &#39;5th Fold&#39;, &#39;6th Fold&#39;, &#39;7th Fold&#39;, &#39;8th Fold&#39;, &#39;9thFold&#39;]<br>x_axis = np.arange(len(labels))<br><br>plt.figure(figsize = (15, 7))<br>plt.bar(x_axis - 0.2, results[&#39;train_accuracy&#39;], width = 0.4, color = &#39;indigo&#39;, label = &#39;Training&#39;)<br>plt.bar(x_axis + 0.2, results[&#39;test_accuracy&#39;], width = 0.4, color = &#39;peru&#39;, label = &#39;Validation&#39;)<br>plt.xticks(x_axis,labels)<br>plt.ylim(0.5,1)<br>plt.legend()<br>plt.title(&#39;Accuracy Scores in 9 Folds&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bL5rEXPXTX-W9FyfAlajhg.png" /></figure><p>The Accuracy Score of the Training and Validation is almost same throughout the 9 folds. This appears to be a good result as both Training and Validation is in the same range that is around 86% and almost similar.</p><h4><strong>K — Nearest Neighbor</strong></h4><p>KNN is a versatile machine learning model for classification and regression tasks. It is a non-parametric algorithm that doesn’t assume an underlying data distribution. KNN identifies clusters by considering the nearest neighbors. The key hyperparameter is K, representing the number of neighbors considered.</p><pre># Create a KNN model with k=5<br>model = KNeighborsClassifier(n_neighbors=5)<br># Train the model on the training data<br>model.fit(X_train, y_train)<br><br># Make predictions on the test data<br>predicted = model.predict(X_test)<br><br># Evaluate the model using accuracy<br>accuracy = accuracy_score(y_test, predicted)<br>print(classification_report(y_test, predicted))<br>print(&quot;The accuracy of KNN model is : &quot;, accuracy_score(y_test, predicted)*100, &quot;%&quot;)<br>print(&quot;\nF1 score for KNN model is :&quot;,f1_score(y_test, predicted,)*100, &quot;%&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*PkrHAf0sRdGbCjHxfQvGFQ.png" /></figure><pre># Create a KNN model with k=9<br>model = KNeighborsClassifier(n_neighbors=9)<br><br># Train the model on the training data<br>model.fit(X_train, y_train)<br><br># Make predictions on the test data<br>predicted = model.predict(X_test)<br><br># Evaluate the model using accuracy<br>accuracy = accuracy_score(y_test, predicted)<br>print(classification_report(y_test, predicted))<br>print(&quot;The accuracy of KNN model is : &quot;, accuracy_score(y_test, predicted)*100, &quot;%&quot;)<br>print(&quot;\nF1 score for KNN model is :&quot;,f1_score(y_test, predicted,)*100, &quot;%&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*64YBbocmPrNmv7D6pPOW_g.png" /></figure><p>To check the performance of the model, a cross validation was done with both 5 and 9 folds. The accuracy of k=5 was 85% whereas k=9 had a better accuracy, 86%. However, it isn’t much better than Logistic Regression as the accuracy score is still less, 85.60%. Even the F1 score appears to be less, 25.33% but more than that of Logistic Regression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmGx2C9keKm89KPp2Po94A.png" /></figure><p>While visualizing the KNN cross validation for 9 folds, the Accuracy Scores through the 9 folds appears to be in the range of 85–90 %. The Training Accuracy has always been higher than the validation accuracy score.</p><p>As compared to the logistic regression model, the accuracy score of both training and validation of KNN don’t match and have a bigger difference than the one in the logistic regression.</p><h3>Model Evaluation</h3><p>We divided the data into training and test dataset. For models we used <strong>Gaussian Naïve Bayes, Linear Regression, Logistic Regression</strong> and <strong>KNN</strong>. We have even cross validated the models and checked their accuracy through 5 or 9 folds. To compare each model, we got the following results:</p><ul><li>Gaussian Naïve Bayes had an accuracy of 81%,</li><li>Linear Regression was fit but the R — squared wasn’t high enough and the mean squared error was quite high.</li><li>Logistic Regression was 86% accurate.</li><li>KNN had 85% accuracy score for both 5 and 9 folds</li></ul><p>With the accuracy score we can conclude that the <strong>Logistic Regression is the most fit model</strong> for this dataset. The dataset might give better results with other models like Random Forest, and XGB Classifier as they have better outlier handling capacity and provide feature importance rankings, which can help in identifying the most relevant features for prediction. We can always experiment and discover more ways to solve a problem.</p><h3>Conclusion</h3><p>From this dataset, we learn ways to deal with any data science project. The very first step, Data Cleaning plays a critical role in any project. In order to clean, there are various techniques one can use. Understanding what data is trying to tell is another important step, we use EDA to understand it. Even after cleaning not all data is ready to be fit for training or testing, that’s where the data preprocessing comes in that allows us to make the data usable. It involves treating the outliers, normalization, and converting into the same format. The cleaned and processes data is ready for training and testing. We can then use various types of models and evaluate the results. Feature selection and evaluation techniques helps in understanding the value of the features with the target variable, in any project. Following these steps, any dataset can be easily analyzed to find insightful information.</p><blockquote>In the realm of data science projects, embracing experimentation is a key to success.</blockquote><p>Exploring diverse methodologies, algorithms, and techniques not only enriches our understanding of the data but also empowers us to discover novel insights and optimize our models effectively.</p><h3>Hope you find this article useful!</h3><p>To stay updated with me,</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li><li>Check my <a href="https://github.com/Sahar-TJ">Github</a> for more projects</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ade28df98348" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Statistics for Data Science]]></title>
            <link>https://sahar-tj.medium.com/statistics-for-data-science-ef52fde3fb4c?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef52fde3fb4c</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-scientist]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Fri, 04 Nov 2022 18:10:29 GMT</pubDate>
            <atom:updated>2022-11-04T18:10:29.983Z</atom:updated>
            <content:encoded><![CDATA[<h4>Fundamentals of Statistics</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4l9-4ZE6-H0RVXq6brFyJQ.jpeg" /></figure><p>These days Data Science is used in almost every industry. It is the study that deals with data, more like, extracting information using various tools and techniques. This information later helps in taking the right decisions that are in favor of the firm.</p><p>In Data Science there are few skills needed. One must be proficient with some coding, domain knowledge and lastly, Mathematics and Statistics. Statistics is the core skill of Data Science and Analytics.</p><blockquote>This article aims to cover most of the statistical concepts that are required in Data Science and Analytics. It will be divided into a series of articles that will be published later.</blockquote><h4><strong>What exactly is Statistics?</strong></h4><p>Statistics is a wide concept that deals with gathering, organizing and analyzing the data to get meaningful insights. Statistics are at the core of data science. A sturdy handle on statistics can help you extract more intelligence and obtain more meaningful results.</p><blockquote>Statistics is a mathematical body of science that pertains to the collection, analysis, interpretation or explanation, and presentation of data. -Wikipedia</blockquote><p>Without a doubt, the role of statistics in the data world cannot be undervalued. As it is used to understand real-world complex problems and simplify them into good decisions.</p><h4>Branches of Statistics</h4><p>Statistics is divided into 2 categories, Descriptive Statistics and Inferential Statistics. Both of them are equally important.</p><ul><li><strong>Descriptive Statistics</strong></li></ul><p>Descriptive Statistics is used to describe the characteristics of the data. It consists of organizing and summarizing data. It is usually the first step of Statistical Analysis. Describing the summary of data, numerically or graphically. It includes methods such as average, mode, median, standard deviation and so on.</p><ul><li><strong>Inferential Statistics</strong></li></ul><p>It is a technique where we use data to form conclusions. Inferential statistics allows to test a hypothesis on a larger population. It involves using random samples of data from the population. Inferential statistics can be contrasted with descriptive statistics. As it focuses on making predictions, it’s results are in the form of probability.</p><p>Both descriptive and inferential statistics go hand in hand and one cannot exist without the other.</p><h4>Population</h4><p>Collection of elements or individuals from which insights are concluded.</p><h4>Sample</h4><p>a part or subset of data that represents the population.</p><h4>Sampling Techniques</h4><p>It is obvious that we can’t test the whole population data, as it can be a lot to handle. Hence, the method of sampling comes in handy when that data is collected in the form of samples from the population data and tested.</p><p><strong>Probability Sampling</strong></p><p>Probability sampling allows every member of the population a chance to get selected. It is mainly used in quantitative research when you want to produce results representative of the whole population.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*KC6oL5hn9_sUrihYdkDr5w.png" /><figcaption>Probability Sampling Techniques</figcaption></figure><ul><li><strong>Simple Random Sampling: </strong>As the name suggest, samples are gathered randomly from the population data and each variable has equal chance of being selected.</li><li><strong>Systematic Sampling: </strong>This sampling technique selects every n<em>th </em>element of the population data. Example: choosing every 4th variable of the data as a sample.</li><li><strong>Stratified Sampling: </strong>In this, the population is split into categories, (called strata) of similar properties (like height, age). Samples are then collected from each strata using random or systematic sampling.</li><li><strong>Cluster Sampling: </strong>Similar to Stratified Sampling is Clustering Sampling. Here, the population is divided into subgroups (clusters) that are randomly selected from the population data. Later, these clusters are selected as sample.</li></ul><p><strong>Non-Probability Sampling</strong></p><p>In a non-probability sample, individuals are selected based on non-random criteria, and not every individual has a chance of being included. This type of sample is easier and cheaper to access, but it has a higher risk of sampling bias.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*siate3bZNrNCMCkqsiBxig.png" /><figcaption>Non-Probability Sampling Techniques</figcaption></figure><ul><li><strong>Convenience Sampling: </strong>In this type of sampling, the sample should have experience with the required field of knowledge.</li><li><strong>Voluntary Response Sampling: </strong>Similar to convenience sampling, the sample consists of people who have the required knowledge. However, they volunteer themselves rather than being selected by a researcher.</li><li><strong>Snowball Sampling:</strong> The researcher recruits the individuals. It is used in difficult cases. Like the snowball, the sample grows along its way.</li><li><strong>Purposive Sampling: </strong>Also known as Judgement Sampling, involves the researcher using their expertise to select a sample that is most useful to the purposes of the research.</li></ul><h4>Variables</h4><p>A variable is a characteristic or element that can be measured and that can have different values. It is a property that can take up any value. There are 2 types of variables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*oYdmcRqn76fsixP9Exbi6g.png" /></figure><p><strong>Quantitative Variables</strong></p><p>It refers to those data points or variables that are measurable. We can perform basic arithmetic operation like addition, subtraction and so on. It is also known as Numeric Variable.</p><ul><li><strong>Discreate Variables: </strong>It consists of absolute numbers in a range. <em>Example, 2, 4, 62, -23.</em></li><li><strong>Continuous Variables: </strong>It can take up any value within a range, including decimal values. Can consists of uncountable number of values within a range.<em> Example, 2.5, 34.7, 593.645</em></li></ul><p><strong>Qualitative Variables</strong></p><p>These type of data points can be divided into categories but cannot be measured. It is also known as Categorical Variable.</p><ul><li><strong>Nominal Variables: </strong>It has names or labels associated with it. It doesnt have any numerical value. <em>Example, Gender, Colour.</em></li><li><strong>Ordinal Variables: </strong>Ordinal data is similar to nominal data except there are categories that can be placed in distinct order or hierarchy. <em>Example, Rank, Grade.</em></li></ul><h3>Statistical Measures</h3><h4>Measure of Frequency</h4><p>Frequency statistics simply count the number of times that each variable occurs, such as the number of males and females within the sample. The measure of frequency are</p><ul><li><strong>Percentage:</strong> a rate, number, or amount in each hundred.</li><li><strong>Number: </strong>a value</li></ul><h4>Measure of Spread</h4><p>Also known as measure of dispersion. Measure of spread is statistical measure that describe the similarity and variety of the values of given datasets. We cannot rely solely on central tendency measures as summary description as it can be very misleading.</p><ul><li><strong>Range:</strong> the distance between each value in a data set.</li><li><strong>Variance:</strong> the distance between a variable and its expected value.</li><li><strong>Standard deviation:</strong> the dispersion of a data set from the mean.</li></ul><h4>Measure of Position</h4><p>A measure of position determines the position of a single value in relation to other values in a sample or a population data set. Relies on standardized scores. Used when you need to compare scores to a normalized score. The most common measures of position are percentiles, quartiles, and standard scores (z-scores).</p><ul><li><strong>Percentile: </strong>a number where a certain percentage of scores fall below that number.</li><li><strong>Quartiles: </strong>set of values which has three points dividing the data set into four identical parts.</li><li><strong>Standard Score: </strong>Figures out where the value will lie on the graph.</li></ul><h4>Measure of Central Tendency</h4><p>The term “central tendency” refers to measurements that focus on a dataset’s typical central values. This does not just refer to the central value within an entire dataset, which is called the median. Instead, it is a general term used to describe a variety of central measurements. For example, it might include central measurements from different quartiles of a larger dataset. Common measures of central tendency include:</p><ul><li><strong>Mean:</strong> The average value of all the data points.</li><li><strong>Median:</strong> The central or middle value in the dataset.</li><li><strong>Mode:</strong> The value that appears most often in the dataset.</li></ul><h4>Hypotheses Testing</h4><p>Hypothesis testing is a form of statistical inference that uses data from a sample to draw conclusions about a population parameter. Hypotheses Testing identifies which assumption regarding the population data is correct and guides in taking the right action towards it. There are other tests as well like A/B Testing, Z Test, T-Test and so on.</p><h4>Distribution</h4><p>Data distribution is an essential component. One of the most used distributions, like the Normal Distribution is very significant. It has Mean, Mode, and Median all coincide at the central peak. These data are supposed to be very accurate data. Besides normal distribution, there are many more types of statistical distribution in which data is distributed.</p><h3>Conclusion</h3><p>We have now understood some of the basic concepts of Statistics that is needed in Data Science to get started. Of course, statistics itself is a wide concept. Hence there will be more articles coming up soon that would dive deep into statistics. Stay Tuned!</p><h3>Resources</h3><ul><li>Google</li><li>Medium</li><li>Youtube — Krish Naik and many more channels</li><li>Wikipedia</li><li>Canva</li></ul><h3>Hope you find this article useful!</h3><p>To stay updated with me,</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef52fde3fb4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Data Analytics Professional Certificate Review]]></title>
            <link>https://medium.com/analytics-vidhya/google-data-analytics-professional-certificate-review-d46011e06134?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/d46011e06134</guid>
            <category><![CDATA[review]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[coursera]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Sat, 19 Jun 2021 16:35:43 GMT</pubDate>
            <atom:updated>2021-06-30T09:00:53.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b7Jz-PTxQYRFhmglmHn1mw.jpeg" /></figure><p>Google stated last year that it will develop a certificate program that would not require a college diploma and could be completed in three to six months. Google even claims that the certificate will be considered equivalent to a four-year college degree. Self-paced, low-cost, and highly valuable are all factors to consider before taking up any course. All of these features are available with Google’s professional certificate.</p><p>After waiting for the job-guaranteed certificate eagerly, in March 2021, Google launched it’s <a href="https://www.coursera.org/professional-certificates/google-data-analytics?">Data Analytics Professional Certificate</a> along with other certificate programs that focused on Project Management and User Experience Design. We won’t be talking about them here.</p><p>Google employees teach the most in-demand skills needed for an entry-level Data Analyst in this course. To complete it, all that is needed is approximately 10 hours of study per week.</p><p>By studying for at least 5 hours every day, I was able to earn the Professional Certificate in less than 3 months. Yes, the pandemic freed up a lot of my time. If I hadn’t taken so many breaks, I’m confident I could have finished it in under two months. Some of my peers were able to get their diplomas in less than a month. Don’t believe it? Well, the trick is to be disciplined and dedicated.</p><h3>About the Data Analytics Professional Certificate</h3><p>The Professional Certificate is made up of eight courses in total. One of which is a Capstone Project. Each course is arranged into four to five weeks, with graded weekly quizzes and a course quiz at the end. Just before the weekly quizzes, a glossary of the terms acquired over the week is provided to the learners. Let’s take a look at what each course enlightens us with and what I loved about them.</p><h4><strong>Foundations: Data, Data, Everywhere!</strong></h4><p>This is a foundational course for those who want to learn the fundamentals of data. It provides an overview of the field of data analytics. Teaching how the Professional Certificate is broken down into sections and what we will study in each.</p><p>The topics covered in this course are:</p><ul><li>The 5 essential skills of a Data Analyst.</li><li>The 5 key aspects of Analytical Thinking.</li><li>Lifecycle of Data.</li><li>The Steps/Phases of Data Analysis.</li><li>Tools a Data Analyst uses in a Data Ecosystem.</li><li>Lastly, job opportunities and best practices for job search.</li></ul><p><em>Quick heads-up, the professional certificate is divided by the phases of the Data analysis process.</em></p><p>What I liked the most was Data Journal also known as Learning Logs, which encourages the learners to take notes and answer the questions according to their understanding.</p><h4><strong>Ask Questions to make Data-Driven Decisions</strong></h4><p>The very first Phase of the Data Analysis process, known as the “Ask Phase”, is what the course is based on.</p><p>This course addressed the following topics:</p><ul><li>Asking effective Questions using SMART Methodology</li><li>Questions to avoid while asking</li><li>Types of Data</li><li>Data presentation tools and their use</li><li>Small Data vs. Big Data</li><li>Brief exposure to Spreadsheets</li><li>Types of Stakeholders and their roles in the project</li><li>How to work with the stakeholders and tips for Communication</li></ul><p>My favourite part about this course was how a data analyst should make a Scope of Work for the project they are working on. It helps in keeping track of the workflow of the project. The SOW consists of Deliverables, Milestones, Timeline, and Reports in order for the project to meet its deadlines and goals through excellent planning and coordination by the team members.</p><h4>Prepare Data for Explorations</h4><p>“Prepare Phase”, the second step of the Data Analysis process. Tells how one needs to prepare the data before starting with the Data Analytics project.</p><p>It teaches about:</p><ul><li>How data is collected.</li><li>Considerations for Data Collection</li><li>The different Formats of Data</li><li>Data types and how to identify good Data</li><li>Bias and it’s types</li><li>Aspects of Data Ethics</li><li>Data Privacy and Data Security</li><li>Lastly, some SQL Basics</li><li>Getting started with Linkedin and Kaggle.</li></ul><p>The part that excited me the most in this course was it’s introduction to Kaggle and how one can get started. I had only used Kaggle to check Notebooks and competitions up until now, but this prompted me to sign up.</p><h4>Process Data from Dirty to Clean</h4><p>Moving on to the very next step of the Data Analysis process, the “Process Phase”. This 6-week long course focused more on Data Cleaning processes. Technically it’s a 5-week course as the 6th week is just a course challenge.</p><p>Topics discussed in this course were:</p><ul><li>Statistical measures associated with data integrity including statistical power, hypothesis testing, and margin of error</li><li>Data integrity with reference to types and risks</li><li>Data Cleaning techniques</li><li>Cleaning Data in Spreadsheets and SQL</li><li>Documenting Data Cleaning process</li><li>Elements of a Data Analyst resume</li></ul><p>Data Integrity was one fascinating topic in this course.<em> It is the accuracy, completeness, consistency, and trustworthiness of Data throughout it’s lifecycle. </em>To ensure Data Integrity, Data cleaning comes into the picture.</p><h4>Analyze Data to Answer Questions</h4><p>Analysis, is what the course is based on.<em> The process that is used to make sense of the data collected.</em> The “Analyze Phase” of the Data Analysis process is discussed here.</p><p>Topics covered were:</p><ul><li>Data Analysis Basics</li><li>Organizing Data for analyzing</li><li>Sorting Data in Spreadsheet and SQL</li><li>Converting and Formatting Data</li><li>Combining multiple Datasets</li><li>Data aggregation using VLOOKUP and JOINS</li><li>Pivot Tables and Data Validation process.</li></ul><p>I enjoyed learning the JOIN clause in SQL as it was one of the things that I always struggled with, and the videos were extremely helpful in making me understand it.</p><p>Although this course explains how to analyze data in both SQL and Spreadsheets, it was sometimes confusing to grasp the functions as the videos were mixed up.</p><h4>Share Data through the Art of Visualization</h4><p>This course was the most intriguing section of the Professional Certificate. The “Share Phase” of the Data Analysis process was taught here. It demonstrates how to get started with Tableau, a data visualization tool.</p><p>Went through the following topics:</p><ul><li>Communicating Data insights</li><li>Frameworks for organizing Visualizations</li><li>Principles of Design</li><li>Phases of Design Thinking</li><li>Data Storytelling</li><li>The Art and Science of Effective Presentation</li></ul><p>I enjoyed every minute of this course because it introduced me to Tableau and provided excellent presentation tips. Another notion that I liked was Data Storytelling, which teaches people how to make their stories more engaging to their audience.</p><h4>Data Analysis with R Programming</h4><p>The professional certificate’s last course teaches how to run codes in Rstudio using the R programming language. It also covers the “Act Phase” of the Data Analysis Process in the end.</p><p>The course covers the following topics:</p><ul><li>Basic programming concepts</li><li>Exploring R packages</li><li>Cleaning Data in R</li><li>Creating Data Visualizations in R</li><li>Developing Documentations and Reports in R</li></ul><p>In this course we learned how to clean, process, manipulate, visualize, and document using the R programming language. It was a combination of all the previous courses.</p><p>The hands-on activities were the most beneficial, as they allowed me to practice using Rstudio. Although getting started with Rstudio was a little difficult at first, practice made it easier.</p><h4>Google Data Analytics Capstone: Complete a Case Study</h4><p>The Final course of the professional certificate, which is a capstone project. It isn’t necessary to complete it, however, it is required in order to obtain the Google Data Analytics Professional Certificate.</p><p>There are two tracks on the course. The learners must select one of the tracks and apply their knowledge to clean, process, manipulate and analyze the data. Lastly, they had to present their insights and recommend the right steps to take for solving the case study.</p><p><strong>Track 1</strong></p><ul><li>Case Study 1: Cyclistic Bike-Share</li><li>Case Study 2: Bellabeat smart devices</li></ul><p><strong>Track 2</strong></p><ul><li>Here the learners need to choose their own case study and give valuable insights.</li></ul><p>The learners were also instructed on how to build a portfolio and what resources they could use to do so.</p><p>My favourite part was the mock interview that was presented at the end of the course. Teaching about the interview process, how the candidates can introduce themselves, solve case studies during the interview and negotiate the contract.</p><h3>Conclusion</h3><p>The article has now come to an end. The Google Data Analytics Professional Certificate, in my opinion, is perfect for anyone interested in getting started with data analysis. The coursework is well-presented, and it equips students with the necessary fundamental knowledge of Data Analysis.</p><p>Being from a technical background, I found it a little pointless at the start because I was already familiar with SQL and spreadsheets, but as I continued through the course, I learned a variety of new concepts and tools</p><p>Once you are done with the course you will get one-year free membership of Coursera’s BigInterview which assists you in preparing for interviews. Apart from that you can register to Coursera Job Platform and Career Circle.</p><p>Upon completion of the certificate, you will have the option to share your information with top U.S. employers that are hiring entry-level professionals, like Cognizant, H&amp;R Block, Hulu, JM Smucker, Infosys, Intel, KForce, MCPc, PNC Bank, RICOH USA, TEKSystems, UPMC, Veterans United Home Loans, Walmart and of course, Google. Currently, access to jobs in the employer consortium is only available to those eligible to work in the U.S., but it is expanding to India, Europe, and other regions soon.</p><p>Overall, the course is perfect for any beginner and even intermediate in the field of data. However, one shouldn’t entirely depend on it because they believe they know everything about Data.</p><blockquote>The aspirants must master the topics in-depth on their own, as learning never stops in the data domain.</blockquote><p>Why would I say something like that? Well, the field of Data is large and is rapidly expanding every day, every second. As a result, there will be no end to learning new technologies and concepts.</p><h3>Hope you find this article useful!</h3><p>To stay updated with me,</p><ul><li>Connect with me on <a href="https://www.linkedin.com/in/sahar-tosif-jamal/">LinkedIn</a></li><li>Follow me on <a href="https://twitter.com/Sahar_TJ">Twitter</a></li></ul><blockquote><strong>Keep yourself motivated, work hard, and believe in yourself! Things will eventually fall into place!</strong></blockquote><blockquote>— Sahar TJ</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d46011e06134" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/google-data-analytics-professional-certificate-review-d46011e06134">Google Data Analytics Professional Certificate Review</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[Inspire and Innovate, The Epitome of Success]]></title>
            <link>https://sahar-tj.medium.com/inspire-and-innovate-the-epitome-of-success-5b8a10142ee6?source=rss-de2e6ec15fcf------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b8a10142ee6</guid>
            <category><![CDATA[inspire]]></category>
            <category><![CDATA[innovate]]></category>
            <category><![CDATA[gripnov20]]></category>
            <category><![CDATA[content-writing]]></category>
            <category><![CDATA[tsf]]></category>
            <dc:creator><![CDATA[Sahar Tosif Jamal]]></dc:creator>
            <pubDate>Wed, 18 Nov 2020 18:22:17 GMT</pubDate>
            <atom:updated>2020-11-18T18:29:16.451Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*BDpIBxVsSpD8HHlm" /><figcaption>Source : Unsplash</figcaption></figure><p>Life for most people is a journey of self-discovery — finding out who we are, what we’re best at, and how we can make a difference in this world.</p><p>Not everyone falls into success with their first try. In fact, very few of us do. Success needs us to be inspired by someone or something, innovate our ideas and integrate.</p><p>For sure the path to success is not an easy one. There are barriers all along. We decide something. We work on it enthusiastically. Then we encounter challenges and our passion starts diminishing. Soon we think we are not capable enough and we quit. We take up another goal and the same follows.</p><p>Basically, when we take any decision, we are very sure about its success though we don’t know that the nature always has plans to test our determination.</p><p>It gets better with the time, but the key is to start as soon as possible. Look for perfection, that is fine. Try to do things as good as possible, that is all right. But don’t stop doing it because you cannot do it perfectly. Take a step and keep learning.</p><p>Somewhere in our lives we all need an inspirational talk or give one to those who are falling apart.</p><p>A little secret of peoples’ success is Motivation. Successful people live in motivation. They are full of motivation all the time.</p><p>Of course, nobody can stay motivated until he or she regularly does something to recharge himself with motivation. Successful people have plenty of motivational sources here and there. Whenever they find some time, they nourish themselves with motivation.</p><p>Best place to look for motivation is to go through the lives of the ones who have gone through it all and made it big.</p><h3><strong>Inspiration</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*gFu7fConAMFGfKvdz9Cp_Q.png" /><figcaption>Source : Unsplash</figcaption></figure><p>Life is a journey of failure and success. What is the fun in reaching a destination if you do not enjoy the journey at all. Your dream or your goal or even your profession should be something that inspires you from within. Only then life will be a fun ride.</p><p>Inspiration in it’s true form is the process of being mentally stimulated to do or feel something, especially to do something creative. It’s a feeling of enthusiasm you get from someone or something, that gives you new and creative ideas.</p><p>Inspiration is evoked spontaneously without intention. It is also transcendent of our more animalistic and self-serving concerns and limitations. Such transcendence often involves a moment of clarity and awareness of new possibilities.</p><p><em>“The heights of human motivation spring from the beauty and goodness that precede us and awaken us to better possibilities.”</em> This moment of clarity is often vivid, and can take the form of a grand vision, or a “seeing” of something one has not seen before.</p><p>Inspiration involves <em>approach motivation</em>, in which the individual strives to transmit, express, or actualize a new idea or vision.</p><p>Inspiration involves both being inspired <em>by</em> something <em>and acting on</em> that inspiration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*EkLSTgAmprvhvp6G2gc9BQ.png" /><figcaption>Oprah Winfrey (Source: Google Images)</figcaption></figure><p><strong>Oprah Winfrey</strong>- the richest African American of the 20th century. She is best known as the most successful American television producer, host and philanthropist and is among the most influential women in the world. She did not have a promising childhood and had to face a variety of hardships in her teenage life. After her parents’ separation, she was sent to her grandparents, to live in extreme poverty. She reunited with her mother at the age of 6 who moved with her. Her mother spent all her day out working as a maid at households and had no time for little Winfrey. At the age of nine, as she says, she was raped by her cousin, her uncle and a family friend. Having had enough, she ran away from her home at the age of 13 and became mother at 14. After her son’s death in infancy, she went back to live with her barber father in Tennessee. This was the first time, as she remembers she took her studies seriously and managed to become an honors student. Her dedication soon paid off and she became the most popular student at East Nashville High School and won several awards in open speech competition. Later, she studied communication from Tennessee State University. At the age of 19, her life took a turn for better when she got a job at a local Radio Station as a co-anchor for the local evening news. In 1984, she started to host ‘AM Chicago’, an early morning talk show, which soon became the most watched show in America. Later, it was renamed as ‘The Oprah Winfrey Show’. Besides being a TV host and producer, she is the co-founder of Oxygen Media and founder of Oprah Magazine. According to Forbes of 2009, her net worth is $2.7 billion dollar.</p><blockquote><em>“Surround yourself with only people who are going to lift you higher.” ,— Oprah Winfrey</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*AeoHI2_mUtINOIsLRtuGOg.png" /><figcaption>Bruce Lee (Source: Google Images)</figcaption></figure><p><strong>Bruce Jun Fan Lee</strong> <strong>— </strong>Bruce Lee was born in San Francisco to Chinese Parents who were theatre artists. After his birth the family moved back to Hong Kong where he grew up. He started taking martial arts seriously when he was beaten up by a local gang at the age of 13. He quickly became adept at martial arts and became one of the best street fighters in Hong Kong. On a downside, this got attention from the police as well. When Bruce Lee beat up one of the boys who was the son of a feared Chinese Mafia Member, they started fearing for his life and decided it was best for him to get away from Hong Kong and send him back to US. Bruce left Hong Kong at the age of 18, came to the United States and made his way to Seattle, Washington where he worked in the restaurant of a family friend. He soon enrolled in the University of Washington where he pursued a degree in philosophy. Bruce began to teach gung fu in Seattle and soon opened his first school, the Jun Fan Gung Fu Institute. Two more schools followed in Oakland and Los Angeles. Concurrently Bruce married his wife, Linda and had his two children, Brandon and Shannon. In the mid sixties, Bruce was discovered while doing an exhibition at the Long Beach Internationals and a role as Kato in the TV series <em>The Green Hornet</em> soon followed. During this time, Bruce was also developing his own martial art, which he ultimately named Jeet Kune Do (translated: <em>the way of the intercepting fist</em>).</p><p>Bruce’s art was steeped in a philosophical foundation and did not follow long held martial traditions. Instead it had at its core the ideas of simplicity, directness and personal freedom. After <em>The</em> <em>Green Hornet</em> series was canceled, Bruce encountered resistance while working in Hollywood and so headed to Hong Kong to pursue a film career. In Hong Kong he made 3 films, which consecutively broke all box office records and showcased martial arts in an entirely new way. Hollywood took notice and soon Bruce was making the first Hollywood / Hong Kong co-production with a film called <em>Enter the Dragon</em>. Unfortunately, Bruce Lee died in 1973 before this film was released. This film catapulted him to international fame. Today Bruce Lee’s legacy of self-expression, equality, and pioneering innovation continues to inspire people all around the world.</p><blockquote><em>“I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.”, — Bruce Lee</em></blockquote><h3><strong>Innovation</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*OJQff1Ktfs_Ua6Va" /><figcaption>Source : Unsplash</figcaption></figure><p>Innovation is commonly defined as the “carrying out of new combinations” that include “the introduction of new goods, new methods of production, the opening of new markets, the conquest of new sources of supply or the carrying out of a new organization of any industry.</p><p>“Innovation is the multi-stage process whereby organizations transform ideas into new/improved products, service or processes, in order to advance, compete and differentiate themselves successfully in their marketplace”.</p><p>In general, innovation is distinguished from creativity by its emphasis on the implementation of creative ideas in an economic setting.</p><p>Often, when we have some goals, we want to start it with a blast. We want to become an overnight star. We want to achieve best as soon as possible. But things take time. It gets better with the time, but the key is to start as soon as possible.</p><p>What happens is that we have an idea, which we think can change our or someone’s life instantly. But we don’t work on it until we have favorable situations. We wait for more time and more resources. And, one day someone else builds a product on that idea and we have regrets.</p><p>In reality, we are afraid to face the challenges or the risks that may occur. But these challenges should not stop us they should boost us to work harder towards our goals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZM-ID8F5OIfwvYtxcOO3YA.png" /><figcaption>Ferruccio Lamborghini (Source: Google Images)</figcaption></figure><p><strong>Ferruccio Lamborghini- </strong>An Italian industrialist (born April 28, 1916, Cento, Italy — died Feb. 20, 1993, Perugia, Italy), founded a luxury car company that produced some of the fastest, most expensive, and sought-after sports cars in the world. Lamborghini worked as a mechanic in the Italian army during World War II, and after the war he started a tractor company to build farm implements using recycled parts from Allied army surplus and abandoned German tanks. Lamborghini’s business made him a very rich man and, somewhat stereo-typically, he bought himself several high-end sports cars since he’d always loved automobiles. Although he enjoyed them, Lamborghini also felt that each of them had their own issues; one was too hot, another too loud, the next had brakes he didn’t particularly like. When the clutch of his favorite car, a Ferrari 250GT, started giving him issues, he decided to fix it. According to Motor 1, he discovered that there was no difference between the clutch in his sports car and the clutch in the tractors he built, so Lamborghini decided to meet with Enzo Ferrari. When the industrialist suggested to Ferrari that they should use a better clutch in a high-end vehicle, he was more or less brushed off and told to stick to the farming equipment he knew best. Lamborghini, inspired, decided to build the sports car that he wanted to own and drive. In 1963 he opened a state-of-the-art factory to manufacture a sports car that would challenge the top-ranked Ferrari high-performance cars. The innovative Lamborghini 350GT debuted that year, and three years later the company surprised the automobile industry with the Miura, a low-slung, V-12 two-seater that could exceed 298 km/h (185 mph). By the end of the 1960s Lamborghini’s luxury sports cars were in demand by sports car enthusiasts and by celebrities impressed with the cars’ quality and panache. In 1973 Lamborghini sold his share of the firm and retired to a country estate in Umbria, where he established an automobile museum, cultivated grapes, and produced premium table wine.</p><blockquote><em>“‘Lamborghini, you may be able to drive a tractor but you will never be able to handle a Ferrari Properly.’ This was the point when I finally decided to make a perfect car.” — Ferruccio Lamborghini</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MB6CUQbye16qm0gfcu7R3w.png" /><figcaption>Elon Musk (Source: Google Images)</figcaption></figure><p><strong>Elon Musk- </strong>Elon Musk is now one of the most successful entrepreneurs, investor and engineer. He is the co-founder of Zip2 and founder of PayPal. He is the CEO and CTO of SpaceX, product architect of Tesla and chairman of Solar City.</p><p>Elon Musk was born in South Africa in 1971. He faced apartheid struggle throughout his childhood. During his school time, he was bullied, beaten and even thrown down the staircase. The introvert kid was always an innovator and creator of things. A self taught programmer who was able to develop a code for a video game named ‘Blastar’, at the age 12. The game was later sold for $500 USD to the magazine PC and Office Technology. In 1989 (just before his 18th birthday), Musk left South Africa for Canada and enrolled himself at the University of Pennsylvania, where he was graduated with a bachelor’s degree in Physics and Economics from the Wharton School. He and his classmate Adeo Ressi rented out a frat house to pay their fee. The two college students turned the house into a nightclub that attracted as many as 1,000 customers. But apparently, Musk had little interest in the parties and he could instead be found playing a video game alone in his room. At Canada, he worked a series of hard labour jobs. He worked in a boiler room shovelling dirt and cutting logs for $18 an hour.<br> After cold-calling execs, he got an internship at a bank only to be thrown out for using exec coffee machine despite being a top performer. Elon used to live throughout his college years living on less than $1 a day in food. He called it a forced experiment in avoiding scurvy. For him, the secret to preventing sickness was adding a small amount of Red Pepper to his noodles. In 1995, Musk moved to Stanford University to pursue his PhD in Physics. Within two days, he dropped out the college as he thought that the internet had far greater promise to change society. He with his brother found an internet startup Zip2, a company that provided maps and directories to online newspapers. He later sold the company in 1999 for $307 million. In 1999, Musk co-founded X.com, a global online payment company that which later merged with Confinity and took the name PayPal. After being inspired by Hitchhiker’s Guide to the Galaxy, Elon decided that his new life mission would be to save humanity. After selling his 2 companies, he founded SpaceX (Space Exploration Technology Corporation) with a small budget, in 2002. He discovers that space rockets are artificially overpriced and hence turned his attention to his new space exploration company SpaceX to build his own rockets. However, Musk initially found it impossible to get funding for SpaceX. So, he channelled all his own money into the company to make SpaceX a reality. It is the first commercial company ever to successfully recover a spacecraft from Earth’s orbit. Their first test in 2006 was a failure. There was more set backs, failure and explosion. But he finally succeeded and NASA agreed to deal with the organisation.</p><p>A few years later, Musk found Tesla Motors in 2004, a company that designs and manufactures electric sports cars and later merged with SolarCity in 2016 , a solar power systems provider. The sole purpose to found Tesla Motors and SolarCity was to fight global warming and work toward sustainable energy use. The company reached value of $650 billion in 2018.</p><p>Forbes listed Musk as one of the Most powerful America’s CEOs, 40’s and under in 2011.</p><p>Musk founded non profit organisation called “OpenAI” in 2015, Artificial Intelligence research company, to minimise danger of Artificial Intelligence.</p><p>Musk has stated that the goals of SolarCity, Tesla, and SpaceX revolve around his vision to change the world and humanity. The multimillionaire is married thrice and has 6 children. He wedded same women twice.</p><blockquote><em>“Failure is an option here. If things are not failing, you are not innovating enough.” — Elon Musk</em></blockquote><h3><strong>Conclusion</strong></h3><p>What have we seen so far? All these people for sure didn’t have a proper childhood but they all developed themselves to have a proper future. For sure it cost them time, patience and consistency.</p><p>Now in reality, almost every human has or is going through a phase where they feel they aren’t worth it. People often compare themselves with their friends, colleagues or relatives who are living their best lives but what is encapsulated is the hard work, dedication, failures, risks, challenges and persistence. Every person follows a different path and journey. That is why the meaning of success also varies from one individual to another.</p><p>Failures are part and parcel of any successful entity. Mistakes are quite common and what we need to do is that we acknowledge them, and bear them in our mind. Ensure that you learn from the mistakes and in turn do not repeat them. No matter how difficult or impossible the goal seems, never quit. Stay dedicated and motivated. Keep working and one day you would succeed. Don’t confine your ambitions to just making money. Inner peace and one’s happiness is what matters the most. Listen to your heart and follow it. The voices within us are our guiding lights!</p><p>Nobody has ever been successful overnight. Patience is yet another golden rule. Just convince your mind that you are strong enough to be successful, though not today, at least some day. Never be disappointed if you lose. Trust in yourself and believe that you will reach there and you deserve to reach there. Your strength and weakness define the person you are, and the realization of it is rather important.</p><p>Once you achieve your goals, you can be a strong inspiration to others. There is a warrior in you that should never shut down. You are capable of climbing higher and boom into a fantastic personality. Whatsoever, live a humble life, spread positivity and bear the torch to others’ road to success.</p><blockquote><em>“Today might be cruel to you, but in the end everything will be worth it!” — Sahar Tosif Jamal</em></blockquote><h3>References</h3><ul><li><a href="https://visionshine.com/category/articles/motivational/">https://visionshine.com/category/articles/motivational/</a></li><li><a href="https://hbr.org/2011/11/why-inspiration-matters">https://hbr.org/2011/11/why-inspiration-matters</a></li><li><a href="http://brainprick.com/oprah-winfrey/#:~:text=At%20the%20age%20of%2019,%27The%20Oprah%20Winfrey%20Show%27">http://brainprick.com/oprah-winfrey/#:~:text=At%20the%20age%20of%2019,%27The%20Oprah%20Winfrey%20Show%27</a>.</li><li><a href="https://brucelee.com/bruce-lee">https://brucelee.com/bruce-lee</a></li><li><a href="https://www.thevintagenews.com/2018/10/22/lamborghini/">https://www.thevintagenews.com/2018/10/22/lamborghini/</a></li><li><a href="https://www.investopedia.com/articles/personal-finance/061015/how-elon-musk-became-elon-musk.asp">https://www.investopedia.com/articles/personal-finance/061015/how-elon-musk-became-elon-musk.asp</a></li></ul><blockquote><strong>Author’s Note:</strong> This article is a Non-Technical Task that is Content Writing task of <a href="https://www.thesparksfoundationsingapore.org/">The Sparks Foundation</a>’s Graduate Rotational Internship Program for the November 2020 batch. This is my first article ever published on Medium, I might have few errors here and there so bare with me and feel free to share your valuable thoughts. Also would like to thank all those who helped me in writing this article.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b8a10142ee6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>