<?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 Chaitalisawant on Medium]]></title>
        <description><![CDATA[Stories by Chaitalisawant on Medium]]></description>
        <link>https://medium.com/@chaitalisawant22?source=rss-013e6eccfc09------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hY2EgIdhabD17BtN</url>
            <title>Stories by Chaitalisawant on Medium</title>
            <link>https://medium.com/@chaitalisawant22?source=rss-013e6eccfc09------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:05:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chaitalisawant22/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[Cloud Cost Optimization & Recommender]]></title>
            <link>https://blog.stackademic.com/cloud-cost-optimiser-recommender-154e35554e5a?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/154e35554e5a</guid>
            <category><![CDATA[cost]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 15:36:20 GMT</pubDate>
            <atom:updated>2025-12-25T16:13:04.985Z</atom:updated>
            <content:encoded><![CDATA[<p>This article walks through building a cloud cost optimizer and recommender that estimates and compares AWS, Azure, and GCP costs.</p><p>Cloud costs are rising rapidly, and selecting the incorrect service can be extremely costly. We will create a Cloud Cost Optimiser and Recommender MVP in this article that:</p><p>-The user’s workload requirements are considered.</p><p>-AWS, Azure, and GCP compute prices.</p><p>-Calculates monthly expenses.</p><p>-Recommends the most economical option.</p><p>-Explanations for why it is a good idea.</p><h4>Design Philosophy</h4><ul><li>We will use Official live pricing APIs for AWS, Azure, and GCP.</li><li>To have accurate and intelligible recommendations, we will combine machine learning with basic rules.</li><li>The CPU, RAM, and region requirements must be satisfied before cost optimisation may begin.</li><li>Make the system (price service, ML ranker, UI) scalable.</li><li>To gain the user’s trust, we will explain the reason behind the recommendation.</li></ul><h4><strong>System Architecture</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25EvqqXsInU8qBv2w4blcA.png" /><figcaption>System Architetcure</figcaption></figure><h4><strong>Backend</strong></h4><p>We have used Node.js, Express and TypeScript for the backend.</p><p><strong>Index.ts</strong></p><pre>import express from &quot;express&quot;;<br>import cors from &quot;cors&quot;;<br>import { z } from &quot;zod&quot;;<br>import { recommend } from &quot;./recommend&quot;;<br>import type { RecommendRequest } from &quot;./types&quot;;<br><br>const app = express();<br>app.use(cors());<br>app.use(express.json());<br><br>app.get(&quot;/health&quot;, (_req, res) =&gt; res.json({ ok: true }));<br><br>const ReqSchema = z.object({<br>  cpu: z.number().int().min(1).max(128),<br>  ramGb: z.number().min(1).max(1024),<br>  usageHoursPerMonth: z.number().min(1).max(744),<br>  region: z.string().min(2).max(32)<br>});<br><br>app.post(&quot;/api/recommend&quot;, async (req, res) =&gt; {<br>  const parsed = ReqSchema.safeParse(req.body);<br>  if (!parsed.success) return res.status(400).json({ error: &quot;Invalid request&quot;, details: parsed.error.flatten() });<br><br>  const result = await recommend(parsed.data as RecommendRequest);<br>  res.json(result);<br>});<br><br>const PORT = Number(process.env.PORT) || 4001;<br><br>app.listen(PORT, &quot;0.0.0.0&quot;, () =&gt; {<br>  console.log(`Backend running on http://0.0.0.0:${PORT}`);<br>});</pre><p><strong>type.ts</strong></p><pre>export type Provider = &quot;AWS&quot; | &quot;Azure&quot; | &quot;GCP&quot;;<br><br>export interface RecommendRequest {<br>  cpu: number;<br>  ramGb: number;<br>  usageHoursPerMonth: number;<br>  region: string;<br>}<br><br>export interface PriceCandidate {<br>  provider: Provider;<br>  sku: string;<br>  region: string;<br>  pricePerHour: number;<br>}<br><br>export interface RecommendationItem extends PriceCandidate {<br>  estimatedMonthlyCost: number;<br>  reasons: string[];<br>}<br><br>export interface RecommendResponse {<br>  best: RecommendationItem | null;<br>  alternatives: RecommendationItem[];<br>}</pre><p><strong>Recommend.ts</strong></p><pre>import { RecommendRequest, RecommendResponse, RecommendationItem, PriceCandidate } from &quot;./types&quot;;<br>import { fetchAzureCandidates } from &quot;./providers/azure&quot;;<br>import { fetchAwsCandidates } from &quot;./providers/aws&quot;;<br>import { fetchGcpCandidates } from &quot;./providers/gcp&quot;;<br><br>function buildReasons(req: RecommendRequest, c: PriceCandidate): string[] {<br>  return [<br>    `Estimated monthly cost uses ${req.usageHoursPerMonth} hrs/month.`,<br>    `Meets requirements: ${req.cpu} vCPU, ${req.ramGb} GB RAM (spec mapping MVP).`,<br>    `Region selected: ${req.region}.`<br>  ];<br>}<br><br>// MVP ranking: cheapest monthly cost wins. (ML can replace this later.)<br>export async function recommend(req: RecommendRequest): Promise&lt;RecommendResponse&gt; {<br>  const [aws, azure, gcp] = await Promise.all([<br>    fetchAwsCandidates(req.region),<br>    fetchAzureCandidates(req.region),<br>    fetchGcpCandidates(req.region)<br>  ]);<br><br>  const candidates = [...aws, ...azure, ...gcp];<br><br>  const scored: RecommendationItem[] = candidates.map((c) =&gt; ({<br>    ...c,<br>    estimatedMonthlyCost: c.pricePerHour * req.usageHoursPerMonth,<br>    reasons: buildReasons(req, c)<br>  }));<br><br>  scored.sort((a, b) =&gt; a.estimatedMonthlyCost - b.estimatedMonthlyCost);<br><br>  return {<br>    best: scored[0] ?? null,<br>    alternatives: scored.slice(0, 10)<br>  };<br>}</pre><h4><strong>Frontend</strong></h4><p>We have used React and Tailwind. The UI follows a <strong>single-screen dashboard</strong> pattern:</p><ul><li>Left: Input form</li><li>Right: Top recommendation and comparison table</li></ul><p><strong>Index.html</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>    &lt;title&gt;Cloud Cost Optimizer&lt;/title&gt;<br><br>    &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot; /&gt;<br>    &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot; crossorigin /&gt;<br>    &lt;link<br>      href=&quot;https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&amp;display=swap&quot;<br>      rel=&quot;stylesheet&quot;<br>    /&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;<br>    &lt;script type=&quot;module&quot; src=&quot;/src/main.tsx&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p><strong>frontend/src/main.ts</strong></p><pre>import React from &quot;react&quot;;<br>import ReactDOM from &quot;react-dom/client&quot;;<br>import App from &quot;./App&quot;;<br>import &quot;./index.css&quot;;<br><br>ReactDOM.createRoot(document.getElementById(&quot;root&quot;)!).render(<br>  &lt;React.StrictMode&gt;<br>    &lt;App /&gt;<br>  &lt;/React.StrictMode&gt;<br>);</pre><p><strong>frontend/src/api.ts</strong></p><pre>import axios from &quot;axios&quot;;<br><br>export const api = axios.create({<br>  baseURL: import.meta.env.VITE_API_URL || &quot;http://localhost:4000/api&quot;,<br>  timeout: 30000,<br>});</pre><p><strong>frontend/src/types.ts</strong></p><pre>export type Provider = &quot;AWS&quot; | &quot;Azure&quot; | &quot;GCP&quot;;<br><br>export interface RecommendRequest {<br>  cpu: number;<br>  ramGb: number;<br>  usageHoursPerMonth: number;<br>  region: string;<br>}<br><br>export interface RecommendationItem {<br>  provider: Provider;<br>  sku: string;<br>  region: string;<br>  pricePerHour: number;<br>  estimatedMonthlyCost: number;<br>  mlScore?: number;<br>  reasons: string[];<br>}<br><br>export interface RecommendResponse {<br>  best: RecommendationItem | null;<br>  alternatives: RecommendationItem[];<br>}</pre><p><strong>frontend/src/components/Card.tsx</strong></p><pre>export default function Card({<br>  title,<br>  subtitle,<br>  right,<br>  children,<br>}: {<br>  title: string;<br>  subtitle?: string;<br>  right?: React.ReactNode;<br>  children: React.ReactNode;<br>}) {<br>  return (<br>    &lt;section className=&quot;rounded-xl2 bg-panel border border-border shadow-soft&quot;&gt;<br>      &lt;div className=&quot;px-6 pt-6 pb-4 flex items-start justify-between gap-4&quot;&gt;<br>        &lt;div&gt;<br>          &lt;h2 className=&quot;text-white text-lg font-bold&quot;&gt;{title}&lt;/h2&gt;<br>          {subtitle ? &lt;p className=&quot;text-muted text-sm mt-1&quot;&gt;{subtitle}&lt;/p&gt; : null}<br>        &lt;/div&gt;<br>        {right}<br>      &lt;/div&gt;<br>      &lt;div className=&quot;px-6 pb-6&quot;&gt;{children}&lt;/div&gt;<br>    &lt;/section&gt;<br>  );<br>}</pre><p><strong>frontend/src/components/InputForm.tsx</strong></p><pre>import { useState } from &quot;react&quot;;<br>import { RecommendRequest } from &quot;../types&quot;;<br><br>export default function InputForm({<br>  loading,<br>  onSubmit,<br>}: {<br>  loading: boolean;<br>  onSubmit: (req: RecommendRequest) =&gt; void;<br>}) {<br>  const [cpu, setCpu] = useState(4);<br>  const [ramGb, setRamGb] = useState(16);<br>  const [usageHoursPerMonth, setUsageHours] = useState(720);<br>  const [region, setRegion] = useState(&quot;us-east&quot;);<br><br>  const inputCls =<br>    &quot;w-full rounded-2xl border border-border bg-[#0f0f0f] px-4 py-3 text-white text-sm outline-none focus:ring-2 focus:ring-accent/30&quot;;<br><br>  return (<br>    &lt;div className=&quot;grid gap-5&quot;&gt;<br>      &lt;div&gt;<br>        &lt;div className=&quot;text-muted2 text-xs font-semibold&quot;&gt;CPU (vCPU)&lt;/div&gt;<br>        &lt;input className={inputCls} type=&quot;number&quot; value={cpu} min={1} max={128} onChange={(e) =&gt; setCpu(+e.target.value)} /&gt;<br>      &lt;/div&gt;<br><br>      &lt;div&gt;<br>        &lt;div className=&quot;text-muted2 text-xs font-semibold&quot;&gt;RAM (GB)&lt;/div&gt;<br>        &lt;input className={inputCls} type=&quot;number&quot; value={ramGb} min={1} max={1024} onChange={(e) =&gt; setRamGb(+e.target.value)} /&gt;<br>      &lt;/div&gt;<br><br>      &lt;div&gt;<br>        &lt;div className=&quot;text-muted2 text-xs font-semibold&quot;&gt;Usage hours / month&lt;/div&gt;<br>        &lt;input className={inputCls} type=&quot;number&quot; value={usageHoursPerMonth} min={1} max={744} onChange={(e) =&gt; setUsageHours(+e.target.value)} /&gt;<br>        &lt;div className=&quot;text-muted2 text-xs mt-2&quot;&gt;720 = 24×30, 744 = 24×31&lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div&gt;<br>        &lt;div className=&quot;text-muted2 text-xs font-semibold&quot;&gt;Region&lt;/div&gt;<br>        &lt;select className={inputCls} value={region} onChange={(e) =&gt; setRegion(e.target.value)}&gt;<br>          &lt;option value=&quot;us-east&quot;&gt;us-east&lt;/option&gt;<br>          &lt;option value=&quot;us-west&quot;&gt;us-west&lt;/option&gt;<br>          &lt;option value=&quot;eu-west&quot;&gt;eu-west&lt;/option&gt;<br>          &lt;option value=&quot;ap-south&quot;&gt;ap-south&lt;/option&gt;<br>        &lt;/select&gt;<br>      &lt;/div&gt;<br><br>      &lt;button<br>        disabled={loading}<br>        className=&quot;w-full rounded-2xl bg-accent px-4 py-3 text-sm font-extrabold text-black hover:opacity-95 disabled:opacity-60&quot;<br>        onClick={() =&gt; onSubmit({ cpu, ramGb, usageHoursPerMonth, region })}<br>      &gt;<br>        {loading ? &quot;Calculating...&quot; : &quot;Compare Costs&quot;}<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>frontend/src/components/RecommendationsPanel.tsx</strong></p><pre>import { RecommendationItem } from &quot;../types&quot;;<br><br>export default function RecommendationsPanel({ best }: { best: RecommendationItem | null }) {<br>  if (!best) {<br>    return &lt;div className=&quot;text-muted&quot;&gt;No recommendation yet. Submit requirements.&lt;/div&gt;;<br>  }<br><br>  return (<br>    &lt;div className=&quot;rounded-2xl bg-panel2 border border-border px-5 py-4&quot;&gt;<br>      &lt;div className=&quot;flex items-start justify-between gap-4&quot;&gt;<br>        &lt;div&gt;<br>          &lt;div className=&quot;text-sm text-muted&quot;&gt;{best.provider}&lt;/div&gt;<br>          &lt;div className=&quot;text-lg font-extrabold&quot;&gt;{best.sku}&lt;/div&gt;<br>          &lt;div className=&quot;mt-1 text-sm text-muted&quot;&gt;{best.region}&lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;div className=&quot;text-lg font-extrabold&quot;&gt;${best.estimatedMonthlyCost.toFixed(2)}/mo&lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;mt-4&quot;&gt;<br>        &lt;div className=&quot;text-xs font-semibold text-white&quot;&gt;Why this option&lt;/div&gt;<br>        &lt;ul className=&quot;mt-2 list-disc space-y-1 pl-5 text-sm text-muted&quot;&gt;<br>          {best.reasons.slice(0, 5).map((r, i) =&gt; (<br>            &lt;li key={i}&gt;{r}&lt;/li&gt;<br>          ))}<br>        &lt;/ul&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>frontend/src/components/ComparisonTable.tsx</strong></p><pre>import { RecommendationItem } from &quot;../types&quot;;<br><br>export default function ComparisonTable({<br>  items,<br>  bestKey,<br>}: {<br>  items: RecommendationItem[];<br>  bestKey?: string;<br>}) {<br>  return (<br>    &lt;div className=&quot;rounded-2xl bg-panel2 border border-border overflow-hidden&quot;&gt;<br>      &lt;div className=&quot;grid grid-cols-[20%_30%_18%_16%_16%] border-b border-border&quot;&gt;<br>        {[&quot;Provider&quot;, &quot;SKU&quot;, &quot;Region&quot;, &quot;$/hr&quot;, &quot;Monthly&quot;].map((h) =&gt; (<br>          &lt;div key={h} className=&quot;px-4 py-4 text-xs font-semibold text-muted2&quot;&gt;<br>            {h}<br>          &lt;/div&gt;<br>        ))}<br>      &lt;/div&gt;<br><br>      {items.map((r) =&gt; {<br>        const key = `${r.provider}-${r.sku}`;<br>        const isBest = key === bestKey;<br>        return (<br>          &lt;div<br>            key={key}<br>            className={[<br>              &quot;grid grid-cols-[20%_30%_18%_16%_16%] border-b border-border&quot;,<br>              isBest ? &quot;bg-accent/10&quot; : &quot;bg-[#0f0f0f]&quot;,<br>            ].join(&quot; &quot;)}<br>          &gt;<br>            &lt;div className=&quot;px-4 py-4 text-sm&quot;&gt;{r.provider}&lt;/div&gt;<br>            &lt;div className=&quot;px-4 py-4 text-sm font-extrabold&quot;&gt;{r.sku}&lt;/div&gt;<br>            &lt;div className=&quot;px-4 py-4 text-sm&quot;&gt;{r.region}&lt;/div&gt;<br>            &lt;div className=&quot;px-4 py-4 text-sm text-right tabular-nums&quot;&gt;{r.pricePerHour.toFixed(4)}&lt;/div&gt;<br>            &lt;div className=&quot;px-4 py-4 text-sm text-right font-extrabold tabular-nums&quot;&gt;<br>              ${r.estimatedMonthlyCost.toFixed(2)}<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        );<br>      })}<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>frontend/src/App.tsx</strong></p><pre>import { useState } from &quot;react&quot;;<br>import Card from &quot;./components/Card&quot;;<br>import InputForm from &quot;./components/InputForm&quot;;<br>import RecommendationsPanel from &quot;./components/RecommendationsPanel&quot;;<br>import ComparisonTable from &quot;./components/ComparisonTable&quot;;<br>import { api } from &quot;./api&quot;;<br>import { RecommendRequest, RecommendResponse } from &quot;./types&quot;;<br><br>function Pill({ text }: { text: string }) {<br>  return (<br>    &lt;span className=&quot;inline-flex items-center rounded-full border border-accent px-3 py-1 text-xs font-extrabold text-accent bg-[#0f2a1d]&quot;&gt;<br>      {text}<br>    &lt;/span&gt;<br>  );<br>}<br><br>export default function App() {<br>  const [loading, setLoading] = useState(false);<br>  const [resp, setResp] = useState&lt;RecommendResponse | null&gt;(null);<br>  const [error, setError] = useState&lt;string | null&gt;(null);<br><br>  async function onSubmit(req: RecommendRequest) {<br>    setLoading(true);<br>    setError(null);<br>    try {<br>      const { data } = await api.post&lt;RecommendResponse&gt;(&quot;/recommend&quot;, req);<br>      setResp(data);<br>    } catch (e: any) {<br>      setError(&quot;Failed to fetch recommendations. Is backend running on http://localhost:4000 ?&quot;);<br>      setResp(null);<br>    } finally {<br>      setLoading(false);<br>    }<br>  }<br><br>  const bestKey = resp?.best ? `${resp.best.provider}-${resp.best.sku}` : undefined;<br><br>  return (<br>    &lt;div className=&quot;min-h-screen bg-bg text-white font-sans&quot;&gt;<br>      &lt;div className=&quot;mx-auto max-w-[1600px] px-12 py-10&quot;&gt;<br>        &lt;div className=&quot;mb-8&quot;&gt;<br>          &lt;h1 className=&quot;text-[28px] font-extrabold leading-tight&quot;&gt;Cloud Cost Optimizer&lt;/h1&gt;<br>          &lt;p className=&quot;mt-2 text-sm text-muted&quot;&gt;React UI · Live pricing via aggregator · ML ranking via Python service&lt;/p&gt;<br>        &lt;/div&gt;<br><br>        &lt;div className=&quot;grid gap-8 lg:grid-cols-[520px_1fr]&quot;&gt;<br>          &lt;Card title=&quot;Requirements&quot; subtitle=&quot;Compute (MVP)&quot;&gt;<br>            &lt;InputForm loading={loading} onSubmit={onSubmit} /&gt;<br>            {error ? &lt;div className=&quot;mt-4 text-sm text-red-300&quot;&gt;{error}&lt;/div&gt; : null}<br>          &lt;/Card&gt;<br><br>          &lt;div className=&quot;space-y-8&quot;&gt;<br>            &lt;Card title=&quot;Top recommendation&quot; right={&lt;Pill text=&quot;Most cost-effective&quot; /&gt;}&gt;<br>              &lt;RecommendationsPanel best={resp?.best ?? null} /&gt;<br>            &lt;/Card&gt;<br><br>            &lt;Card title=&quot;Cost comparison&quot;&gt;<br>              &lt;ComparisonTable items={resp?.alternatives ?? []} bestKey={bestKey} /&gt;<br>            &lt;/Card&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9kwWOi2fanEfqVkP4rSR8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-cEtU_STirbpWd3VrWYdg.png" /></figure><h3>Conclusion</h3><p>This article is a case study of developing a complete MVP for a Cloud Cost Optimiser Recommender, which includes designing a basic yet scalable system architecture, a Node.js back-end, and a clean React front. It focused on creating a clear separation of responsibilities between the frontend, which is the user interface and visualisation, and the backend, which is the price aggregation, recommendation logic, and validation.</p><p>Although the current implementation is focused on simplified pricing and rule-based ranking, the architecture is scalable and purposefully built to expand. With the addition of an ML-based rating service, the frontend API may remain unchanged, enabling increasingly intelligent and data-driven suggestions as the system gains strength.</p><p>Future enhancements include entirely accurate live pricing for cloud providers, caching and rate limiting, storage service support, networking services, and sophisticated machine learning algorithms to minimise prices based on customisation. With these modifications, the same foundation can be expanded to a production-ready cloud cost optimisation platform.</p><p>Overall, this MVP has demonstrated how clever architectural design and incremental design can turn a challenging problem like cloud cost optimisation into a system that can be maintained and expanded over time.</p><blockquote>“The best ideas grow when they’re shared. Thank you for reading and being part of the journey.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=154e35554e5a" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/cloud-cost-optimiser-recommender-154e35554e5a">Cloud Cost Optimization &amp; Recommender</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Regain Your Focus in a Distracted World]]></title>
            <link>https://medium.com/@chaitalisawant22/how-to-regain-your-focus-in-a-distracted-world-f4c4209c980b?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4c4209c980b</guid>
            <category><![CDATA[distracted]]></category>
            <category><![CDATA[self-discipline]]></category>
            <category><![CDATA[attention]]></category>
            <category><![CDATA[world]]></category>
            <category><![CDATA[mental-fatigue]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 14:03:45 GMT</pubDate>
            <atom:updated>2025-12-23T17:11:40.131Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn how to regain focus in a distracted world by reducing digital distractions, improving your attention span, and building habits for deep concentration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFj5dWh73E3lSCUFr_B3mA.png" /></figure><p><strong>Introduction</strong></p><p>In the modern world of incessant pings, infinite tabs, and competing priorities, regaining attention is not only a productivity strategy it is also a key to creating meaningful work, lesser cognitive burnout, and better mental health. But this is not mere wisdom. The reasons why deep focus is important and the manner in which people should develop it are well supported through scientific research and practical experiences.</p><h4><strong>Why Focus Matters</strong></h4><p><strong>The Cognitive Cost of Multitasking (Switching Tasks)</strong></p><p>-Neuroscientific studies reveal that each time you alternate between jobs, your brain has to re-activate control networks, which is both time- and mind-consuming. Indeed, the fMRI research shows that there is more effective activation of frontoparietal control areas when a participant switches tasks than when the participant remains in the same task.[1]</p><p>-This switch cost may be very high, behaviourally. According to research studies in psychology, a study has proposed that effective productivity may be reduced by up to 40% in the case of frequent task switching.[2,3,4]</p><p>-A follow-up study of multitasking in a workplace (software developers) established that developers who reduced the amount of context switching (i.e., were more repetitively focused on fewer projects) were more productive; the large context switching proved to be especially disruptive.[5]</p><p>-The developer surveys also indicate that developers themselves believe that high cognitive costs are incurred in the case of changing tasks: constant interruptions disorient their flow, and they need to be re-immersed, which negatively affects performance. [6]</p><h4>How to Regain Focus</h4><ol><li><strong>Time Block for Deep Work</strong></li></ol><p>Dedicated, uninterrupted time of deep work is not just a productivity trick, which cognitive theory of attention attests to. The cost of context switching will be reduced, and you will have less mental reset cost, which means that you will be able to engage in a deeper thinking process, and the working memory will be better utilised.</p><p><strong>2. Reduce Environmental Interruptions.</strong></p><p>The minimisation of outside distractions is consistent with the attention residue theory: having broken mindfulness in one area, some part of your mental energy is still focused on the prior one, reducing the quality of future chores. [7]</p><p>Studies of mediated (digital) environments reveal that uncontrollable distractions (e.g. incessant notifications) lead to poor performance. [8]</p><p><strong>3. Use Focus Rituals</strong></p><p>Short meditation has been empirically proven to enhance attentional control. The six weeks of meditation training were observed in one randomised controlled trial to significantly enhance the capability of the participant regulating attention and emotion. [9]</p><p>Even short meditation programs (10 minutes) have been found to enhance performance on attentional tasks such as the Stroop test, which creates more efficient ways of allocating attention.[10]</p><p>According to neuroscientific studies (MEG studies) of meditated individuals, meditation causes detectable dynamic alterations in deep brain areas (e.g., cingulate cortex, insula, thalamus), an outcome that facilitates the role of meditation in improving attentional control.[11]</p><p><strong>4. Train Focus Like a Muscle</strong></p><p>Single-tasking by choice, intentionally steadfast against switching and performing one task at a time has been suggested by psychologists as it is consistent with the functioning of the brain&#39;s working memory. [2]</p><p>Mindfulness-trained attention (e.g. meditation) enhances cognitive resilience, which allows individuals to focus under stressful circumstances. As can be seen in the dose-response effect of the six-week RCT, above, more consistent practice is a predictor of greater focus gains.[9]</p><p><strong>5. Embrace Limits: No and Boundaries</strong></p><p>The common explanation given by productivity experts is that the shallowest interruptions and overcrowded meetings can be reduced to be able to work more profoundly and meaningfully. This agrees with cognitive science: cognitive capacity is conserved by reducing task switching.</p><p>An actual scenario is that individuals who guard against disrupted blocks record increased output, as well as experience increased levels of joy and reduced stress since they can create work that matters, instead of being on the move and firefighting.</p><p><strong>6. Real-World Example</strong></p><p>Take the case of a software development team. The productivity improvements were quantifiable in the replication study of the developers I described above, where those who minimised context-switching between projects (e.g., worked on fewer projects at once) showed statistically significant productivity improvement.[5] Let’s use an example of a developer, Alex, who blocks out two morning hours to write major code features, and no meetings or emails are permitted during those hours. She begins with a brief breathing (a ritual). Since she is not switching tasks, she can remain in flow longer and do more intricate and high-quality work in comparison with disjointed, interruption-based sessions.</p><p>In personal life, Alex, in the meantime, starts a 10-minute meditation routine every day, which is guided by the same interventions as those applied in the research. In a couple of weeks, she says that she feels more capable of disregarding her phone notifications, less distracted by them, and that she is less stressed on stressful days.</p><h4><strong>Challenges &amp; Scientific Realities</strong></h4><ol><li><strong>Conscience pangs in saying no</strong>: There is a lot of guilt in people about refusing to attend a meeting or urgent yet not significant tasks. Nonetheless, the threat of continuous context switching is not purely hypothetical; cognitive science demonstrates that efficiency is severely impaired. [2]</li><li><strong>Interruption is Hard to Avoid</strong>: Interruptions occur in the workplace, particularly in collaborative workplaces. The argument is to control them and not to get rid of them. The developer study demonstrated that it was highly positive to reduce the number of switches of context (not necessarily to zero).[5]</li><li><strong>Mental Fatigue of Deep Work</strong>: Deep work is in itself a burden when pushed past its limits. This is why breaks and micro-rests are very important; they are able to recharge working memory and sustain performance.</li></ol><p><strong>Conclusion</strong></p><p>The ultimate way of reclaiming your life is by getting your focus back. It is scientifically obvious; when we guard our attention, practice it, and cut off the noise which disintegrates our thought process, we re-learn our ability to think deeply, creatively, and meaningfully. Concentrated attention is not a luxury, something to chuckle over; it is also a basis of doing something that matters and leading days that matter. In a world designed to distract you, the decision to focus becomes a quiet, powerful rebellion.</p><p><strong>References</strong></p><p><em>1.</em> <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC7075496/"><em>https://pmc.ncbi.nlm.nih.gov/articles/PMC7075496/</em></a></p><p><em>2. </em><a href="https://www.psychologytoday.com/gb/blog/brain-wise/201209/the-true-cost-of-multi-tasking"><em>https://www.psychologytoday.com/gb/blog/brain-wise/201209/the-true-cost-of-multi-tasking</em></a></p><p><em>3. </em><a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC11543232/"><em>https://pmc.ncbi.nlm.nih.gov/articles/PMC11543232/</em></a></p><p><em>4. </em><a href="https://workwell.ca/workwell-the-myth-of-multitasking/"><em>https://workwell.ca/workwell-the-myth-of-multitasking/</em></a></p><p><em>5. </em><a href="https://arxiv.org/abs/2006.12636"><em>https://arxiv.org/abs/2006.12636</em></a></p><p><em>6. </em><a href="https://arxiv.org/abs/1805.05504"><em>https://arxiv.org/abs/1805.05504</em></a></p><p><em>7. </em><a href="https://boberickson.com/blog/productivity/productivity-multitasking-myths"><em>https://boberickson.com/blog/productivity/productivity-multitasking-myths</em></a></p><p><em>8. Managing attention and productivity in distracting mediated workspaces: a research path for multitasking in mediated environments(Shili Xiong and Brittany Duff, Institute of Communications Research, University of Illinois at Urbana-Champaign, IL)</em></p><p><em>9. </em><a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC3722783"><em>https://pmc.ncbi.nlm.nih.gov/articles/PMC3722783</em></a></p><p><em>10. </em><a href="https://arxiv.org/abs/2209.12625"><em>https://arxiv.org/abs/2209.12625</em></a></p><p><em>11. </em><a href="https://arxiv.org/abs/2101.12559"><em>https://arxiv.org/abs/2101.12559</em></a></p><p>“I appreciate you taking the time to read to the end. If this article resonated with you, I’d be thankful for a few claps. Your support genuinely encourages me to keep sharing my work.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4c4209c980b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Real-Time Speech-to-Text AI System Using Whisper & Wav2Vec2]]></title>
            <link>https://blog.stackademic.com/building-a-real-time-speech-to-text-ai-system-using-whisper-wav2vec2-408cd5585e5f?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/408cd5585e5f</guid>
            <category><![CDATA[whisper]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <category><![CDATA[mel-spectrogram]]></category>
            <category><![CDATA[wav2vec]]></category>
            <category><![CDATA[speech-to-text-app]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 00:22:26 GMT</pubDate>
            <atom:updated>2025-12-25T16:13:32.849Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Speech-to-text (STT) technology has revolutionized various domains, from voice assistants and automated transcription services to accessibility tools for individuals with disabilities. Recent advancements in deep learning and natural language processing (NLP) have significantly improved STT systems, making them more accurate and efficient.</p><p>This article will cover:</p><ul><li>A literature review of speech-to-text models.</li><li>The architecture and steps followed by STT models.</li><li>Implementation of a real-time speech recognition system using OpenAI Whisper &amp; Wav2Vec2.</li><li>Deployment on AWS using Docker for scalability.</li></ul><h3><strong>Literature Review of Speech-to-Text Models</strong></h3><h4><strong>Speech Recognition &amp; Speech-to-Text Conversion</strong></h4><p>Speech recognition has evolved significantly over the past decades. Early models used simple statistical approaches, while modern systems leverage deep learning and self-supervised learning to improve accuracy and robustness.</p><h4><strong>Early Approaches: Hidden Markov Models (HMMs) &amp; Gaussian Mixture Models (GMMs)</strong></h4><p>Before deep learning, speech recognition relied on statistical methods such as:</p><ul><li><strong>Hidden Markov Models (HMMs)</strong>: Modelled speech as a sequence of states and transitions, making predictions based on probabilities.</li><li><strong>Gaussian Mixture Models (GMMs)</strong>: Used for feature representation in speech classification.</li><li><strong>Limitations</strong>: These models struggled with handling long-term dependencies and variations in speech patterns.</li></ul><h4><strong>Deep Neural Networks (DNNs) &amp; Convolutional Neural Networks (CNNs)</strong></h4><p>With the emergence of deep learning, DNNs improved phoneme recognition by learning high-level speech features. CNNs were also utilized for extracting important acoustic features.</p><ul><li><strong>Pros</strong>: Better feature extraction and higher accuracy.</li><li><strong>Cons</strong>: Still struggled with context understanding over long sequences.</li></ul><h4><strong>Recurrent Neural Networks (RNNs) &amp; Long Short-Term Memory (LSTM)</strong></h4><ul><li>RNNs were introduced to learn temporal dependencies in speech data.</li><li>LSTM networks solved the vanishing gradient problem, allowing for better sequence modelling.</li><li><strong>Challenges</strong>: Computationally expensive and slow training times.</li></ul><h4>Self-Supervised Learning &amp; Transformer-Based Models</h4><p>Recent models leverage self-supervised learning and transformers to achieve near-human accuracy:</p><ul><li><strong>Whisper (OpenAI)</strong>: A multilingual STT model with exceptional generalization.</li><li><strong>Wav2Vec2 (Meta AI)</strong>: Uses self-supervised learning to learn representations from raw speech.</li><li><strong>DeepSpeech (Mozilla)</strong>: A lightweight end-to-end deep learning model for STT.</li><li><strong>Limitations Addressed</strong>: These models require less labelled data and generalize well across diverse datasets.</li></ul><h3><strong>Language Translation in Speech Processing</strong></h3><ul><li><strong>Multilingual Speech-to-Text</strong>: Whisper and MMS models support multiple languages.</li><li><strong>Speech-to-Speech Translation</strong>: AI-driven models such as SeamlessM4T enable real-time spoken translation across various languages.</li><li><strong>Challenges</strong>: Dialect variations and domain-specific vocabularies still pose difficulties.</li></ul><h4><strong>Latest Innovations</strong></h4><ul><li><strong>Massively Multilingual Models (MMS) by Meta</strong>: Over 1,100 languages supported.</li><li><strong>Whisper v3</strong>: Improved robustness and real-time efficiency.</li><li><strong>DeepSparse Speech-to-Text</strong>: Uses sparsity-aware optimizations to enhance efficiency on edge devices.</li><li><strong>Federated Learning for Speech Recognition</strong>: Enables privacy-preserving training across multiple devices.</li></ul><h4><strong>Overview of Steps Followed by Speech-to-Text Process</strong></h4><p>Speech-to-text models follow a structured process to convert spoken language into text:</p><p><strong>Analog to Digital Conversion</strong></p><p>Sound waves (analog signals) are captured and transformed into a digital format via an Analog-to-Digital Converter (ADC).</p><p><strong>Filtering &amp; Noise Reduction</strong></p><p>Advanced signal processing techniques remove background noise, isolating the primary speech content.</p><p><strong>Segmentation &amp; Feature Extraction</strong></p><p>The processed audio is divided into phonemes and converted into numerical representations using:</p><ul><li>Mel-Frequency Cepstral Coefficients (MFCCs)</li><li>Spectrogram Analysis</li><li>Waveform Processing</li></ul><p><strong>Model Inference &amp; Phoneme Recognition</strong></p><p>Deep learning models (e.g., Whisper, Wav2Vec2) analyse extracted features using self-supervised learning and transformers.</p><p><strong>Character Integration &amp; Language Modelling</strong></p><p>A language model reconstructs phonemes into coherent words and sentences using probability-based prediction.</p><p><strong>Final Transcript Output</strong></p><p>Post-processing techniques like punctuation restoration and context-aware corrections enhance readability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y6VS18e2X8QMnYvhaoRW1w.png" /><figcaption>Speech-to-Text Process</figcaption></figure><p><strong>Findings &amp; Observations</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0boEgjBdVGKIC2LdjdHGQ.png" /><figcaption>Comparison of Models</figcaption></figure><h3><strong>Implementation Example: Speech-to-Text Using Whisper</strong></h3><p>Here’s how to build a real-time Whisper-based speech-to-text application:</p><p><strong>Install Dependencies</strong></p><pre>pip install flask<br>pip install torch<br>pip install transformers<br>pip install torchaudio<br>pip install jiwer<br>pip install whisper</pre><p><strong>Implement app_whisper_UI.py</strong></p><p>The <strong>app_whisper_UI.py</strong> file handles backend operations, while <strong>index.html</strong> provides the user interface for recording and transcribing speech.</p><h4>Uploading &amp; Processing Audio</h4><pre>@app.route(&#39;/transcribe&#39;, methods=[&#39;POST&#39;])<br>def transcribe():<br>    file = request.files[&#39;audio&#39;]<br>    audio, sr = librosa.load(file, sr=16000)<br>    spectrogram = librosa.feature.melspectrogram(y=audio, sr=sr)<br>    input_values = processor(spectrogram, return_tensors=&quot;pt&quot;).input_values<br>    logits = model(input_values).logits<br>    predicted_ids = torch.argmax(logits, dim=-1)<br>    transcription = processor.batch_decode(predicted_ids)[0]<br>    return transcription</pre><h4>Feature Extraction Technique Used in app_whisper_UI.py</h4><p>The <strong>app_whisper_UI.py</strong> file utilizes <strong>Spectrogram Analysis</strong> as part of the preprocessing pipeline. Spectrograms transform audio signals into visual representations, making it easier for deep learning models to recognize speech patterns.</p><p><strong>Steps Involved in Spectrogram Analysis:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*wrTXuBnlAFHLBXlMZJqwVw.png" /></figure><h4>Frontend (index.html)</h4><pre>&lt;h1&gt;Speech to Text Transcription&lt;/h1&gt;<br><br>    &lt;div class=&quot;container&quot;&gt;<br>        &lt;div class=&quot;buttons&quot;&gt;<br>            &lt;button id=&quot;start-btn&quot; onclick=&quot;startRecording()&quot;&gt;Start Recording&lt;/button&gt;<br>            &lt;button id=&quot;stop-btn&quot; onclick=&quot;stopRecording()&quot; disabled&gt;Stop Recording&lt;/button&gt;<br>        &lt;/div&gt;<br><br>        &lt;div class=&quot;transcription-container&quot;&gt;<br>            &lt;h3&gt;Transcription:&lt;/h3&gt;<br>            &lt;p id=&quot;transcription&quot; class=&quot;loading&quot;&gt;Press &quot;Start Recording&quot; to begin...&lt;/p&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br><br>    &lt;script&gt;<br>        let mediaRecorder;<br>        let audioChunks = [];<br><br>        // Start recording<br>        function startRecording() {<br>            navigator.mediaDevices.getUserMedia({ audio: true })<br>                .then(stream =&gt; {<br>                    mediaRecorder = new MediaRecorder(stream);<br>                    mediaRecorder.start();<br>                    audioChunks = [];<br><br>                    document.getElementById(&quot;start-btn&quot;).disabled = true;<br>                    document.getElementById(&quot;stop-btn&quot;).disabled = false;<br>                    document.getElementById(&quot;transcription&quot;).innerText = &quot;Recording...&quot;;<br><br>                    mediaRecorder.ondataavailable = event =&gt; {<br>                        audioChunks.push(event.data);<br>                    };<br><br>                    mediaRecorder.onstop = () =&gt; {<br>                        const audioBlob = new Blob(audioChunks, { type: &#39;audio/wav&#39; });<br>                        sendAudio(audioBlob);<br>                    };<br>                })<br>                .catch(error =&gt; {<br>                    console.error(&quot;Error accessing audio: &quot;, error);<br>                    document.getElementById(&quot;transcription&quot;).innerText = &quot;Error accessing microphone.&quot;;<br>                });<br>        }<br><br>        // Stop recording<br>        function stopRecording() {<br>            if (mediaRecorder) {<br>                mediaRecorder.stop();<br>            }<br><br>            document.getElementById(&quot;start-btn&quot;).disabled = false;<br>            document.getElementById(&quot;stop-btn&quot;).disabled = true;<br>        }<br><br>        // Send audio to the backend<br>        function sendAudio(audioBlob) {<br>            const formData = new FormData();<br>            formData.append(&quot;audio&quot;, audioBlob, &quot;recording.wav&quot;);<br><br>            fetch(&quot;/transcribe&quot;, {<br>                method: &quot;POST&quot;,<br>                body: formData<br>            })<br>            .then(response =&gt; response.json())<br>            .then(data =&gt; {<br>                if (data.transcription) {<br>                    document.getElementById(&quot;transcription&quot;).innerText = data.transcription;<br>                } else {<br>                    document.getElementById(&quot;transcription&quot;).innerText = &quot;Sorry, transcription failed.&quot;;<br>                }<br>            })<br>            .catch(error =&gt; {<br>                console.error(&quot;Error:&quot;, error);<br>                document.getElementById(&quot;transcription&quot;).innerText = &quot;Error transcribing audio.&quot;;<br>            });<br>        }<br>    &lt;/script&gt;</pre><h4><strong>Deploying on AWS Using Docker</strong></h4><p><strong>Why AWS &amp; Docker?</strong></p><ul><li>AWS provides scalable cloud infrastructure.</li><li>Docker ensures reproducible deployment across environments.</li></ul><h4>Set Up AWS EC2 Instance</h4><pre>aws ec2 run-instances --image-id ami-12345678 --count 1 --instance-type t2.micro</pre><h4>Install Docker on EC2</h4><pre>sudo apt update &amp;&amp; sudo apt install -y docker.io</pre><h4>Build &amp; Run Docker Image</h4><pre>docker build -t speech-to-text .<br>docker run -d -p 5000:5000 speech-to-text</pre><h4>Access the App</h4><pre>Go to http://your-ec2-instance-ip:5000 to test the speech-to-text model.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXBWhGExWz-57xTpD9Zt2w.png" /><figcaption>Speech-to-text App translation</figcaption></figure><h4>Conclusion</h4><p>Speech-to-text AI has seen remarkable advancements, moving from traditional statistical models to deep learning-based architectures like Whisper and Wav2Vec2. These models have significantly improved accuracy, noise robustness, and multilingual support. The integration of Spectrogram Analysis ensures effective feature extraction, enhancing speech recognition. Deploying these models on AWS with Docker provides a scalable and efficient solution for real-time transcription services. Future research can explore enhancing transcription with Large Language Models (LLMs) like GPT-4 Turbo and multimodal AI integrations with video understanding tools such as OpenAI’s SORA.</p><p>The codes are all publicly available on my Github repository <a href="https://github.com/CS2219/speech_text/tree/main">https://github.com/CS2219/speech_text/tree/main</a>. Please file an issue and contribute any improvements you think this project could need. In addition to fixing any problems on my Github, I would love to review and incorporate your feature improvements!</p><blockquote>“If you’ve made it this far, thank you for taking the time to read my article. If you found it insightful or helpful, I’d greatly appreciate it if you could show your support by giving it a few claps. Your encouragement means a lot and inspires me to share more. Thank you!”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=408cd5585e5f" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-a-real-time-speech-to-text-ai-system-using-whisper-wav2vec2-408cd5585e5f">Building a Real-Time Speech-to-Text AI System Using Whisper &amp; Wav2Vec2</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create an AWS Free Tier Account and Use AWS Machine Learning Services]]></title>
            <link>https://blog.stackademic.com/how-to-create-an-aws-free-tier-account-and-use-aws-machine-learning-services-66a36ca20fe8?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/66a36ca20fe8</guid>
            <category><![CDATA[aws-free-tier]]></category>
            <category><![CDATA[aws-sagemaker]]></category>
            <category><![CDATA[aws-machine-learning]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ec2-instance]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 00:09:31 GMT</pubDate>
            <atom:updated>2025-12-28T06:16:06.275Z</atom:updated>
            <content:encoded><![CDATA[<p>The cloud platform Amazon Web Services (AWS) gives users access to ML machine learning tools as well as a whole range of cloud-based services for model building and training. A free tier in Amazon Web Services lets users access multiple services without limits but restricted by specific usage boundaries.</p><p>This discussion shows you how to set up an AWS Free Tier account with information about applying AWS Machine Learning services to develop and release machine learning models. We will demonstrate an easy ML example through Amazon SageMaker because it serves as the main service for creating training and deploying maching learning models on AWS.</p><h3>Part 1: Creating an AWS Free Tier Account</h3><h4>Step 1: Sign Up for an AWS Account</h4><ol><li><strong>Go to the AWS Free Tier page</strong>: Visit <a href="https://aws.amazon.com/free/">AWS Free Tier</a> to learn about all the services available for free, including the free usage limits.</li><li><strong>Create an AWS account</strong>: Click on “Create an AWS Account” and follow the steps:</li></ol><ul><li><strong>Enter your email address</strong> and choose a password.</li><li><strong>Enter account information</strong>: You will be asked to provide your name, company (optional), and phone number.</li><li><strong>Select your payment method</strong>: AWS requires a credit card for verification, but you will not be charged unless you exceed the free tier limits.</li><li><strong>Complete identity verification</strong>: AWS may ask you to verify your identity by entering a code sent to your phone.</li></ul><h4>Step 2: Access AWS Management Console</h4><p>Once your AWS account is set up, you can log in to the AWS Management Console using your credentials.</p><ul><li>Navigate to the <a href="https://aws.amazon.com/console/">AWS Management Console</a> and sign in with the credentials you just created.</li></ul><p>From the console, you’ll have access to all AWS services, including those available in the Free Tier.</p><h4>Step 3: Understand AWS Free Tier Limits</h4><p>AWS Free Tier offers the following:</p><ul><li><strong>12-month Free Tier</strong>: Certain services are free for the first 12 months after you sign up (e.g., EC2, S3, RDS, Lambda, and more).</li><li><strong>Always Free</strong>: Some services are always free, such as AWS Lambda and certain amounts of Amazon DynamoDB.</li><li><strong>Trials</strong>: AWS also offers free trials for various services.</li></ul><p>Make sure you understand the usage limits for each service to avoid incurring any unexpected charges.</p><h3>Part 2: Using AWS Machine Learning Services with an Example</h3><p>Let’s now explore how to use one of the most popular AWS ML services, Amazon SageMaker, to build and deploy a simple machine learning model.</p><h4>Step 1: Create a SageMaker Notebook Instance</h4><p>Amazon SageMaker provides a fully managed environment to build, train, and deploy machine learning models. First, let’s create a notebook instance to get started.</p><ol><li><strong>Navigate to SageMaker in the AWS Console</strong>:</li></ol><ul><li>In the AWS Management Console, type “SageMaker” in the search bar and select Amazon SageMaker.</li><li>From the SageMaker dashboard, click on Notebook instances in the left sidebar.</li></ul><p><strong>2. Create a notebook instance</strong></p><ul><li>Click on Create notebook instance.</li><li>Enter a name for your notebook instance, such as ml-notebook.</li><li>For the instance type, select the ml.t2.medium instance, which is eligible for free tier usage (1 vCPU, 4 GB RAM).</li><li>For the IAM role, you can create a new role or choose an existing one with the appropriate permissions. SageMaker will use this role to access resources like S3 buckets for storing data.</li></ul><p><strong>3. Create the instance</strong>:</p><ul><li>Click on Create notebook instance, and SageMaker will provision the instance. This may take a few minutes.</li></ul><h4>Step 2: Access Your Jupyter Notebook</h4><p>Once the notebook instance is created, you can open it and start coding.</p><ol><li>In the Notebook instances tab, find your instance and click on the Open Jupyter link. This will launch a Jupyter notebook environment.</li><li>In Jupyter, you can start writing Python code to build your machine learning model.</li></ol><h4>Step 3: Build and Train a Simple Model</h4><p>Let’s walk through an example of building a simple linear regression model using <strong>scikit-learn</strong> on a small dataset.</p><ol><li><strong>Import necessary libraries</strong>: Open a new notebook and start by importing the libraries.</li></ol><pre>import numpy as np<br>import pandas as pd<br>from sklearn.model_selection import train_test_split<br>from sklearn.linear_model import LinearRegression<br>from sklearn.metrics import mean_squared_error</pre><p>2.<strong>Generate a simple dataset</strong>: We’ll create some dummy data for the example.</p><pre># Create a simple dataset<br>data = {<br>    &#39;X&#39;: np.random.rand(100, 1) * 10,  # Random values between 0 and 10<br>    &#39;Y&#39;: 5 * np.random.rand(100, 1) + 10  # Linear relationship with some noise<br>}<br><br>df = pd.DataFrame(data)<br>X = df[&#39;X&#39;].values.reshape(-1, 1)<br>Y = df[&#39;Y&#39;].values</pre><p>3.<strong>Split the data into training and test sets</strong>: We will split the data into 80% for training and 20% for testing.</p><pre>X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=42)</pre><p>4.<strong>Train a Linear Regression model</strong>: Now we can train a simple linear regression model using scikit-learn.</p><pre>model = LinearRegression()<br>model.fit(X_train, Y_train)</pre><p>5.<strong>Evaluate the model</strong>: After training the model, let’s evaluate its performance on the test set.</p><pre>Y_pred = model.predict(X_test)<br>mse = mean_squared_error(Y_test, Y_pred)<br>print(f&quot;Mean Squared Error: {mse}&quot;)</pre><p>6.<strong>Visualize the results</strong>: Finally, we can visualize the model’s predictions against the actual data.</p><pre>import matplotlib.pyplot as plt<br><br>plt.scatter(X_test, Y_test, color=&#39;blue&#39;, label=&#39;Actual values&#39;)<br>plt.plot(X_test, Y_pred, color=&#39;red&#39;, label=&#39;Predicted values&#39;)<br>plt.title(&#39;Linear Regression&#39;)<br>plt.xlabel(&#39;X&#39;)<br>plt.ylabel(&#39;Y&#39;)<br>plt.legend()<br>plt.show()</pre><p>This simple example demonstrates the process of using SageMaker to build and train a machine learning model. You can experiment with different datasets and models within the same notebook.</p><h4>Step 4: Deploy the Model</h4><p>Once your model is trained, you can deploy it using SageMaker’s deployment capabilities. You can create an endpoint to make predictions on new data.</p><ol><li><strong>Deploy the model</strong>: SageMaker allows you to easily deploy your trained model as an API endpoint for real-time predictions. Use the following code to deploy the model</li></ol><pre>from sagemaker import get_execution_role<br>from sagemaker.sklearn.model import SKLearnModel<br><br>role = get_execution_role()<br><br>sklearn_model = SKLearnModel(model_data=&#39;s3://path_to_your_model/model.tar.gz&#39;, role=role)<br><br>predictor = sklearn_model.deploy(initial_instance_count=1, instance_type=&#39;ml.t2.medium&#39;)</pre><ol><li><strong>Make predictions</strong>: You can now use the deployed model to make predictions.</li></ol><pre>result = predictor.predict(X_test)<br>print(result)</pre><h3>Conclusion</h3><p>Creating an AWS Free Tier account and leveraging AWS Machine Learning services like Amazon SageMaker is a great way to explore the world of cloud-based machine learning without incurring significant costs. In this article, we demonstrated how to set up a SageMaker notebook instance and build a simple linear regression model. With the AWS Free Tier, you can continue experimenting with AWS’s robust machine learning capabilities while staying within the free usage limits.</p><p>Remember, always monitor your usage to ensure you don’t exceed the free tier limits, and enjoy building your ML models on AWS!</p><blockquote><em>“If you’ve made it this far, thank you for taking the time to read my article. If you found it insightful or helpful, I’d greatly appreciate it if you could show your support by giving it a few claps. Your encouragement means a lot and inspires me to share more. Thank you!”</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66a36ca20fe8" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/how-to-create-an-aws-free-tier-account-and-use-aws-machine-learning-services-66a36ca20fe8">How to Create an AWS Free Tier Account and Use AWS Machine Learning Services</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI-Powered Stock Recommendation System: A Deep Dive into LangChain,NLP and Streamlit…]]></title>
            <link>https://blog.stackademic.com/building-an-ai-powered-stock-recommendation-system-a-deep-dive-into-langchain-nlp-and-streamlit-46fa43a2b255?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/46fa43a2b255</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[opeanai]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Thu, 28 Nov 2024 11:05:40 GMT</pubDate>
            <atom:updated>2025-12-25T16:13:03.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building an AI-Powered Stock Recommendation System: A Deep Dive into LangChain,NLP and Streamlit Integration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkFflvxAkKizHB8_ig38DQ.png" /></figure><p>In today’s fast changing markets, having well informed investment decisions depend on credible stock recommendations. To meet this need, we present an LLM-driven Stock Recommendation System using LangChain and current data feeds. This system involves NLP with the incorporation of actual financial data and news sentimental analysis, giving an accurate buy, sell or hold signals and the reason why.</p><p>The system exhibits the integrated utilisation of up-to-date stock metrics, market data and sentiment analysis through LangChain where it orchestrates various data source in one system. Using web scrapers from Yahoo Finance, NewsAPI, and Alpha Vantage, investors get recommendations based on the current market up or down. It means the subsequent recommendations are rather accurate while being accompanied by clear descriptions, thereby increasing users’ trust in their investment decisions.</p><h4>What Type of Recommendation System Is This?</h4><p>This system is a AI-powered recommendation engine that uses both unstructured data (sentimental analysis of news) and structured data (stock prices, P/E ratios) to provide stock investment advice. This is an illustration of Retrieval-Augmented Generation (RAG), which uses Open AI’s GPT and Lang Chain to generate and retrieve pertinent data in a sequential manner.</p><p>The recommendation system uses natural language processing to process stock news and algorithms to compute stock metrics. Its capacity to combine up-to-date data with external information — like favourable or unfavourable information about a particular company’s stock, as seen in the figure below — to make an investment recommendation is its unique feature.</p><h4>Key Functional Components</h4><p><strong>1.Data Fetching</strong> :To acquire stock and financial data, we employed a modular data_fetcher.py file.</p><p><strong><em>Yahoo Finance API</em></strong>: Retrieves historical data of stock prices and current statistics (such as P/E ratio).</p><p><strong><em>Alpha Vantage API</em></strong>: Affords financial details like the market value, and financial returns like, profit making ability.</p><p><strong><em>NewsAPI</em></strong>: Gathers latest articles of some stock ticker along with which latest news articles are subjected to sentiment analysis.</p><pre># Fetch stock data from Yahoo Finance<br>def fetch_stock_data(ticker):<br>    stock = yf.Ticker(ticker)<br>    stock_history = stock.history(period=&quot;1mo&quot;)  # Fetch historical data for 1 month<br>    stock_info = stock.info<br>    # Check if necessary data is available<br>    if &#39;currentPrice&#39; not in stock_info:<br>        print(f&quot;Warning: Missing &#39;currentPrice&#39; for {ticker}.&quot;)<br>    <br>    return stock_history, stock_info<br><br>def fetch_stock_news(ticker):<br>    # Replace with your actual NewsAPI key<br>    api_key = &#39;API_KEY&#39;  # Ensure your API key is set here<br>    url = f&quot;https://newsapi.org/v2/everything?q={ticker}&amp;apiKey={api_key}&quot;<br>    response = requests.get(url)<br>    news_data = response.json()<br>    # Check if the &#39;articles&#39; key exists<br>    if &#39;articles&#39; in news_data:<br>        return news_data[&#39;articles&#39;]<br>    else:<br>        return []  <br><br><br># Fetch financial data from Alpha Vantage<br>def fetch_financial_data(ticker):<br>    api_key = &#39;API_KEY&#39;<br>    fd = FundamentalData(api_key)<br>    try:<br>        # Fetching the company overview<br>        company_overview, _ = fd.get_company_overview(ticker)<br>        return company_overview<br>    except Exception as e:<br>        print(f&quot;Error fetching financial data: {e}&quot;)<br>        return None</pre><p><strong>2. Analysis of Sentiment</strong><br>One characteristic of this recommendation system is that in order to ascertain the market sentiment for a given stock, sentiment analysis must be done. Using an NLP algorithm based on the most recent articles, the system uses the Hugging Face FinBERT model to classify the articles as either positive or negative.</p><pre># sentiment_analysis.py<br>from transformers import pipeline<br><br># Initialize sentiment analysis pipeline (use HuggingFace model or any other sentiment analysis model)<br>def analyze_sentiment(news_articles):<br>    sentiment_analyzer = pipeline(&quot;sentiment-analysis&quot;, model=&quot;yiyanghkust/finbert-tone&quot;)  # Use a model that works for financial sentiment<br>    sentiments = []<br>    <br>    for article in news_articles:<br>        sentiment = sentiment_analyzer(article[&#39;title&#39;])[0]  # Analyzing the sentiment of the article title<br>        sentiments.append(sentiment[&#39;label&#39;])<br>    <br>    # Return the most common sentiment from the articles<br>    if sentiments:<br>        return max(set(sentiments), key=sentiments.count)<br>    return &quot;neutral&quot;  # Default to neutral if no sentiment can be determined</pre><p><strong>3. Using LangChain to Generate Suggestions</strong><br>The core elements of the system are organised around LangChain, which links the tools and allows for the creation and modification of responses based on the data gathered. LLMChain, a product of LangChain, formats the input data, including stock information, financial data, and news sentiment, according to a prompt. The output of this LLM is a suggestion regarding the specified security, which might be either to buy, sell, or hold.</p><pre>from langchain.chains import LLMChain<br>from langchain.prompts import PromptTemplate<br>from langchain.llms import OpenAI<br><br>def generate_recommendation(ticker):<br>    stock_history, stock_info = fetch_stock_data(ticker)<br>    price = stock_info.get(&#39;currentPrice&#39;, &#39;N/A&#39;)<br>    pe_ratio = stock_info.get(&#39;trailingPE&#39;, &#39;N/A&#39;)<br>    market_cap = stock_info.get(&#39;marketCap&#39;, &#39;N/A&#39;)<br><br>    sentiment = process_stock_news(fetch_stock_news(ticker))<br><br>    # Define the prompt<br>    prompt = f&quot;&quot;&quot;<br>    You are a stock recommendation expert. Use the following data to recommend whether the stock should be a &quot;Buy&quot;, &quot;Sell&quot;, or &quot;Hold&quot;:<br><br>    Stock Data: <br>    - Price: ${price}<br>    - P/E Ratio: {pe_ratio}<br>    - Market Cap: {market_cap}<br><br>    News Sentiment: {sentiment}<br><br>    Based on these inputs, recommend whether the stock is a &quot;Buy&quot;, &quot;Sell&quot;, or &quot;Hold&quot;. Provide an explanation.<br>    &quot;&quot;&quot;<br><br>    # Using LangChain to generate the recommendation<br>    llm_chain = LLMChain(prompt=PromptTemplate(input_variables=[&quot;input&quot;], template=prompt), llm=OpenAI(api_key=&quot;OPENAI_API_KEY&quot;))<br>    result = llm_chain.run({&#39;input&#39;: prompt})<br><br>    # Parse the result<br>    recommendation = parse_recommendation(result)<br>    explanation = parse_explanation(result)<br><br>    return recommendation, explanation</pre><p><strong>4. Why This System Is Effective</strong><br>The Stock Recommendation System driven by LLM works well because it:</p><p><strong><em>Combines Multiple Data Sources: </em></strong>To create a thorough understanding of stock performance, it integrates unstructured textual data — specifically, article sentiment — with price data, financial statistics, and fundamental indicators.<br><strong><em>How LangChain is used:</em></strong> Therefore, as a tool, LangChain enables you to collaborate with other applications concurrently and combine the results of many models and APIs to produce more complex and instantaneous recommendations.<br><strong><em>Produces Explainable Recommendations:</em></strong> The model provides a solution together with the justification for it, which is essential when evaluating financial choices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fc9cvzzZwF1yhsC74GW0pg.png" /><figcaption>Recommendation for MSFT</figcaption></figure><p><strong>Conclusion</strong><br>This LLM-Based Stock Recommendation System, which incorporates generative models, machine learning algorithms, and natural language processing, is an ideal example of how artificial intelligence is used in business. It appears that the system, which is based on data APIs like OpenAI and LangChain, evaluates news sentiment, stock data, and financial APIs to dynamically decide whether to “buy,” “sell,” or “hold” on the site. The application of AI and predictive analytics makes this model a practical tool for investors who want to make judgements quickly.</p><p>The codes are all publicly available on my Github repository <a href="https://github.com/CS2219/Recommender_system">https://github.com/CS2219/Recommender_system</a>. Please file an issue and contribute any improvements you think this project could need. In addition to fixing any problems on my Github, I would love to review and incorporate your feature improvements!</p><blockquote><em>“If you’ve made it this far, thank you for taking the time to read my article. If you found it insightful or helpful, I’d greatly appreciate it if you could show your support by giving it a few claps. Your encouragement means a lot and inspires me to share more. Thank you!”</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46fa43a2b255" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-an-ai-powered-stock-recommendation-system-a-deep-dive-into-langchain-nlp-and-streamlit-46fa43a2b255">Building an AI-Powered Stock Recommendation System: A Deep Dive into LangChain,NLP and Streamlit…</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Personalization: A Guide to Recommendation Systems]]></title>
            <link>https://medium.com/@chaitalisawant22/unlocking-personalization-a-guide-to-recommendation-systems-8e411cba5dfd?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e411cba5dfd</guid>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[overview]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Tue, 26 Nov 2024 07:33:56 GMT</pubDate>
            <atom:updated>2024-11-26T07:33:56.804Z</atom:updated>
            <content:encoded><![CDATA[<p>The personalisation of regular activities, such as watching Netflix films and making purchases on Amazon, is supported by recommendation algorithms. This article aims to review the definition of recommendation system, its workflow ,benefits and limitations with exploring such systems are deployment and evaluated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HUE4M8Dra7_A-P5AEIAV4g.png" /></figure><p><strong>What Are Recommendation Systems?</strong></p><p>Recommendation systems are programs designed to make recommendations for goods, services, or content that would be appropriate for a user. They enable a targeted approach to a variety of areas, including buying, viewing films or television shows, and learning, after gathering user data.</p><p><strong>How Recommendation Systems Work</strong></p><p>In order to provide recommendations, recommendation systems essentially identify patterns in user behaviours, preferences, and previous activities. This is a summary of their process:<br> 1. <strong><em>Data Collection</em></strong>: Collect data of various item attributes and user behaviours (clicks, ratings, purchases, etc.).<br> 2. <strong><em>Data Pre-processing</em></strong>: Structure the data and display it in a manner that is understandable.<br> 3. <strong><em>Model Building</em></strong>: Using machine learning models to make user suggestions.<br> 4. <strong><em>Recommendation Generation</em></strong>: Provide forecast-based recommendation services.<br> 5. <strong><em>Evaluation and Feedback</em></strong>: Assess outcomes and make the model better.</p><p><strong>Benefits of Recommendation Systems</strong><br> <strong><em>Personalisation</em></strong>: Users are more likely to be happy with recommendations when they are tailored to their needs.<br> <strong><em>Increased Revenue</em></strong>: Increase the likelihood of selling more of the same product and cross-selling.<br> <strong><em>Increased User Engagement</em></strong>: The type of material that is shown to users will keep them interested.<br><strong><em> Efficiency</em></strong>: Helps consumers find the commodities they need from a large selection of stocks.</p><p><strong>Problems Recommendation Systems Solve in Different Domains</strong></p><p><strong>E-Commerce</strong>:</p><ul><li><strong><em>Challenge</em></strong>: Helping customers discover products they may not know exist.</li><li><strong><em>Solution</em></strong>: Personalized product suggestions based on browsing and purchase history.</li></ul><p><strong>Healthcare</strong>:</p><ul><li><strong><em>Challenge</em></strong>: Recommending personalized treatment or medication for patients.</li><li><strong><em>Solution</em></strong>: Algorithms that analyze patient data to suggest relevant medical solutions.</li></ul><p><strong>Types of Recommendation Systems</strong></p><p>1. <strong>Content-Based Filtering</strong></p><ul><li><strong><em>How it Works</em></strong>: Recommends items similar to what a user has liked before, based on item attributes.</li><li><strong><em>Drawbacks</em></strong>: Limited to known user preferences and struggles with cold-start problems (new users or items).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*1tCh3c2dUTPRnPUKAhqZdQ.png" /></figure><p>2. <strong>Collaborative Filtering</strong></p><ul><li><strong><em>How it Works</em></strong>: Uses collective user behaviour to recommend items.</li><li><strong><em>Drawbacks</em></strong>: Struggles with limited availability of data(user based). Suffers when new users or items are introduced(Item based).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*4UvAt5VD6S-t50B8v2QwQA.png" /></figure><p>3. <strong>Hybrid Systems</strong></p><ul><li><strong><em>How it Works</em></strong>: Combines content-based and collaborative methods for better accuracy.</li><li><strong><em>Drawbacks</em></strong>: Computationally expensive to implement and maintain.</li></ul><p><strong>How to Implement a Recommendation System</strong></p><p><strong>1. Gather and Pre-process Data</strong></p><ul><li><strong><em>Data Sources</em></strong>: Use datasets like MovieLens, APIs like Spotify API, or enterprise user-event logs.</li><li><strong><em>Preprocessing</em></strong>: Clean data, build user-item matrices, and extract features like item tags or user demographics.</li></ul><p><strong>2. Select a Model</strong></p><ul><li><strong><em>Traditional Models</em></strong>:k-NN, cosine similarity for small datasets.Matrix Factorization (e.g., SVD, ALS) for collaborative filtering.</li><li><strong><em>Deep Learning Models</em></strong>:Neural Collaborative Filtering (NCF): Learns dense user-item embeddings. BERT4Rec or Transformers4Rec: For session-based or sequential recommendations.</li><li><strong><em>Graph Neural Networks (GNNs)</em></strong>: Like PinSage for graph-structured data.</li></ul><p><strong>3. Build the System</strong></p><ul><li>Use libraries like Surprise (for CF), RecBole, or Microsoft Recommenders.</li><li>Leverage TensorFlow or PyTorch for custom deep learning models.</li><li>Hugging Face Transformers for LLM-based recommendation tasks.</li></ul><p><strong>4. Deploy</strong></p><ul><li><strong><em>APIs</em></strong>: Serve recommendations with FastAPI or Flask.</li><li><strong><em>Tools</em></strong>: Use TensorFlow Serving, TorchServe, or cloud platforms like AWS SageMaker and Google Vertex AI.</li><li><strong><em>Scaling</em></strong>: Containerize with Docker and orchestrate with Kubernetes.</li><li><strong><em>Monitoring</em></strong>: Track performance using Prometheus or Grafana and refine models with user feedback.</li></ul><p><strong>How to Evaluate a Recommendation System</strong></p><p><strong>Key Metrics</strong>:</p><ol><li><strong><em>Precision &amp; Recall</em></strong>: Measure how many recommended items are relevant.</li><li><strong><em>Mean Absolute Error (MAE)</em></strong>: Quantifies the accuracy of predicted ratings.</li><li><strong><em>F1-Score</em></strong>: Balances precision and recall.</li><li><strong><em>Diversity</em></strong>: Ensures recommendations aren’t repetitive.</li></ol><p><strong>Conclusion</strong></p><p>Recommendation systems transform raw data into meaningful insights, offering personalized experiences in countless domains. While challenges like cold starts or computational costs persist, advancements in AI and machine learning continue to enhance their effectiveness.</p><p>Further Reading:</p><ul><li><a href="https://scholar.google.com/scholar?q=Recommender+Systems+Resnick"><em>Resnick &amp; Varian, 1997, “Recommender Systems”</em></a></li><li><a href="https://scholar.google.com/scholar?q=Matrix+Factorization+Techniques+for+Recommender+Systems">Koren et al., 2009, “Matrix Factorization Techniques for Recommender Systems”</a></li><li><a href="https://scholar.google.com/scholar?q=Two+Decades+of+Recommender+Systems+at+Amazon">Smith &amp; Linden, 2017, “Two Decades of Recommender Systems at Amazon”</a></li><li><a href="https://scholar.google.com/scholar?q=Recommendation+Systems+in+Healthcare">Ricci et al., 2021, “Recommendation Systems in Healthcare”</a></li></ul><p>By embracing recommendation systems, businesses and organizations can unlock new opportunities for engagement, satisfaction, and success.</p><blockquote>“If you’ve made it this far, thank you for taking the time to read my article. If you found it insightful or helpful, I’d greatly appreciate it if you could show your support by giving it a few claps. Your encouragement means a lot and inspires me to share more. Thank you!”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e411cba5dfd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of Chatbots with Dialogflow and Flask for a restaurant]]></title>
            <link>https://medium.datadriveninvestor.com/overview-of-chatbots-with-dialogflow-and-flask-for-a-restaurant-a8f9c0ec684c?source=rss-013e6eccfc09------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8f9c0ec684c</guid>
            <category><![CDATA[mongodb-atlas]]></category>
            <category><![CDATA[dialogflow]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[chatbots-for-business]]></category>
            <category><![CDATA[flask]]></category>
            <dc:creator><![CDATA[Chaitalisawant]]></dc:creator>
            <pubDate>Wed, 13 Nov 2024 16:36:27 GMT</pubDate>
            <atom:updated>2025-12-25T07:45:08.317Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Chatbots: What Are They?<br> </strong>AI-based programs known as chatbots function as a user’s natural conversation partner. They interact with users by text or voice, responding to enquiries, providing assistance, and carrying out tasks. Chatbots, usually found in customer service, improve efficiency, elevate the experience, and increase efficacy.</p><p><strong>Chatbot History<br> Joseph Weizenbaum created ELIZA in 1966</strong>, which is regarded as the first chatbot. Using simple pattern matching, one of them was able to engage people by mimicking a Rogerian psychotherapist.<br> <strong>PARRY</strong>: Kenneth Colby created this in 1972. Compared to ELIZA, PARRY was more complex and included the mental and emotional states of a paranoid schizophrenia.</p><p><strong>ALICE(1995)</strong>: The Loebner Prize for Artificial Intelligence was won by ALICE, another chatbot that used natural language processing.<br> <strong>Facebook(2011)</strong>: One of the most significant conversational AI pioneers, Facebook is a social network that uses a platform to link friends and businesses worldwide.<br> <strong>Alexa(2014)</strong>, Amazon’s speech assistant, brought voice commands to a variety of tasks and made smart home systems a reality.</p><p><strong>Microsoft Copilot</strong>, a sophisticated take on contemporary chatbots, was created in 2024 with real-time links to Microsoft Word and Excel, allowing the AI to conduct extensive calculations in Microsoft Excel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*neYNphOzocU0nSfi_dQOsg.png" /><figcaption>Img src:<a href="https://www.appypie.com/blog/what-is-a-chatbot">https://www.appypie.com/blog/what-is-a-chatbot</a></figcaption></figure><p><strong>How Do Chatbots Work?</strong></p><p>Chatbots can operate using either machine learning techniques or scripts. After combining user input with a pre-categorized response, they transmit the relevant response. Natural language processing and artificial intelligence (AI) are used in the improved versions to understand the context, improve the interaction, and personalise the responses.</p><p><strong>Chatbot Types</strong></p><p><strong>Rule-Based Chatbots:</strong> These are patterned and always respond to commands with a pre-programmed response.</p><p><strong>AI-Powered Chatbots:</strong> These may learn from these exchanges and give more complex, context-sensitive responses since they have included machine learning and natural language processing.</p><p>Hybrid chatbots are equipped with both rule-based and AI-based features that allow them to perform basic enquiries in addition to more complex conversational tasks.</p><p><strong>Tools to Develop and Deploy Chatbots</strong></p><ul><li><strong>Dialogflow (Google):</strong> A popular NLP platform for building conversational interfaces.</li><li><strong>Microsoft Bot Framework:</strong> A comprehensive set of tools for building chatbots that integrate with Microsoft’s ecosystem.</li><li><strong>Rasa:</strong> An open-source machine learning framework for building sophisticated, customizable chatbots.</li><li><strong>Botpress:</strong> A developer-friendly platform for building, deploying, and managing chatbots using Node.js.</li><li><strong>Tars:</strong> A chatbot platform that focuses on lead generation and customer service for websites.</li></ul><p>These tools help streamline chatbot development and offer various integrations with popular platforms and languages.</p><p><strong>Guidelines to Follow When Creating Chatbots</strong></p><p><strong>Establish Specific Goals</strong>: The first step should be to describe the chatbot’s precise goals. This could involve making reservations, improving sales, or improving customer service.<br> <strong>User-focused design:</strong> Make sure the chatbot’s conversational approach makes it easy to grasp what you’re doing. In this regard, the dialogue should be natural and responsive to the user, rather than being written.<br> <strong>Maintain a Simple Dialogue:</strong> This implies reducing interactions with various links that could irritate users. Don’t make your response too complicated: Always make careful to give succinct, direct answers if at all possible.<br> <strong>Customisation</strong>: Having the ability to use information to enhance client relationships, such as recalling previous orders or connecting with the CRM.</p><p><strong>Test and Iterate</strong>: Evaluate interactions continuously, rebuild the chatbot for new questions, and boost its effectiveness.</p><p><strong>Fallback Options</strong>: The chatbot is meant to offer a human intervention option, such customer care help, in the event that it is unable to respond to a user.</p><h3><strong>The application of chatbots in the restaurant industry.</strong></h3><p><strong>Functionalist of the chatbot</strong><br> <strong>Suggesting Menu Items</strong>: A customer can speak with a chatbot that can be scanned on the business website to make a reservation for supper at the restaurant. Based on their past orders or personal preferences, the chatbot assists consumers in making food and drink recommendations.<br> <strong>Making Reservations</strong>: It allows customers to make direct reservations for tables and provides rapid confirmation of those reservations as well as the availability of tables.<br> <strong>Customer service</strong> includes answering any questions patrons may have regarding restaurants, like their address, menu, special offers, and meal options,chatbots are always quick to provide this information.</p><p><strong>Gathering Feedback:</strong> Finally, following a meal, the chatbot may display well-known feedback forms asking patrons about their impressions of the food, level of service, and overall dining experience.<br> <strong>New Menu Surveys:</strong> To forecast consumer response to the decision to launch, users might be contacted with surveys on the possibility of new dishes or exclusive specials.<br> <strong>Processing Orders:</strong> By enabling customers to place orders, the chatbot reduces order processing time and removes human mistake.</p><p>In this guide, we will build a chatbot for a restaurant using Rasa for Natural Language Understanding (NLU), Flask as the web framework, and Socket.IO for real-time communication. The bot will handle various tasks such as reservations, ordering food, collecting feedback, and suggesting menu items.</p><p><strong>Step 1: Set Up Your Environment</strong></p><p><strong>Prerequisites:</strong></p><ol><li>Install Python (3.8 or above):</li><li>Install MongoDB:</li><li>Install Flask</li><li>Install pymongo</li><li>Install Dialogflow library</li></ol><p><strong>Step 2: Set Up Dialogflow</strong></p><p>1. <strong>Create a Dialogflow Agent:</strong></p><ul><li>Go to Dialogflow Console.</li><li>Create a new agent named RestaurantBot.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*HKeX_kSlW0ETtc2zuzRZQg.png" /></figure><p><strong>2. Define Intents: Add intents for:</strong></p><ul><li>Customer service</li><li>Booking reservations</li><li>Recommending food and drinks</li><li>New menu survey</li><li>Promoting offers</li></ul><p>Define training phrases and responses for each intent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*TiDFgx5vtlPwWciGxfwUPg.png" /></figure><p>3. <strong>Enable Fulfillment for Intents</strong>:</p><ul><li>For intents like “Booking Reservations” and “Recommending Food,” enable <strong>fulfillment</strong> to connect with Flask for custom logic.</li></ul><p>4. <strong>Download Service Account Key</strong>:</p><ul><li>Go to <strong>Settings &gt; Project Settings &gt; Service Account</strong>.</li><li>Generate and download a JSON key for authentication.</li><li>Save the file as dialogflow-key.json.</li></ul><p><strong>Step 3: Set Up MongoDB</strong></p><p>Here I have used Mongodb atlas, cloud db. First you need to create an account MongoDB Atlas Account through MongoDB Atlas website (<a href="https://www.mongodb.com/cloud/atlas/register">https://www.mongodb.com/cloud/atlas/register</a> ) .</p><p>Second, you need to create a cluster, setup your database and collections. You would need to save the connection string, it would be similar to the below screenshot.</p><p>Then create the following collections:</p><ul><li>reservations</li><li>menu_items</li><li>offers</li><li>user_data</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*X1Za_Q0YlAIKXsoLEKyeGw.png" /></figure><p><strong>Step 4: Create Flask Application</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*Cs-UKpxRqQX4yX2HxzoDew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*DxkKDYTCjNyxXIIWE9tbug.png" /></figure><p><strong>Step 5: Frontend Setup</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*TRq23hz7nu4iYW6MzKaYXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*nmC2OGnRV_Sz6UuHLJd8pw.png" /></figure><p><strong>Conclusion,</strong></p><p>We used Dialogbox and Flask to create a basic chatbot with very little data. By adding different corner cases, this can definitely be much enhanced and made more practical in everyday life. The codes are all publicly available on my Github repository(<a href="https://github.com/CS2219/Chatbot">https://github.com/CS2219/Chatbot</a>). Please file an issue and contribute any improvements you think this project could need. In addition to fixing any problems on my Github, I would love to review and incorporate your feature improvements!Hello</p><blockquote>If you have read this far and appreciated my effort, I would like to ask that you please give it a few claps. I apologise if this sounds foolish.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8f9c0ec684c" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/overview-of-chatbots-with-dialogflow-and-flask-for-a-restaurant-a8f9c0ec684c">Overview of Chatbots with Dialogflow and Flask for a restaurant</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>