<?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 JaydenKim on Medium]]></title>
        <description><![CDATA[Stories by JaydenKim on Medium]]></description>
        <link>https://medium.com/@joowan88_87570?source=rss-41801729fc1c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SkvFSINgPc4dfNES9eR4WQ.png</url>
            <title>Stories by JaydenKim on Medium</title>
            <link>https://medium.com/@joowan88_87570?source=rss-41801729fc1c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:34:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joowan88_87570/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[Naive Bayes Classifier]]></title>
            <link>https://medium.com/@joowan88_87570/naive-bayes-classifier-d75c75e22b38?source=rss-41801729fc1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d75c75e22b38</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[naive-bayes-classifier]]></category>
            <dc:creator><![CDATA[JaydenKim]]></dc:creator>
            <pubDate>Thu, 28 May 2020 20:00:02 GMT</pubDate>
            <atom:updated>2020-05-28T20:02:56.406Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is Naive Bayes Classifier?</strong></h3><p>Naive Bayes classifier can be defined as supervised classification algorithm which is based on <strong>Bayes theorem</strong> with an assumption of <strong>independence among features</strong>.</p><p>Lets look at the mathematical equation of Bayes Theorem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/0*v6pu3D-cS0kpxgaV.png" /></figure><p><strong>P(A|B)</strong> is the probability of hypothesis A given the data B.</p><p><strong>P(B|A)</strong> is the probability of data B given that the hypothesis A was true.</p><p><strong>P(A)</strong> is the probability of hypothesis A being true (regardless of the data).</p><p><strong>P(B)</strong> is the probability of the data (regardless of the hypothesis).</p><p>Which means the predictors/features are independent that is presence of one particular feature does not affect the other.</p><h3>Types of Naive Bayes Classifier:</h3><ol><li>Multinomial Naive Bayes.</li><li>Bernoulli Naive Bayes.</li><li>Gaussian Naive Bayes.</li></ol><p>There are three types of Naive Bayes model under the scikit-learn library and we will talk about Multinomial Naive Bayes. This is the most common classifier mostly used in text classification where the features are related to word counts or frequencies within the documents to be classified.</p><h3>Example of Naive Bayes Algorithm</h3><ol><li>It mostly used is <strong>Spam Filtering</strong> in Emails.</li><li><strong>Sentiment Analysis</strong>, <strong>Recommender Systems</strong> and etc.</li></ol><p>Let’s do some example with reddit.</p><pre>## Import basic libraries for model with Naive Bayes<strong><br></strong>## Use reddit API to call reddit post</pre><pre><strong>import</strong> <strong>pandas</strong> <strong>as</strong> <strong>pd</strong> <br><strong>import</strong> <strong>numpy</strong> <strong>as</strong> <strong>np</strong> <br><strong>import</strong> <strong>requests</strong> <br><strong>import</strong> <strong>math</strong></pre><p>Here, import basic libraries and import reddit post by using API(The PRAW method on this link — &gt;&gt; <a href="https://praw.readthedocs.io/en/latest/">https://praw.readthedocs.io/en/latest/</a> or you can use other method as well)</p><p>We will build simple sub-reddit suggestor by title of the reddit post. In order to use reddit API data for machine learning, we need to be able to convert the content of each string into a vector of numbers. We will use the TF-IDF vectorizer and create a pipeline:</p><pre>## Import Naive Bayes libraries</pre><pre><strong>from</strong> <strong>sklearn.model_selection</strong> <strong>import</strong> train_test_split, cross_val_score<br><strong>from</strong> <strong>sklearn.feature_extraction.text</strong> <strong>import</strong> TfidfVectorizer<br><strong>from</strong> <strong>sklearn.naive_bayes</strong> <strong>import</strong> MultinomialNB<br><strong>from</strong> <strong>sklearn.pipeline</strong> <strong>import</strong> make_pipeline</pre><pre># Let&#39;s call in the data set from reddit</pre><pre>columns = [&#39;created_utc&#39;, &#39;is_video&#39;, &#39;subreddit&#39;, &#39;title&#39;, &#39;total_awards_received&#39;, &#39;ups&#39;]<br>df = pd.DataFrame(get_reddit_data(PAGE_COUNT), columns=columns)<br>df = df.sample(frac=1, random_state=RANDOM_STATE)<br>df.head()</pre><p>Here, this is how data set look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/0*hy3sWUyjtwbQkYJE" /></figure><p>In this step, we have to set <strong>title</strong> and <strong>subreddit</strong> as target for train test split before make pipeline to train them:</p><pre>X = df[&#39;title&#39;].values<br>y = df[&#39;subreddit&#39;].values<br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=TEST_SIZE, random_state=0)</pre><p>Finally, we can make and apply the model to the training data, and predict labels for the test data:</p><pre>model = make_pipeline(TfidfVectorizer(), MultinomialNB()) model.fit(X_train, y_train)<br>y_predict = model.predict(X_test)</pre><p>Yayyy!!! we have predicted the labels for the test data. Now we have very cool tools to determine using the predict method of this pipeline. Here&#39;s a simple function that will return the prediction for a single string:</p><pre><strong>def</strong> reddit(inputs):<br>    model<br>    <strong>return</strong> model.predict([inputs])[0]</pre><p>Let’s try our prediction:</p><pre>reddit(&#39;You shall not pass here&#39;)</pre><pre>&#39;gaming&#39;</pre><p>Things go my way!! This is just simple example of Naive Bayes algorithm</p><h3><strong>Conclusion</strong></h3><p>In this post, we talked about basic concepts of Naive Bayes Algorithm and demonstrate the basic example. Naive Bayes is mostly used in text classification. It is easy to implement and fast to execute. However, the major disadvantage is, it requires the features must be independent which is not true in real life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d75c75e22b38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of house prices(which factors affect the most?)]]></title>
            <link>https://medium.com/@joowan88_87570/analysis-of-house-prices-which-factors-affect-the-most-88b4a1ac0dde?source=rss-41801729fc1c------2</link>
            <guid isPermaLink="false">https://medium.com/p/88b4a1ac0dde</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[JaydenKim]]></dc:creator>
            <pubDate>Fri, 02 Aug 2019 20:25:48 GMT</pubDate>
            <atom:updated>2020-05-28T21:49:06.422Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*cOm8WgPcCWlMIWQF.jpg" /></figure><p>Are you planning to sell your house and you want to know right price or get better price for it? You may want to take couple minutes to read this before sell your house.</p><p>House price can differ substantially from your initial evaluations. Make accurate prediction on house price is very challenging.</p><p>If you know your house value accurately, the house selling process will be much faster and easier. Also it secures your assets.</p><p>So, what are the factors influence the most on house price?? let’s take a look at real world factors</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/0*t4YMkULM7dodB1pE.png" /><figcaption>source: <a href="https://www.inman.com/2017/08/07/6-factors-that-influence-a-homes-value/">https://www.inman.com/2017/08/07/6-factors-that-influence-a-homes-value/</a></figcaption></figure><p>It looks like previous sale price, the market and age and conditions are three major factors influence on house price. so, let’s keep in mind.</p><p>Let’s start with <a href="https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data#">House Price</a> data set that I’m going to use for this analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y911F4gHawxwd-I2rcuSjg.png" /></figure><p>It looks there are 81 columns and we need to figure out which columns will likely affect the house price. So, let’s take a look:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*2GvnSvxHz0L58LPjCdhsQg.png" /></figure><p>Waaaa!!! It is very long list. Based on the index, it seems there’s a lot of factors can affect house price. So, let’s start with histogram of this data set and see if we can get better idea.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5L4xiJE6qRg90G-sCE9aw.png" /></figure><p>Yes, it looks much better now and we made some educational guess to figure out which factors possibly affects the house price. So, we look though the data set and found couple possible factors(YearBuilt, YearRemodAdd, GrLivArea and OverallQual)</p><p>Let’s figure out if these factors are really affecting the house price. In order to see the relationship, we did some data merging and drop the id column and reset the index to visualize and see if they are correlated each others</p><p>Starting up with Sale price vs YearBuilt with scatter plot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*EwU_cdnSmWbFWcq6U6EtiA.png" /></figure><p>Hm…..It seems like later the yearbuilt price is higher than early yearbuilt but it is kind of hard to see what is going on there with scatter plot. So, we need to break down year into each year base to make better visualization that boxplot would be better choice here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qJ5GRgFntI47Idst-D5Jqg.png" /></figure><p>Let’s take a look at sale price vs YearRemodAdd here and we just learn scatter plot is not a good choice for this one so, let’s just use same boxplot as above</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NRMmEZ_rOGmgIucpQBau4Q.png" /></figure><p>Sale price vs OverallQual (we used boxplot again because scatter plot was hard to visualized)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*asEtVoGoOEE9XeQ5L1NXBA.png" /></figure><p>It looks good so far! Let’s take a look at other factors!!</p><p>Sale price vs GrLivArea</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*N2x62PvD6XCEFUIatwD47A.png" /></figure><p>Sale price vs TotalBsmtSF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*dosp5o36mk-nqc_ysd3C8g.png" /></figure><p>Everything looks good.</p><p>Finally!! we finished our visualization. It seems there’s another factors affect house price. but, in this analysis we will just stick to the our assumption.</p><p>Let’s summarize our finding!!!</p><p>According to our visualization, the newer house tend to have higher sale price especially after year 1985. Also, the newer the house remodel tend to have higher sale price as well. This does make sense in some quality because the newer the house likely require less maintenance which means next buyer doesn’t have to pay extra to fix the house.</p><p>Let’s move onto next. Yes, without doubt higher the quality tend to have higher sale price. By looking at the box-plot, there is stronger relationship with sale price and it jumps big on sale price when OverallQual socre increases. This suggest that this is possibly plays bigger role on sale price compare to year built and remodeled.</p><p>Lastly, let’s take a look at scatter plot of GrLivArea and TotalBsmtSF. Both of the scatter plot seems to be correlate with sale price and it seems have linear relationship as well but this is not accurate because we didn’t analyze further that the plot is not normalized.</p><p>It seems our assumption was right based on the real world factors but, we want to see if there is any other more factors so let’s try heatmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*UmbVsAGhoCwj0SdGoSrstw.png" /></figure><p>According to our heatmap, these are the list of variables most correlated with SalePrice</p><p>Surprisingly there is another factors exist which is GarageCars and GarageArea. It seems these variable have stronger correlation then TotalBsmtSF, Yearbuilt, YearRemodADD. However, GarageCars and GarageArea are inseparable that it is not going to able to distinguish them. FullBath was just totally unexpected variable but it has stronger correlation with sale price then YearBuilt and YearRemodAdd.</p><h3><strong>Conclusion</strong></h3><p>As our assumption at the beginning, OverallQual, GrLivArea, TotalBsmtSF seems to have strong correlation with sale price. However, Yearbuilt and YearRemodAdd seems have slightly correlated with sale price that there’s other factors plays stronger roles on sale price. We should do a little bit of further data analysis to get better result but I’ll leave this to you guys think about.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88b4a1ac0dde" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>