<?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 Ankushsaha on Medium]]></title>
        <description><![CDATA[Stories by Ankushsaha on Medium]]></description>
        <link>https://medium.com/@ankushsaha96?source=rss-b7c1eba2a518------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*CBNAAam6BJx1f6Im</url>
            <title>Stories by Ankushsaha on Medium</title>
            <link>https://medium.com/@ankushsaha96?source=rss-b7c1eba2a518------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:36:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ankushsaha96/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[I Gave an AI 340 Pages of Financial Reports.
It Answered in 3 Seconds.]]></title>
            <link>https://medium.com/@ankushsaha96/i-gave-an-ai-340-pages-of-financial-reports-it-answered-in-3-seconds-fec5547d76c1?source=rss-b7c1eba2a518------2</link>
            <guid isPermaLink="false">https://medium.com/p/fec5547d76c1</guid>
            <category><![CDATA[financial-report]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[analyzer]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Ankushsaha]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 07:42:52 GMT</pubDate>
            <atom:updated>2026-04-06T11:34:25.569Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How I built FinSight AI — a production RAG system that auto-fetches Indian company filings, understands them with NVIDIA embeddings, and lets anyone have a real conversation with any annual report — for free.</em></p><blockquote>Ankush Saha·12 min read·AI · LLMs · Finance · Python</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pg_vdow-PtxwcNdvCeiAAA.png" /></figure><p>It was 11 PM on a Sunday. I was deep-diving into Infosys’s FY24 annual report, trying to answer a single question: <em>did their free cash flow improve after the restructuring?</em></p><p>Three hundred and forty pages. I ctrl+F’d “cash flow.” Got 31 matches. Most of them were in headings, footnotes, and boilerplate risk disclosures. The actual answer — the number I needed — was buried inside a table on page 187, cross-referenced with a note on page 219, and only meaningful if you’d also read the segment commentary on page 94.</p><p>I spent 45 minutes finding a three-sentence answer.</p><p>That night, I thought: <em>a professional analyst would solve this in 30 seconds. Why can’t software?</em></p><p>Two weeks later, it could.</p><h3>🚨 The Problem Nobody Talks About</h3><p>Annual reports are the single richest source of truth about a publicly listed company. Every number, every risk, every management admission of a bad quarter — it’s all in there, mandated by law.</p><p>They’re also completely unusable for most people.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*5woyBvCGdwf4OagCwdETQg.png" /></figure><p>The information gap in retail investing isn’t really about data availability. NSE forces every listed company to publish detailed annual reports — it’s all public. The gap is about accessibility. Goldman Sachs has teams of analysts who read these documents. You don’t.</p><p>This project closes that gap.</p><h3>💡 RAG — The Idea That Makes This Possible</h3><p>Before we get into the build, let me explain the core concept: Retrieval Augmented Generation, or RAG. Because once you get this, everything else clicks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*YHieJCJf7KIVshBjg7VrXA.png" /></figure><p>This is fundamentally different from just asking ChatGPT “what’s Infosys’s cash flow?” ChatGPT will guess from its training data — which may be outdated, incomplete, or simply wrong. RAG grounds every answer in the <em>actual document</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*CY-C078fdoYy_0vEa6rsqw.png" /></figure><h3>📱 What It Actually Feels Like</h3><p>Before diving into the engineering, here’s a real interaction with the system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*BryP-CPrvOZmS0Hc_U3LJA.png" /></figure><p>Notice those page number links? Every claim is pinned to a specific page in the actual filing. You can click through and verify it yourself. This is what separates FinSight AI from a hallucinating chatbot — it’s a <em>search engine that talks back</em>, with receipts.</p><h3>🏗️ How It’s Built — The Full Pipeline</h3><p>Here’s the full system at a glance. It has two phases: Indexing (happens once per document) and Querying (happens every time a user asks a question).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*Wp5eSjyv-_Ej-X9hTmiE-w.png" /></figure><p>The key insight is that the indexing phase only runs once. After a company’s report is processed and stored in Qdrant, every subsequent user query skips straight to the retrieval step. This is what makes the system fast — and what makes it scale.</p><h3>⚙️ Five Engineering Decisions That Made This Work</h3><blockquote>1 — Auto-fetching from NSE India</blockquote><p>Most RAG tutorials start with: “upload your PDF.” I wanted zero friction. NSE India publishes every annual report from every listed company — publicly. The system uses session warming (mimicking browser behavior) to pull any report on demand. You type “Tata Motors” and “FY2024” — and the backend handles the rest.</p><blockquote>2 — Chunking with page tracking</blockquote><p>A 300-page PDF gets sliced into overlapping chunks of about 500 tokens each. Every chunk remembers its page number. This is why citations work — when the AI retrieves a chunk to answer your question, it knows exactly where in the document that chunk lived.</p><p>Think of it like Post-it notes on every paragraph, each one reading: <em>“This came from page 94.”</em></p><blockquote>3 — NVIDIA NV-Embed-QA for embeddings</blockquote><p>Not all embedding models are equal. NV-Embed-QA is specifically tuned for retrieval — meaning it’s been trained to maximize the similarity between a question and its relevant answer passage. A generic embedding model might think “revenue growth” and “top-line expansion” are unrelated. NV-Embed-QA knows they’re the same thing.</p><p>Each chunk becomes a 2,048-dimensional mathematical fingerprint. Questions get the same treatment. The retrieval step is just: <em>which fingerprints are closest?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*-UCvh_VNv0OcHdUzc-mO4w.png" /></figure><blockquote>4 — Qdrant with filtered search</blockquote><p>As the vector database grows across hundreds of companies and years, you don’t want a query about Wipro FY23 accidentally pulling chunks from Infosys FY24. Qdrant’s payload filters let you attach metadata (company, year) to every vector, then filter before similarity search even runs. Result: fast, precise retrieval that stays in its lane.</p><blockquote>5 — Structured JSON responses from the LLM</blockquote><p>The LLM doesn’t return free-form text. The prompt explicitly instructs Llama 3.3 to respond as structured JSON:</p><pre>{<br>  &quot;answer&quot;: &quot;Operating margin declined to 20.7%...&quot;,<br>  &quot;citations&quot;: [94, 97, 112],<br>  &quot;confidence&quot;: 0.91,<br>  &quot;source_chunks&quot;: [&quot;...margin contracted due to...&quot;]<br>}</pre><p>This forces the model to be specific about what it knows and where it found it. No vague handwaving. If it can’t find the answer in the retrieved chunks, it says so — rather than hallucinating a plausible-sounding number.</p><h3>🛠️ The Full Tech Stack</h3><p>Every tool here has a specific reason for being chosen — and all of it runs on free tiers:</p><p>Python 3.10+FastAPIReact + ViteNVIDIA NV-Embed-QAQdrant CloudGroq / Llama 3.3 70BPyMuPDFVercelRenderDocker</p><p>1 FastAPI + Uvicorn — the backbone</p><p>Async Python API with four clean endpoints: health check, check-embeddings, create-embeddings, and query. Swagger docs auto-generated at /docs. Handles long-running embedding jobs without blocking other requests.</p><p>2 Groq’s inference engine — the secret weapon</p><p>Groq runs custom silicon (LPUs) specifically designed for LLM inference. Running Llama 3.3 70B on Groq is roughly 10× faster than running it on standard GPUs. A model with 70 billion parameters responds in under a second.</p><p>3 React + Vite frontend — dark-mode, glassmorphic</p><p>The chat interface renders markdown, shows inline page citation badges, displays confidence bars, and supports source tooltips on hover. Deployed on Vercel — pushes to main, it’s live in 30 seconds.</p><p>4 Config-as-code — everything tunable</p><p>Vector size, top-K results, model names, collection names — all live in typed Python dataclasses in src/config.py. Swapping from NVIDIA embeddings to OpenAI embeddings is a one-line change. This is what makes it production-maintainable, not just a demo.</p><h3>🔥 Why This Pattern Changes Everything</h3><p>The RAG architecture built here isn’t just for annual reports. It’s a template for any domain where you have large, authoritative documents and users who need trusted answers fast.</p><blockquote>Annual reports. Legal contracts. Medical literature. Government policy documents. The pattern is always the same: dense text, important information, and humans who don’t have time to read all of it.</blockquote><p>For Indian retail investors specifically, this matters enormously. The NSE lists over 2,000 companies. Their annual reports are public. But the tooling to make them <em>conversational</em> has been locked behind Bloomberg terminals and institutional research desks — tools that cost thousands of dollars a month.</p><p>This entire system runs on free tiers. Total cost to replicate it: ₹0 per month.</p><pre>⚡ Real-world use cases<br>Retail investors researching stocks before earnings. <br>Finance students analyzing sector trends. <br>Journalists fact-checking company claims. <br>Startup founders benchmarking against public companies. <br>All of them can now have a 3-second conversation with any annual report.</pre><h3>🚀 Run It Yourself in 10 Minutes</h3><p>The live app is already deployed at <a href="https://rag-annual-analyzer.vercel.app/">rag-annual-analyzer.vercel.app</a>. But here’s how to run FinSight AI locally or adapt it for your own documents.</p><blockquote>Step 1 — Get the code</blockquote><pre>$ git clone https://github.com/ankushsaha96/RAG-annual-analyzer.git<br>$ cd RAG-annual-analyzer &amp;&amp; pip install -r requirements.txt</pre><blockquote>Step 2 — Get your (free) API keys</blockquote><p>Three free accounts. Five minutes.</p><ul><li>→ <a href="https://console.groq.com/">console.groq.com</a> — for Llama 3.3 70B inference</li><li>→ <a href="https://build.nvidia.com/">build.nvidia.com</a> — for NV-Embed-QA embeddings</li><li>→ <a href="https://cloud.qdrant.io/">cloud.qdrant.io</a> — for your vector database</li></ul><pre>$ export GROQ_API_KEY=&quot;gsk_...&quot;<br>$ export NVIDIA_API_KEY=&quot;nvapi-...&quot;<br>$ export QDRANT_URL=&quot;https://your-cluster.qdrant.io:6333&quot;<br>$ export QDRANT_API_KEY=&quot;your-key&quot;</pre><blockquote>Step 3 — Launch</blockquote><pre># Terminal 1 — Backend<br>$ uvicorn api:app --reload<br><br># Terminal 2 — Frontend<br>$ cd frontend &amp;&amp; npm install &amp;&amp; npm run dev</pre><p>Open http://localhost:5173. Type &quot;Infosys&quot;. Type &quot;FY2024&quot;. Start asking questions.</p><pre>🐳 Docker option<br>Prefer containers? docker build -t rag-analyzer . and pass your environment <br>variables with -e flags. Full Dockerfile is in the repo.</pre><h3>📌 Key Takeaways</h3><p>What to remember from this build</p><ul><li>RAG grounds AI answers in real documents — it’s the difference between a hallucinating chatbot and a trusted research assistant.</li><li>Embedding caching is the key to production performance — index once, query infinitely.</li><li>Filtered vector search keeps retrieval precise even as your document database scales to thousands of reports.</li><li>Forcing structured JSON responses (with citations + confidence scores) makes AI answers verifiable, not just plausible.</li><li>NVIDIA NV-Embed-QA + Groq is a genuinely powerful stack: semantic retrieval quality + 70B-parameter reasoning at &lt; 3s latency.</li><li>The NSE auto-fetch means zero manual work — name a company, get an answer.</li><li>This entire production system runs on free-tier infrastructure. The moat in AI isn’t cost — it’s architecture.</li></ul><h3>🔮 What’s Next</h3><p>Every honest engineering write-up has this section. Here’s what I’d build next:</p><pre>Better Table Extraction<br>PyMuPDF struggles with complex financial tables. Camelot or pdfplumber <br>would dramatically improve balance sheet and income statement answers.<br><br>Multi-Company Comparison<br>&quot;How did Infosys margins compare to Wipro?&quot; needs cross-company retrieval. <br>Qdrant&#39;s filters make this architecturally straightforward.<br><br>Streaming Responses<br>Server-Sent Events would make answers feel live — tokens appear as the <br>LLM generates them, not all at once after a wait.<br><br>Re-ranking Layer<br>Adding Cohere Rerank as a second-pass filter after vector retrieval would <br>catch subtle relevance mismatches and improve answer quality for ambiguous <br>queries.<br><br>BSE + Global Exchanges<br>NSE covers one market. Extending to BSE, then SEC EDGAR for US companies, <br>would make this a genuinely global research tool.<br><br>Multi-Year Trend Analysis<br>&quot;Show me Tata Motors&#39; revenue trend over 5 years&quot; requires querying across <br>multiple indexed documents simultaneously.<br></pre><h3>Try FinSight AI — Right Now</h3><p>The full app is live. No signup. No API key. Pick any NSE-listed company and start asking questions.</p><p><a href="https://rag-annual-analyzer.vercel.app/">Open Live App ↗</a></p><p><a href="https://github.com/ankushsaha96/RAG-annual-analyzer">View Source on GitHub</a></p><p>That Sunday night when I spent 45 minutes hunting through a PDF — I wasn’t solving a niche problem. Every investor, analyst, journalist, or curious person who has ever opened an annual report has felt exactly that frustration.</p><p>The technology to fix it has existed for a while. It just needed someone to put it together in the right order.</p><p>Now it exists. And it costs nothing to use.</p><blockquote>Written about <a href="https://github.com/ankushsaha96/RAG-annual-analyzer">FinSight AI</a> by Ankush Saha · Stack: Python · FastAPI · React · Qdrant · NVIDIA NeMo · Groq · Llama 3.3 70B · Vercel · Render</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fec5547d76c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Restaurant recommendation Challenge — Kaggle]]></title>
            <link>https://medium.com/@ankushsaha96/restaurant-recommendation-challenge-kaggle-dedfaf4ad5e?source=rss-b7c1eba2a518------2</link>
            <guid isPermaLink="false">https://medium.com/p/dedfaf4ad5e</guid>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[surprise-library]]></category>
            <category><![CDATA[kaggle-dataset]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[restaurant-recommendation]]></category>
            <dc:creator><![CDATA[Ankushsaha]]></dc:creator>
            <pubDate>Thu, 20 Oct 2022 12:58:52 GMT</pubDate>
            <atom:updated>2022-10-22T13:30:15.455Z</atom:updated>
            <content:encoded><![CDATA[<h3>Restaurant recommendation Challenge — Kaggle</h3><p>Science behind recommending restaurants to customers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*PI3JE9BwVs9InLpPxR7YjA.png" /></figure><h3><strong>Contents</strong></h3><ol><li><a href="#_Toc117028822">Problem Statement</a></li><li><a href="#_Toc117028823">Approach</a></li><li>Loss metrics</li><li><a href="#_Toc117028824">EDA</a></li><li><a href="#_Toc117028832">Models</a></li><li><a href="#_Toc117028842">Model Comparison</a></li><li><a href="#_Toc117028843">Future Work</a></li><li>Github &amp; Linkedin links</li><li>Video demo of the app</li><li><a href="#_Toc117028844">Reference</a></li></ol><h3>1. Problem Statement</h3><p>We are given set of users, vendors and details of orders placed by the users to the vendors. We are also given the vendor locations, user locations. We are also given with details of some more users for whom we don’t have any order history. We need to predict the vendors from which the users might place order.</p><h3>2. Approach</h3><p>We will pose this problem as a cold start problem. As we don’t have any order history of the target customers, we can’t use behavioural pattern to recommend other restaurants to them. So, we will take the regular customers and will try to predict the ratings for other vendors, so that we have large set of ratings. Now using the available customer data, we will try to find the most similar customers and we will predict the restaurants liked by them to the new customers. For this we will collect customer gender, customer location, location type, and their preferred cuisines. And based on the similarities score and vendor avg. rating we will recommend the top preferred vendors to the customer.</p><p>We will use cosine similarity to find similarities between two customers. We need to find the best model to predict the existing customers’ ratings.</p><p>For deployment we will create a form to collect new user’s data and preferences and will use it to find the similarities.</p><p><strong>Dataset schema —</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lyu28b_w-18DXK_PfmAZLQ.png" /></figure><h3>3. Loss Metrics</h3><p>As loss metrics we have used MAPE and RMSE.</p><p><strong>MAPE</strong> — MAPE or mean absolute percentage error is a measure of prediction accuracy of a forecasting method in <a href="https://en.wikipedia.org/wiki/Statistics">statistics</a>. It usually expresses the accuracy as a ratio defined by the formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*dEPcSGvSHzNmjdN3JQVabQ.png" /></figure><p>where <em>At</em> is the actual value and <em>Ft</em> is the forecast value. Their difference is divided by the actual value <em>At</em>. The absolute value of this ratio is summed for every forecasted point in time and divided by the number of fitted points <em>n</em>.</p><p>As the name suggests it shows the percentage error of our model. it ranges from 0 to infinity. 0 being the best.</p><p><strong>RMSE-</strong>RMSE or Root mean square error is a frequently used measure of the differences between values (sample or population values) predicted by a model or an <a href="https://en.wikipedia.org/wiki/Estimator">estimator</a> and the values observed.</p><p>RMSE is always non-negative, and a value of 0 (almost never achieved in practice) would indicate a perfect fit to the data. In general, a lower RMSD is better than a higher one. However, comparisons across different types of data would be invalid because the measure is dependent on the scale of the numbers used.</p><p>Formula for RMSE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*TstZFIAvWyryHUsZnNiVdw.png" /></figure><h3>4. EDA</h3><p>After doing the analysis below are the findings.</p><h3>4.1 Customer location vs vendor location</h3><p>Below is the plot of User locations vs customer location</p><p>So as we can see some of the users live nearby to the vendors, but most of them live very far. And even though we have a delivery radius limit for the vendors, we can see that very far customers also have placed orders from these vendors.</p><p>We can’t trust location features to predict vendors.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99fbc98918785c04b52bc4877937d30d/href">https://medium.com/media/99fbc98918785c04b52bc4877937d30d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KjgmXndGnAvSP7lE9VnNdQ.png" /></figure><h3>4.2 Account creation and update date</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KnCmcxjlX4rOD6akD0_A5g.png" /></figure><p>We can see a upward trend in the account creation. This implies the business is going well. After analysis we found out that if we divide the customers before and after ‘2019–09–01’, we get a 50% split of old vs. new customer.</p><p>We can see most of the customers have recently updated their profiles. Which signifies a healthy ratio of active customers. After investigation we found out that more than 50% of customers have updated their profiles after’2019–11–01’.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ec47ca039c9acad4e79ffb86407bae0/href">https://medium.com/media/9ec47ca039c9acad4e79ffb86407bae0/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*UCBgZU0Q1pNQyrzxEgzRvg.png" /></figure><h3>4.3 Gender</h3><p>Almost 60% of the customers are male. So we need to take some actions to attract people of other genders to our app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a6a94d4561ae85ba906316d006f9e0d/href">https://medium.com/media/8a6a94d4561ae85ba906316d006f9e0d/href</a></iframe><h3>4.4 Delivery charge</h3><p>We can see that 59% of the vendors take delivery charges from their customers. But when it comes to order, people prefer free deliveries. So we need to come up with some premium plan for which we can provide free deliveries from all the vendors.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/307b2d9e807c72aa63b136a8910d2376/href">https://medium.com/media/307b2d9e807c72aa63b136a8910d2376/href</a></iframe><h3>4.5 Food preparation time</h3><p>People prefer those vendors who deliver their foods quickly. We have to come up with some analysis where we can suggest vendors to prepare cuisines at a given day at a given time. So that the preparation time can be further reduced.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ada8b25c1bf1bbc29562c38102b58bf/href">https://medium.com/media/1ada8b25c1bf1bbc29562c38102b58bf/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ypOcz7d6zBFmoZmAAoetag.png" /></figure><h3>4.6 Vendor ratings</h3><p>This is obvious that people prefer ordering from High rated vendors.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dfc544430e6f8a7c17ae7a2081fcc8b/href">https://medium.com/media/1dfc544430e6f8a7c17ae7a2081fcc8b/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*abdDCrMDS70jY95ZqyXVmw.png" /></figure><h3>4.7 Vendor categories</h3><p>The most common Cuisine people like to order is Sweets, followed by burgers and sandwiches.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3722e421f44750b8b61fa62bdedfbfd5/href">https://medium.com/media/3722e421f44750b8b61fa62bdedfbfd5/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*iarSwdeMMm7CpG52nSUg0Q.png" /></figure><h3>5. Models</h3><p>We have tried various models to predict the ratings for given customers. Below are the detailed models.</p><h3>5.1 Matrix Factorization with explicit feedback</h3><p>In this model we are trying to predict the ratings using given ratings by calculating user bias,vendor bias.</p><p>In this model we are solving below loss problem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5Ex5s_NsUU6VGTrJZV5r4Q.png" /></figure><p>Where v = vendor matrix (calculated by SVD of ratings matric)</p><p>u = user matrix (calculated by SVD of ratings matric)</p><p>b = user bias</p><p>c = vendor bias</p><p>µ = Global avg. rating</p><p>y = actual rating</p><p>by minimizing the loss we will obtain b and c. Now we will calculate the predicted rating using</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*kk158OPycyIEWtdJ8FKyGQ.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/194e4c22e07b907f9326ea9bb01a76f7/href">https://medium.com/media/194e4c22e07b907f9326ea9bb01a76f7/href</a></iframe><h3>5.2 Matrix Factorization with explicit + implicit feedback</h3><p>Here we are using the above equation, but also considering the feedback from movie how popular is the vendor. We are considering how many users have ordered from that vendor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*l6YBz2HDJhGCjaoJPwNsgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*WvE7Yw3VJqMlTWpsEpUgtg.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7de15af40a2872a32590531104971629/href">https://medium.com/media/7de15af40a2872a32590531104971629/href</a></iframe><h3>5.3 XGBOOST</h3><p>Here we are creating 8 features to predict the ratings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*3jTWPkfPTr57bfNPypzEbQ.png" /></figure><p>We will use these 8 features to model XGBoost model and predict for other users.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6abdfdde5ccf2726e92043871e4c14bc/href">https://medium.com/media/6abdfdde5ccf2726e92043871e4c14bc/href</a></iframe><h3>5.4 Deep Learning model</h3><p>We have tried Deep learning model to predict the Vendor ratings. For this we have used regression model and as loss function we have selected RMSE. Architecture of the DL model is as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*19qns9h6sxVRSXdaqs-ZZA.png" /></figure><p>We have run the training for 50 epochs with a batch size of 200.</p><p>Result in tensorboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*bc8y8O2sOwXmWpICoAPwCA.png" /></figure><h3>5.5 Surprise Library</h3><p>Surprise is a Python scikit for building and analyzing recommender systems that deal with explicit rating data. It takes (user,item,rating) as input and for prediction we can give (user,item) as input to the model. From surprise library we have used various models in our experiment</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd8c826e834a431d033c5328e36df918/href">https://medium.com/media/dd8c826e834a431d033c5328e36df918/href</a></iframe><h3>5.5.1 Baseline Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*AwIBuyulxZ1FBdfkZ1eqzw.png" /></figure><h3>5.5.2 KNN Baseline Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*97yl4TImS6tvGW4sfAJ8aA.png" /></figure><h3>5.5.3 Surprise SVD</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3HTaHqOa0dHx_FwkJ8JeqA.png" /></figure><h3>5.5.5 Surprise SVDPP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*aHqovf2IusUvcGbkbzeRzg.png" /></figure><h3>6. Model Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*Wr_A4YxlnyrooRqhSlRfjQ.png" /></figure><p>XGBoost is working best for training data but Surprise SVD works best in Test data. So, we have chosen Surprise SVD as our final model.</p><h3>6. Future Work</h3><p>If we want to build a live project from this, we can use the vendor open close time to recommend appropriate vendors.</p><p>We can also collect the correct locations of vendors and users to recommend vendors at their delivery radius.</p><p>We will collect all the day’s order data and during the maintenance time we will train the model with all the data and recalculate the preferred vendors.</p><p>We can build a recommender system for the vendors to suggest cuisines to reduce the preparation timing, if we can capture the order details time wise</p><p>We can use hierarchical neural network to build a more powerful recommender system using session data of users. Reference — <a href="https://arxiv.org/pdf/1706.04148.pdf">https://arxiv.org/pdf/1706.04148.pdf</a>.</p><h3>7. Github &amp; Linkedin links</h3><p>Github link — <a href="https://github.com/ankushsaha96/Hotel-recommendation-challenge-Kaggle">https://github.com/ankushsaha96/Hotel-recommendation-challenge-Kaggle</a></p><p>Linkedin — <a href="https://www.linkedin.com/in/ankushsahasiliguri/">https://www.linkedin.com/in/ankushsahasiliguri/</a>\</p><h3>8. Video Demo of the App</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F0_ILnkgHrFI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0_ILnkgHrFI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F0_ILnkgHrFI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6053d41e117feca234f3532060379778/href">https://medium.com/media/6053d41e117feca234f3532060379778/href</a></iframe><h3>9. Reference</h3><p>1. Existing Solution — <a href="https://www.kaggle.com/code/fff9512/recomm-system-for-deli-app-cf-mf-tf-idf-d2v#%E2%85%A3.-1.-Collaborative-Filtering(CF)">https://www.kaggle.com/code/fff9512/recomm-system-for-deli-app-cf-mf-tf-idf-d2v#%E2%85%A3.-1.-Collaborative-Filtering(CF)</a></p><p>2. Surprise library — <a href="https://surpriselib.com/">https://surpriselib.com/</a></p><p>3. Wikipedia — <a href="https://en.wikipedia.org/wiki/Root-mean-square_deviation">https://en.wikipedia.org/wiki/Root-mean-square_deviation</a>, <a href="https://en.wikipedia.org/wiki/Mean_absolute_percentage_error">https://en.wikipedia.org/wiki/Mean_absolute_percentage_error</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dedfaf4ad5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>