<?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 Paul Jr on Medium]]></title>
        <description><![CDATA[Stories by Paul Jr on Medium]]></description>
        <link>https://medium.com/@akintpfavour?source=rss-89e16eb940ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JXtlcqerWSjW_resF37N2A.png</url>
            <title>Stories by Paul Jr on Medium</title>
            <link>https://medium.com/@akintpfavour?source=rss-89e16eb940ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:22:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akintpfavour/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 know you’re a good cook, I know you want to showcase your skills to the world in a grand scale]]></title>
            <link>https://medium.com/@akintpfavour/i-know-youre-a-good-cook-i-know-you-want-to-showcase-your-skills-to-the-world-in-a-grand-scale-5a3f82d99091?source=rss-89e16eb940ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a3f82d99091</guid>
            <category><![CDATA[project-based-learning]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Paul Jr]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 20:42:42 GMT</pubDate>
            <atom:updated>2025-04-10T20:48:55.936Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*S7IV51hdBzWKXx53dU24Xg.jpeg" /></figure><p>I know you’re a good cook, I know you want to showcase your skills to the world in a grand scale</p><p>But there’s an issue you need to actually put into consideration.</p><p>You being a good cook and having the facilities to serve the public is not enough.</p><p>Yeah I said it!!</p><p>You also need to consider certain factors to ensure your Restaurant is among the high-fliers.</p><p>Having Top notch cooking skills and managerial skills won’t be enough to be among the high fliers .</p><p>Do you want to be among the high fliers?</p><p>And how do you actually get there?</p><p>You get there by studying what works for the Highest rated Restaurant, you dig deep to every necessary detail important in making this a possibility.</p><p>Based on a dataset made available I would explore what could actually be a factor in determining the rating of a restaurant.</p><p><strong>Project Overview</strong></p><h4>The main aim of this project is to analyse restaurant data , undergo proper Data understanding, Data Cleaning, Data Visualization, Data analysis and finally to create a prediction model</h4><p><strong>Data Understanding</strong></p><p>First thing first</p><p>These are the libraries I used below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*z0vr5RTCdxlmPHCOtTUqnQ.jpeg" /></figure><p><strong>Data Loading</strong></p><p>Dataset = https://raw.githubusercontent.com/Oyeniran20/axia_class_cohort_7/refs/heads/main/Dataset%20.csv&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CyMQFZC-FxU-DzYkjpha7w.jpeg" /></figure><p><strong>Data Info</strong></p><p>This is an overview of the Columns present in the data set</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*6mpuuSbkdyvPtcvrG72pnQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*Qgzpa2UsI7z24KaLYmmAfA.jpeg" /></figure><p>Descriptive Statistics of the Numerical columns present in the dataset</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*U0lcIeLzqwOlhByZEwIJzA.jpeg" /></figure><p><strong>Checking for Null values in Dataset</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*GFUThLNKjnTu_fvYLWj5yA.jpeg" /></figure><p>From the above image. <strong>Cuisines </strong>has 9 missing values and we would need to solve that to ensure it doesn’t affect our analysis</p><p>How would you suggest we carry out <strong>Data Cleaning </strong>?</p><p>These are the value counts below and you should know that Cuisines is a categorical column so filling nan values with median won’t be possible</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*FxmFXXpekN8JbyjxXJKCeg.jpeg" /></figure><p>I discovered <strong>North Indian </strong>was the most occurring Cuisine (even though North Indian is scattered around and would needed to be counted uniquely) and based on the rules for dealing with nan values which allows missing values to be filled with the Mode</p><p>I filled the 9 missing values with <strong>North Indian</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*MBUvdD2ejJvG2iLEhzQd1Q.jpeg" /></figure><p><strong>Target Variable</strong></p><p>In this prediction modelling our target variable is <strong>Aggregate rating</strong></p><p>To properly understand Aggregate rating data , I had to check its visualization.</p><p>As there are no nan values in Aggregate rating. The next thing is to check its distribution to know if it has skewness</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*d11jeD4GruFOeme1FYtxzg.jpeg" /></figure><p>The above distribution is left skewed.</p><p>After inspecting this distribution it appears it has two forms of distribution</p><ul><li>A left skewed distribution</li><li>Normal distribution</li></ul><p>It is left skewed between rating 0 to 1 and a Normal distribution from 1 to 5.</p><p>It appears the large count present in aggregate rating <strong>0</strong> is the reason for the left skewness</p><p>But then again, a question you should be asking is why there are so many Restaurants with an aggregate rating of 0? Is that even possible?</p><p>After checking through the Dataset I discovered that there’s a Column called <strong>Rating Text</strong></p><p>Depending on the aggregate rating number a restaurant has (between 0 to 5) there’s usually a rating text attached to it.</p><ul><li>An <strong>Aggregate rating</strong> of <strong>4.5</strong> to <strong>5</strong> displays <strong>Excellent</strong></li><li>An <strong>Aggregate rating</strong> of <strong>4.0</strong> to <strong>4.4</strong> displays <strong>Very Good</strong></li><li>An <strong>Aggregate rating</strong> of <strong>3.5</strong> to <strong>3.9</strong> displays <strong>Good</strong></li><li>An <strong>Aggregate rating</strong> of <strong>2.5</strong> to <strong>3.4</strong> displays <strong>Average</strong></li><li>An <strong>Aggregate rating</strong> of 1<strong>.0</strong> to <strong>2.4</strong> displays <strong>Poor</strong></li><li>An <strong>Aggregate rating</strong> of <strong>0.0</strong> displays <strong>Not rated</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*eVxeHseDDlg-EaixAukFAw.jpeg" /></figure><p>After getting rid of the <strong>“0’’ </strong>part of the aggregate rating because it displays “Not Rated” on the Rating text column and for this analysis we’re dealing with Restaurants who were actually rated.</p><p>This is what the distribution looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*fglqljnJpxhq_qxBWHN-vg.jpeg" /></figure><p>After removing Restaurants with an Aggregate rating of 0 this is what the Distribution looks like.</p><p>To properly reduce skewness in Aggregate rating I performed Square root transformation and Log Transformation but Square root Transformation was what ensured a normal distribution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rulfb5uaOXpRDoHWH0AeVQ.jpeg" /></figure><p><strong>Predicting Variables</strong></p><p>In the course of this work there were wrong decisions I made on the road to picking what has the most impact and influence on our Target variable.</p><p>At the end of the day I used this as the Features</p><ul><li><strong>Cuisines</strong></li><li><strong>Average Cost for Two</strong></li><li><strong>Has Table Booking</strong></li><li><strong>Votes</strong></li><li><strong>Price Range</strong></li></ul><h3>Cuisines</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*qQO-EMjLgV5srF-ejwvOCQ.jpeg" /></figure><p>The above is a visualization of Cuisines by Counts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HN_sDnzE8ER0sTgxxJZARg.jpeg" /></figure><p>Based on the number of votes, <strong>North Indian </strong>was still the highest meaning it’s the most popular Cuisine amongst restaurants .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*Hfclutg4oUxKFevKyTYMAA.jpeg" /></figure><p>The above is the average aggregate rating for each Cuisines meaning the presence of <strong>American Cuisine</strong> for example would mean that particular restaurant could have a rating of at least 3.01 or higher</p><p><strong>Average Cost for Two</strong></p><p>I tried to understand the relationship between <strong>Average Cost for Two </strong>and <strong>Aggregate rating</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*4B3v72-KTwf-ZzITmyeN7g.jpeg" /></figure><p>These results shows that indeed <strong>Average Cost for Two</strong> has an effect on the <strong>aggregate rating</strong> of a restaurant</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*QKOfdB2eUHV8_SprtwqG1Q.jpeg" /></figure><p><strong>Votes</strong></p><p>I found something interesting when dealing with the Votes column.</p><p>I discovered that ratings with 0 had less than 4 or nobody at all voting for them at the Votes section meaning if a restaurant had little people that voted for them they are tagged <strong>Not rated</strong> and given an aggregate rating of <strong>0.0</strong>, even if 3 people rated them <strong>5.0</strong></p><p>Before a Restaurant can have an aggregate rating, atleast 4 people should have voted for it via putting up their specific rating</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*E-zuZpvxlZs8FsxdVm8S-A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*VhmvNxDDLvQvK2RiX493tw.jpeg" /></figure><p>As a result of this . I dropped Restaurants containing less than 4 voters to ensure for this analysis I deal with Restaurants with an actual rating</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*hImS4EUssdy0DpCT3oPE-A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*ePCamnjL4TPmSNZR7RcyMQ.jpeg" /></figure><p>As seen above the distribution of Votes is significantly right skewed and as a result would need to be transformed</p><p>And based on research, it is said that Log Transformation is useful for fixing distributions that are right skewed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*cVWKbrumkMkdyu2hmpM_8g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*fgfoe87kT10Fu9NI70M8Yg.jpeg" /></figure><p>After Log Transformation the distribution seems better off, though it’s slightly right skewed</p><p><strong>Price Range</strong></p><p>Initially I dropped Price range when working on the model due to the fact that it’s impact on the Aggregate rating of a restaurant was minimal based on it’s scatter plot visualization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*5453ZlVupNV-_cWVLBRN3A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*tG6WXmrjPw5TKTpTaCB6Mg.jpeg" /></figure><p>As seen from this visualization,</p><p>The high rating of a Restaurant or low rating has no significant or noticeable impact on its price</p><p>The determining factor of a Restaurant price is based on the Owner&#39;s choice and nothing to do with its rating</p><ul><li>Based on this insight, there is no specific price range that attracts a higher rating, as the Price Ranges of Restaurants are spread equally around Ratings of 0 to 4.9</li></ul><p>It was based on these insights I dropped this feature as a prediction variable but after multiple trials and poor training and test results I had to Include it because even though <strong>Price range </strong>doesn’t have a variation with Aggregate rating it has a Correlation and that is a key ingredient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*WM0fVxI4lzbndzVGMGRDwA.jpeg" /></figure><p><strong>Data Preparation and Splitting</strong></p><p>Since I am dealing with only variables that actually have a rating</p><p>I cleaned and removed any data with a rating of 0.0 from the numerical and categorical column I used in this Modelling</p><p>And that’s why you see “<strong>filtered_data</strong>” in the image below which indicates the part of the dataset void of an aggregate rating of 0.0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GL9bkddx97Q65zNjCxFkcg.jpeg" /></figure><p><strong>Encoding</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*7M4dERDh2GWrkkkm8rnppg.jpeg" /></figure><p>I <strong>label encoded</strong> these two above because they have only two unique values which are either (Yes or No).</p><p>Label encoding is best suited for binary features (categorical variables with two unique values)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*Lo5TnXFsr-TLKiDNtU0kwA.jpeg" /></figure><p><strong>Cuisines </strong>another part of our Categorical column had a unique value number count of 121</p><p>I used One hot encoding with Cuisines because it’s preferably used for categorical variables with more than two unique values, especially when the categorical data have no relationship between each other, because it prevents the model from assuming that one category is higher or lower than another.</p><p><strong>Cat_Col</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WvixLvUmjCwAFwxBWvBt2Q.jpeg" /></figure><p>To get our Train Categorical dataset and Test Categorical dataset</p><p>I first of, Combined our binary column i.e Label encoded categorical column and Onehot Columns together</p><p>Then I performed Training and transforming</p><p><strong>Scaler</strong></p><p>I used the cleaned and Transformed version of Average cost for two, Votes and price range features as our Numerical Columns</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*agZ5xVRdW75pyYYcA9tw3w.jpeg" /></figure><p><strong>MODEL</strong></p><p><strong>a) Linear Regression Model</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*MoB5zOnEDdd4PCGmbAcX3g.jpeg" /></figure><p>The Training and Test Scores of the Linear regression model below shows that the right predictors might not have been used or key ones are missing which I missed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*1Jo-eftpNXkCBUkydfDjUg.jpeg" /></figure><p>An R² value around 0.5 indicates that the model explains roughly 50% of the variance in the target variable. In many practical applications, this level of performance might be viewed as moderate. It implies that the linear relationship captured by the model is only partially explaining the variability in the outcome.</p><h3><strong>Possible Limitations</strong>:<br>The moderate R² could point to a number of underlying issues:</h3><p><strong>Model Misspecification</strong>: There might be nonlinear relationships or interactions between variables that a simple linear model fails to capture.</p><p><strong>Omitted Variables</strong>: Important predictors might be missing from the model.</p><p><strong>Noise in Data:</strong> A significant portion of the variability could be due to noise or unobserved factors.</p><p><strong>b) Decision Tree Model</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*j8SWATN4WzjArdkfrheC0w.jpeg" /></figure><p><strong>Decision Tree Model Performance</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VcQiiM1kHHmRzoKErUBLPA.jpeg" /></figure><p>The extremely high training score (<strong>0.98</strong>) versus the very low test score (<strong>0.144</strong>) is a classic sign of overfitting.</p><p>The tree has essentially memorized the training data, capturing even the noise and specific idiosyncrasies, but it does not generalize well to unseen data.</p><p>Let’s see what happens when I perform <strong>Hyperparameter tuning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2QAbcrLZsD5cVg2a1kpmg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*swALF3Hw2DgOZRG0FbIJvA.jpeg" /></figure><p>By adjusting the hyperparameters (for example, limiting tree depth, minimum samples per leaf, or other complexity controls), the decision tree is forced to build a simpler model.</p><p>This results in:</p><p>A drop in the training score (from 0.98 to 0.49), indicating that the model is no longer memorizing the training data.</p><p>A rise in the test score (from 0.144 to 0.50), showing that the model now generalizes similarly to the linear regression model.</p><p><strong>Bias-Variance Tradeoff:</strong><br>The tuned model reflects a shift from an extremely low bias but very high variance regime (overfitting) to a more balanced one.</p><p>The scores indicate that much of the previously captured “signal” was actually noise, and after tuning, both training and test performance settled around the same moderate level (~0.5 R²).</p><p><strong>C) Random Forest Model</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*pBSzTqoExG-3aYXosS0VVQ.jpeg" /></figure><p><strong>Random Forest Model Performance</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*yyUqerisxIsAUEV820Yysg.jpeg" /></figure><p>Random forests are generally robust against overfitting due to averaging across multiple trees,</p><p>The high training R² (0.911) versus a test R² (~0.495) suggests that even the ensemble might be capturing too much detail from the training set.</p><p>Based on the Model’s Performance it appears there might be certain things I missed</p><p>Below could be the possible problems with my model:</p><p><strong>Overall Problems and Insights</strong></p><p><strong>1. General Predictive Limitations</strong>:</p><p>All models, after tuning produce test R² scores around 0.5. This suggests that roughly half the variance in the outcome is still unexplained, indicating that the current set of features, model forms, or data quality might be limiting the predictive power. There may be nonlinear patterns or interactions that are not being fully exploited even by the more complex models.</p><p><strong>2. Overfitting in Complex Models:</strong></p><p>The initial decision tree’s drastic drop from a near-perfect training score to a very low test score underscores the risk of overfitting with high-complexity models.</p><p>The random forest, while more robust in theory, still shows signs of overfitting as indicated by the gap between training and test performance. This calls for further hyperparameter tuning (e.g., limiting tree depth, reducing the number of features considered at splits, or adjusting the number of estimators).</p><p><strong>3. Bias-Variance Tradeoff:</strong></p><p>The linear regression and tuned decision tree have nearly identical training and test scores, suggesting a good balance in the bias-variance tradeoff, but only moderate predictive power.</p><p>The discrepancy seen in the initial decision tree and the random forest highlights that more complex models require careful tuning to avoid high variance.</p><p><strong>Conclusion</strong></p><p>I would love it if you could suggest what I can do to improve My model performance y’all.</p><p>It seems my insights weren’t good enough.</p><p>Like I said earlier I tried as much as possible to use Predictors that ordinarily would have impact on a Restaurant’s rating but it seems I needed to add more predictors or there are predictors which are not meant to be added</p><p>of which is not clear to me right now.</p><p>This was my first Data science project guys and I’m happy regardless with my model’s performance , Although a lot of improvements need to be made.</p><p>I will appreciate your suggestions on what you think went wrong.</p><p>By the way, to you wanting to own a restaurant, this above analysis shows that being the top is no joke. It takes a lot of work and digging deep</p><p>But one thing I’m sure of is that the type of Cuisine a restaurant specialises in has an effect on its potential rating.</p><p>That will be all for now.</p><p>See you soon</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a3f82d99091" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>