<?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 Handan Degerli on Medium]]></title>
        <description><![CDATA[Stories by Handan Degerli on Medium]]></description>
        <link>https://medium.com/@dgrl.handan?source=rss-9c663a1841c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Handan Degerli on Medium</title>
            <link>https://medium.com/@dgrl.handan?source=rss-9c663a1841c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:36:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dgrl.handan/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[Power of Feature Engineering in Data Science]]></title>
            <link>https://medium.com/@dgrl.handan/power-of-feature-engineering-in-data-science-bdf2421b72a0?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdf2421b72a0</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 22:26:23 GMT</pubDate>
            <atom:updated>2024-06-27T22:26:23.954Z</atom:updated>
            <content:encoded><![CDATA[<p>Feature engineering is the process of selecting raw data, changing it and transforming it into features that can be used in machine learning and preparing the data for machine learning models. As you know, a “feature” is any measurable input that can be used in a predictive model.</p><p>The main target of this step is to improve our model performance and predictions and also to convert the data in a way that the model can understand. The topics to be examined in this context are as follows.</p><ul><li><strong><em>Outliers (Outliers Problems Solutions)</em></strong></li><li><strong><em>Missing Values</em></strong></li><li><strong><em>Encoding (Label Encoding, One-Hot Encoding, Rare Encoding)</em></strong></li><li><strong><em>Feature Scaling (Standard Scaler, Robust Scaler, Min Max Scaler)</em></strong></li></ul><p>Additionally, <strong><em>Log Transformation</em> </strong>will be mentioned.</p><h4><strong>Outliers</strong></h4><p>There are many ways to detect outliers. But first, we should know the outliers. What are outliers? Outliers are values ​​that fall outside the general trend of the data we analyze and they are generally problematic for machine learning models.</p><p>How can we detect outliers?</p><ol><li><strong>Outliers can be detected with sectoral knowledge.</strong></li><li><strong>Standard Deviation</strong></li></ol><p>The threshold value is created by adding the standard deviation of the same variable to the mean of the variable. Those below and above this value are outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*r7GvbVdJreKt0Io_NjBNzA.png" /><figcaption>Standart Deviation, Source: <a href="https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8">https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8</a></figcaption></figure><p>3. <strong>Z Score</strong></p><p>Z-score can also be used to detect outliers. To calculate the Z score, the mean is subtracted from the variable’s own value and divided by the standard deviation.</p><figure><img alt="Z Score , Kaynak: https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8" src="https://cdn-images-1.medium.com/max/699/1*71Y5iNGqZ7-_DKGdrp3DCQ.png" /><figcaption>Z Score , Kaynak: <a href="https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8">https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8</a></figcaption></figure><p>The Z-score method can be used in cases where observations have a normal or near-normal distribution.</p><ul><li>(68–95–99.7 Rule) Observations in a normally distributed variable:</li><li>68% are 1 standard deviation away from the mean,</li><li>95% are 2 standard deviations away from the mean,</li><li>99.7% is considered to be 3 standard deviations away.</li></ul><p>4. <strong>Boxplot Method (Interquartile Range- IQR)</strong></p><p>Quartiles are three values that split sorted data into four parts. As you see below, first we need to sort the data and split them into equal parts. The middle of the sorted data is the second quartile also known as the median, and the middle of the left and right parts of the median are the first and third quartiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*c_A5MOI98IXVMoGiTISX3w.png" /><figcaption>Boxplot , Kaynak: <a href="https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8">https://medium.com/datarunner/outlier-analiz-y%C3%B6ntemleri-8ec0e63551f8</a></figcaption></figure><p>Less than the minimum and greater than maximum values are outliers. We can remove these values from our data or we can change outliers with limits(trasholds) like minimum and maximum.</p><p><strong><em>5. Multivariate Outlier Analysis: Local Outlier Factor</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HxoQoyAFvG9wDQ6klIBOOQ.png" /><figcaption>In this case, it is possible to say that point A is an outlier.</figcaption></figure><p>“What does the LOF method do?” By scoring observations based on density in their location, it allows us to define outliers accordingly. “So what does this mean?” Local density of a point means the neighborhoods around the relevant point. If a point is significantly less dense than its neighbors, then that point is in a sparser region. So, it is interpreted that this may be an outlier.</p><h4>Outliers Problems Solutions</h4><ol><li><strong><em>Deleting Outliers</em></strong></li></ol><p>A common method to solve the outlier problem is to delete outliers from the data set. However, with this method, the corruption of the data set can be minimized and may lead to information loss, especially in small data sets. Only consider to delete outliers if:</p><p>- You’re certain the outlier is due to a data error.<br>- The dataset is large enough that removing a few points won’t significantly impact your analysis.<br>- The outlier is not representative of the population you’re studying.</p><p><strong><em>2. The Suppression Method</em></strong></p><p>In the suppression method, if the variable in the data set has an outlier, we replace it with the upper limit and lower limit values ​​we have determined. So you can preserve your data size and at the end of the day, it can be better for final model performance.On the other hand, suppression can affect the distribution of data, so it is better not to exaggerate.</p><p><strong><em>3. Outlier Handling</em></strong></p><p>Outlier handling is the technique of removing outliers from a data set. This method can be used at a variety of scales to produce a more accurate representation of data. This affects the performance of the model. Depending on the model, the effect may be large or minimal; for example, linear regression is particularly sensitive to outliers. This procedure must be completed before model training.</p><h4><strong>Missing Values</strong></h4><p>Missing values are the other common problem for machine learning models. They reduce the accuracy of the model and cause bias. We have many options to handle this problem. The first option is deleting the missing values but before that, we should check the ratio of missing values and randomness. The second option is filling in missing values with mean, median, or mode. Also, we can use some predictive models like KNNImputer. KNN Imputer can be more accurate than simple imputation methods like mean or median imputation, especially for datasets where relationships between features are important. Main disadvantage of this, it can be computationally expensive for large datasets. We should keep in mind that there is no absolute rule about dealing with missing values. It depends on your project, your data, etc.</p><h4>Encoding</h4><ol><li><strong>Label Encoding</strong></li></ol><p>Label encoding is a technique used in machine learning to convert categorical data into a numerical format that algorithms can process. It works by assigning a unique integer to each category in a categorical variable and following the alphabetic order. This method is particularly useful for ordinal data where there’s a natural order to the categories, such as education. In addition to this if the variable is binary like gender or smoker we can use label encoding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BrIfw9_BZSLacspCW9rzjg.png" /></figure><p>However, it’s important to note that label encoding can potentially introduce an artificial ordinal relationship between categories which is none exist. Nominal variables can be problematic for some algorithms. For this reason, it’s often used carefully and may be replaced by other encoding methods like one-hot encoding for nominal categorical data.</p><p><strong>2. One-Hot Encoding</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*6PsQmQ8U5b62qNkB8Yd8wQ.png" /></figure><p>One-hot encoding is a technique used to represent categorical data numerically, making it suitable for machine learning algorithms that require numerical input. In this method, each unique category in a feature becomes a new binary column. For the given category, the corresponding column is set to 1 (or “hot”), while all other columns are set to 0. This approach allows categorical variables to be represented without implying any ordinal relationship between categories. One-hot encoding is particularly useful when dealing with nominal data, where categories have no inherent order or hierarchy.</p><p><strong>3. Rare Encoding</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*bWXveW3Rae8J7Pq9QWtn8w.png" /></figure><p>It allows us to collect values ​​less than a certain frequency in a class. Thus, instead of evaluating values ​​with very low frequencies one by one, evaluating them in a single class allows us to speed up the operations.<strong> </strong>Helps in reducing model complexity, improving generalization, and handling unseen categories in test data.</p><h4>Scaling</h4><p>The first important point is that we need to declare that variables should be treated equally when sending variables to the methods to be used. That’s why we need standardization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*OXU0XQzfj9JCkIez50XMNg.png" /><figcaption>Scaling all variables so that they can be evaluated under the same conditions.</figcaption></figure><p>Our second item is to shorten the training times of algorithms that use gradient descent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*tQ6mXMStZmfXsQFFGo8FoQ.png" /><figcaption>Gradient Descent reduces the train time of algorithms.</figcaption></figure><p>We also have the third item. In distance-based methods, variables with large values ​​exhibit dominance, that is, overwhelming. Especially when some distance-based or similarity-dissimilarity-based methods such as KNN, K-means and PCA are used, the fact that the scales are different from each other causes errors in the distance-closeness, similarity-dissimilarity calculations. Here are the most common feature scaling methods:</p><ul><li><strong><em>Standard Scaler (Z-Score Normalization): </em></strong>When understanding the data distribution and reducing the effect of outliers is necessary. Values have a mean of 0 and a standard deviation of 1. Useful for understanding how many standard deviations a value is from the mean. Reduces the effect of outliers and ensures more robust data handling. Especially suitable for linear regression and logistic regression algorithms.</li><li><strong><em>Robust Scaler:</em></strong> When a robust scaling method is needed to handle outliers effectively. Scales data using the median and interquartile range (IQR). Ideal for datasets with outliers. Minimizes the influence of outliers and prevents them from skewing the data.</li><li><strong><em>Normalization(Min Max Scaler): </em></strong>When variables are measured in different units and need to be brought to the same range. Values always range between 0 and 1. It does not change the distribution of the data but can amplify the effect of outliers. Ensures features measured on different scales are within the same range. Therefore, handling outliers before normalization is recommended. Typically used in distance-based algorithms (e.g., k-NN, k-Means).</li></ul><h3>Log Transformation</h3><p>The logarithm transformation (or log transform) is one of the most commonly used mathematical transformations in feature engineering. It helps in handling skewed data and after transformation the distribution becomes closer to normal. In most cases, the order of magnitude of the data varies across the data range.</p><p>For example, the difference between 15 and 20 years of age is not equal to the difference between 65 and 70 years of age. In terms of years, yes, they are the same, but in all other respects, a 5-year difference in youth means a larger size difference. Such data comes from a multiplicative process, and log transformation normalizes magnitude differences like this.<br>It also reduces the impact of outliers due to normalization of size differences and the model becomes more robust.</p><p><strong>One important note: </strong>The data you apply the log transformation to must have only positive values, otherwise you’ll get an error. You can also add 1 to your data before converting. This ensures that the output of the transformation is positive.<br>This “log transformation” technique reduces the impact of outliers, resulting in a more robust data model. However, the technique only works with positive values.</p><blockquote><strong>Let’s examine how should be the feature engineering with the code examples in more detail!</strong></blockquote><p><a href="https://github.com/HandanDegerli/feature_engineering/blob/main/diabetes-prediction-w-feature-engineering.ipynb">feature_engineering/diabetes-prediction-w-feature-engineering.ipynb at main · HandanDegerli/feature_engineering</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdf2421b72a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recommendation Systems]]></title>
            <link>https://medium.com/@dgrl.handan/recommendation-systems-43a495f1afbe?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/43a495f1afbe</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 10:30:04 GMT</pubDate>
            <atom:updated>2024-06-20T10:30:04.061Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article is recommended for you…</em></p><p>Let’s start with a very famous story! Imagine you are a husband at home on a Friday, eager to watch a football match. Your wife has just arrived home with your one-year-old daughter, her hands full of shopping bags, but she realizes she forgot the most important thing: a pack of diapers… And your wife is tired, after all, she works, cleans the house, goes to the gym, takes care of your daughter, and all you have to do is go buy the diapers.</p><p>You get upset, but you go, after all, she’s your wife and if you don’t go buy the diapers, you’ll be sleeping on the couch.</p><p>You arrive at the supermarket and buy a pack of diapers, but you think you deserve a beer, after all, there’s a football match, and you’re at the market, why not?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*wpy_qqWGdRqXFdWtMgacxg.png" /><figcaption>miuul.com</figcaption></figure><p>It was discovered by Walmart that many people who bought diapers also took a pack of beer in the same purchase. And thus, the idea of placing the beer next to the diaper section was used, so sales would be easier. Anything that encourages a consumer to buy or even reminds them that they need to buy something is a marketing method. With BI tools, it is possible to detect interesting behaviors of consumers in certain companies, just like the beer and diapers case.</p><p>Why is it so important to know consumer’s behaviors?</p><p>To make more sales! Nowadays, recommendation systems play a huge role in this. Many e-commerce companies can offer products to their customers that they may like by using their recommendation systems. There are many examples such as Netflix’s movies, Spotify’s music, Facebook recommending friends, product recommendations of Amazon, etc. One of the reasons why these companies are so popular can be shown that their business structures are based on recommendation systems.</p><p>Recommender systems, in a general term, are algorithms that seek to propose relevant items to consumers (items being movies to watch, text to read, products to buy or anything else depending on industries).<br>In certain sectors, recommender systems are essential since they may produce a considerable amount of revenue or serve as a means to differentiate yourself from rivals.</p><p>In this post, we’ll look at several recommender system paradigms. We’ll explain how they function and what their theoretical foundations are for each of them.</p><p><strong>1.Simple Recommendation System</strong></p><p>General recommendations with business knowledge or simple techniques.<br>Simple recommendations such as top rated, trending, legends, world most watched etc. But this is not enough we need to make personalized our recommandations up to customer behaviors in order to make more sales.</p><p><strong>2. Association Rule Learning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*Y-YkaziB-G-CBuHA3aCeZg.png" /></figure><p>Basket analysis method(best in many scenarios) is suggesting based on people’s basket habits. Product recommendations are according to the association rules learned. Therefore, it is an algorithm that makes it efficient for you to sell together and make more sales. It may be correct to use the definition of “complementary product” here.<br>The Apriori algorithm is a rule-based machine learning technique used to find patterns in data.</p><p>We actually look at the relationship, its degree and direction. We observe how much products can affect each other.</p><p>Let’s say X is bread and Y is milk.</p><blockquote><strong><em>Support(X,Y) = Freq(X,Y)/N</em></strong><em> Probability of co-occurrence of X and Y. Probability of co-occurrence of bread and milk</em></blockquote><blockquote><strong><em>Confidence(X,Y) = Freq(X,Y) /Freq(X)</em></strong><em> probability of purchasing milk when bread is purchased</em></blockquote><blockquote><strong><em>Lift= Support (X,Y)/(Support(X) * Support(Y)</em></strong><em> When X is bought, the probability of buying Y increases by a factor of lift.</em></blockquote><p>Let’s give an example. I bought a cream. 20 times more likely to receive the serum. But on the other hand, I’d rather not buy a serum and buy a sunscreen. Well, the likelihood of purchasing sunscreen increased by 5 times. One increases 20 times, the other increases 5 times.<br>Maybe they don’t need it that much, actually. Lift metric is generally the best reflection of this. This is the algorithm here. Lift is one of the most used of the metrics. Sure we should check other metrics as well. Various actions and business decisions can be made accordingly. It can be suggested that “whoever bought that also bought this”.</p><blockquote><strong>Let’s explore my GitHub account building a Product Recommendation System using Association Rule Learning, complete with detailed code examples!</strong></blockquote><p><a href="https://github.com/HandanDegerli/recommendation_systems/blob/main/armut-arl-recommender-system.ipynb">recommendation_systems/armut-arl-recommender-system.ipynb at main · HandanDegerli/recommendation_systems</a></p><p><strong>3. Content Based Filtering</strong></p><p>We use distance-based methods based on product metadata. Here, we will make an analysis through the texts. We will vectorize the texts. So we will calculate their frequencies and distances when we transform them into mathematical expressions. We can mathematically determine whether they are similar or not. The content can be a description of a movie, actors, or director.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*ApXm1xnreMkYgsfs70enNg.png" /></figure><p><strong>Vector representations of texts</strong></p><ul><li>Count vector : <em>unique word used in movies(corpus-w</em>ords that do not make sense are removed, such as conjunctions<em>)</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*wHixzvhb1nH5-a-Kw8ljtw.png" /><figcaption>count vectorizer</figcaption></figure><ul><li>Tf-idf : <em>Tf-idf is a numerical method of expressing texts. The count reveals a high frequency bias in the vector. So in this method, normalized numerical representations.. The cases of terms both in documents and in the whole document are weighted. After expressing the texts numerically, we were trying to find the most similar explanation to this explanation of this movie by using similarity(Cosine Similarity) or distance and proximity(euclidean distance) measures.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*l9jn2COUrHSOZyDH5no_-Q.png" /><figcaption>calculate term frequency in the document</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*8usQrnH7ORYz-G1RWpJqhw.png" /><figcaption>calculate inverse document frequency(frequency in corpus)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*oKahE27G2SCxygex8fVS1g.png" /><figcaption>calculate tf*idf</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*Tvq1ztqRgfYgMZnjX8ulBA.png" /><figcaption>normalized: similarities changed because of zeros impact</figcaption></figure><p><strong>4. Collaborative Filtering</strong></p><p>Methods that reflect the common opinions of the community on the basis of user or product. <strong>Memory-based</strong> methods also referred to as neighborhood-based collaborative filtering algorithms, where ratings of user-item combinations are predicted based on their neighborhoods. These neighborhoods can be further defined as<em> </em><strong><em>User-Based</em></strong>, and <strong><em>Item Based</em>.</strong></p><p><strong>Item Based Collaborative Filtering:</strong></p><p>Item-based collaborative filtering is a recommendation system that uses item similarity and user ratings to provide recommendations.</p><p>Let’s assume that the user liked a movie on netflix. The films with the closest rates to this film are recommended to the user.<br>When the interest data structure is formed, if the columns represent movies, the correlation is checked and the movie with the highest correlation is recommended.</p><p><strong>User Based Collaborative Filtering:</strong></p><p>Suggestions based on user similarities. Suppose there is a group of friends. Let this group of friends mostly like the same movies. When someone from this group wants to watch a movie, they can like it if they watch the movie that another friend from the group has watched and liked before. This recommendation made to this person is user based. Its efficiency may decrease in large data sets therefore, scaling solutions must be developed.</p><p>In other words, with user based, we take aside users who exhibit similar behavior. In item based, we put aside the rated movies and products that have similar liking habits.</p><p><strong>Model Based (Matrix Factorization):</strong></p><p>In <strong>latent-based</strong> methods, ML techniques are used to learn model parameters within the context of a given optimization framework. <br>Yes, we actually find various weights of the latent features here. To the rated movies that exist based on existing data. Then, based on these, we actually make predictions for other movies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*n7pH91qq-4boWyLKsjhg9w.png" /></figure><p>The process involves using Gradient Descent to iteratively optimize the weights of latent factors in a rating matrix to minimize the error between actual and predicted values. Initially, random weights are used, and over successive iterations, these weights are optimized to better approximate the true ratings. While minimizing the error, at the same time the fall speed decreases, it becomes more sensitive. The goal is to reduce the prediction error, with the descent becomes slower as we approach convergence. Once the model achieves minimal error, these optimized weights are used to fill in missing values and make recommendations. Gradient descent iteratively updates parameters in the direction of the steepest descent to find the function’s minimum value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*YNxnopkfTYPwNCNZ2ZAkGQ.png" /></figure><p>As you can understand Gradient Descent is an optimization method used for function minimization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*5Qn3lOcJjyZC__mvvOOlJA.png" /></figure><p>It finds the parameters that will give the minimum value of the relevant function by iteratively updating the parameter values ​​in the ‘steepest descent’ direction, defined as the negative of the gradient.</p><p><strong>Hybrid Recommender System:</strong></p><p>Hybrid recommender systems integrate two or more recommendation techniques in a variety of ways to take advantage of their synergistic benefits. I recommend using a combination of (user-based and item-based) in a hybrid way. This is because the combination of these two gives us what we want in a better way.</p><blockquote><strong>Let’s visit my Github account in order to know how should be the hybrid recommendation system with the code example in more detail!</strong></blockquote><p><a href="https://github.com/HandanDegerli/recommendation_systems/blob/main/hybrid-recommender-system.ipynb">recommendation_systems/hybrid-recommender-system.ipynb at main · HandanDegerli/recommendation_systems</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43a495f1afbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Measurement Problems and A/B Testing]]></title>
            <link>https://medium.com/@dgrl.handan/measurement-problems-and-a-b-testing-872403da3066?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/872403da3066</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Wed, 05 Jun 2024 10:44:24 GMT</pubDate>
            <atom:updated>2024-06-05T10:44:24.345Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What makes you buy a product?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*iuod3LHWYPO-EtGROZEO5A.png" /></figure><p>In the quick-moving world of online shopping, picking the right product means sorting through tons of choices. There are many products. Let’s say we are looking for a mouse. The selection process for the user begins. After that, the decision-making process begins. There are certain factors. The most important and most valid of these factors in recent years is the concept of social factor. We tend to go for things that people actually touch and interpret. That’s why we look at YouTube and examine the recommendations. <strong>Social proof</strong> is one of the top reasons a user buys. The user review score, that is, the wing of the community, is very important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*RmOWfbKayFk63qddUMEZQw.png" /></figure><p><strong>So why is this so important?</strong></p><p>Because <strong>the Wisdom of Crowds</strong>, we can think that if everybody likes it is good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*eXazCyISG2i7gJ3oiC28iQ.png" /></figure><p><strong>One product has 7 evaluations and 5 rating score, the other one has 256 evaluations and 4.5 rating score, which one would you choose?</strong></p><p>I can answer instead of you: you will choose the one on the right side.</p><p>Because of the Social Proof!</p><p>Because you believe in that crowds have the wisdom!</p><p>I leave these aside.</p><p><strong>What are the perspectives of the customers and the marketplaces or the sellers?</strong></p><p>Customer or User thinks that need to find the best product in terms of price/performance.</p><p>The Marketplace or Seller asks that how should be the deliver of the products to users/customers in the most accurate and objective way?</p><p><strong><em>What is the definition of the most accurate and objective way ? </em></strong>The marketplace can deal with getting the sponsorship, to put the special products on the top regardless of the ranking. These are possible, but they has to be careful because they need to present the social proof touch in the most accurate and objective way. This corresponds to listed below:</p><ul><li>Product ratings</li><li>Sorting products</li><li>Sorting reviews</li><li>Design of page process and interaction areas</li><li>Feature trials</li><li>Test of possible actions and reactions</li></ul><p>The last three of these items will be A/B tests.</p><p>Let’s look into the techniques used!</p><p><strong>Rating Products</strong></p><ul><li><strong><em>Average:</em></strong><em> </em>The average rating is calculated by summing up all the individual ratings and dividing by the total number of ratings.</li><li><strong><em>Time-Based Weighted Average: I</em></strong>t is possible to focus on more up-to-date ratings. It is weighted according to the timeliness of the ratings and the ratings of the users.</li></ul><pre>def time_based_weighted_average(dataframe, w1=28, w2=26, w3=24, w4=22):<br>    return dataframe.loc[df[&quot;days&quot;] &lt;= 30, &quot;Rating&quot;].mean() * w1 / 100 + \<br>           dataframe.loc[(dataframe[&quot;days&quot;] &gt; 30) &amp; (dataframe[&quot;days&quot;] &lt;= 90), &quot;Rating&quot;].mean() * w2 / 100 + \<br>           dataframe.loc[(dataframe[&quot;days&quot;] &gt; 90) &amp; (dataframe[&quot;days&quot;] &lt;= 180), &quot;Rating&quot;].mean() * w3 / 100 + \<br>           dataframe.loc[(dataframe[&quot;days&quot;] &gt; 180), &quot;Rating&quot;].mean() * w4 / 100</pre><ul><li><strong><em>User-Based Weighted Average:</em></strong><em> </em>It is weighted according to the percentage of progress of the users and the ratings of the users.</li></ul><pre>def user_based_weighted_average(dataframe, w1=22, w2=24, w3=26, w4=28):<br>    return dataframe.loc[dataframe[&quot;Progress&quot;] &lt;= 10, &quot;Rating&quot;].mean() * w1 / 100 + \<br>           dataframe.loc[(dataframe[&quot;Progress&quot;] &gt; 10) &amp; (dataframe[&quot;Progress&quot;] &lt;= 45), &quot;Rating&quot;].mean() * w2 / 100 + \<br>           dataframe.loc[(dataframe[&quot;Progress&quot;] &gt; 45) &amp; (dataframe[&quot;Progress&quot;] &lt;= 75), &quot;Rating&quot;].mean() * w3 / 100 + \<br>           dataframe.loc[(dataframe[&quot;Progress&quot;] &gt; 75), &quot;Rating&quot;].mean() * w4 / 100</pre><ul><li><strong><em>Weighted Rating: </em></strong>A rating that is a combination of <em>Time-Based Weighted Average</em> and <em>User-Based Weighted Average</em> is seen as the most reasonable rating.</li></ul><pre>def course_weighted_rating(dataframe, time_w=50, user_w=50):<br>    return time_based_weighted_average(dataframe) * time_w/100 + user_based_weighted_average(dataframe)*user_w/100</pre><blockquote>Note: Determining the appropriate numbers for weights involves a combination of data analysis, domain knowledge, and sometimes trial and error.</blockquote><p><strong>Sorting Products</strong></p><ul><li><strong><em>Sorting by Rating:</em></strong><em> </em>Products are sorted based on their average rating.</li><li><strong><em>Sorting by Comment Count or Purchase Count: </em></strong>Sorting is made according to the number of comments and purchases made on the product.</li><li><strong><em>Sorting by Rating, Comment or Purchase : </em></strong><em>P</em>roducts are sorted based on a combination of factors: average rating, number of comments, and number of purchases.</li></ul><pre>def weighted_sorting_score(df, w1=32, w2=26, w3=42):<br>    df[&quot;purchase_count_scaled&quot;] = MinMaxScaler(feature_range=(1, 5)). \<br>                              fit_transform(df[[&quot;purchase_count&quot;]]). \<br>  <br>    df[&quot;comment_count_scaled&quot;] = MinMaxScaler(feature_range=(1, 5)). \<br>                             fit_transform(df[[&quot;commment_count&quot;]]). \<br>    <br>    return df[&quot;comment_count_scaled&quot;] * w1 / 100 +<br>           df[&quot;purchase_count_scaled&quot;] * w2 / 100 +<br>           df[&quot;rating&quot;] * w3 / 100)</pre><ul><li><strong><em>Bayesian Average Rating Score(Sorting Products with 5 Star Rated):</em></strong><em> </em>The Bayesian Average Rating Score method adjusts the average rating by taking into account both the individual ratings and the number of ratings for a product. This method helps to mitigate the effects of products with very few ratings having disproportionately high or low averages.</li></ul><pre>def bayesian_average_rating(n, confidence=0.95):<br>    if sum(n) == 0:<br>        return 0<br>    K = len(n)<br>    z = st.norm.ppf(1 - (1 - confidence) / 2)<br>    N = sum(n)<br>    first_part = 0.0<br>    second_part = 0.0<br>    for k, n_k in enumerate(n):<br>        first_part += (k + 1) * (n[k] + 1) / (N + K)<br>        second_part += (k + 1) * (k + 1) * (n[k] + 1) / (N + K)<br>    score = first_part - z * math.sqrt((second_part - first_part * first_part) / (N + K + 1))<br>    return score</pre><ul><li><strong><em>Hybrid Sorting: </em></strong>A sorting that is a combination of <em>Bar Score </em>and <em>others (can be adjust). </em>It helps us move up those who have high bar scores but do not yet have social proof.</li></ul><pre>def hybrid_sorting_score(dataframe, bar_w=60, wss_w=40):<br>    bar_score = dataframe.apply(lambda x: bayesian_average_rating(x[[&quot;1_point&quot;,<br>                                                                     &quot;2_point&quot;,<br>                                                                     &quot;3_point&quot;,<br>                                                                     &quot;4_point&quot;,<br>                                                                     &quot;5_point&quot;]]), axis=1)</pre><p><strong>Sorting Reviews</strong></p><ul><li><strong><em>Up-Down Diff Score:</em></strong><em> </em>This method shows the general trend. It is calculated the difference of the number of the user who found it helpful and the number of the user who didn’t find it helpful.</li><li><strong><em>Score Average Rating:</em></strong><em> </em>Indicates user satisfaction. It is calculated the dividing the Number of the user who find it helpful to the Total number of interactions. In this method, a comment with a lot of positive interaction goes up. The disadvantage of this method can be explain with this instance:</li></ul><blockquote>Review 1: 2 up 0 down total 2<br>Review 2: 100 up 1 down total 101</blockquote><blockquote>According to this method, the result is : Review 2 is lower than Review 1.</blockquote><ul><li><strong><em>Wilson Lower Bound Score:</em></strong>It is used in all measurement probes resulting from binary interactions. In this method, statistic comes into play and social proof play a vital role. Here, as an example, let’s say that I find the value 0.80 according to the calculation in score average rating (let’s say 4 positive, 1 negative interaction), then we can find the confidence interval for this interpretation and assign the lower limit of the confidence interval as a score. For example, if our confidence interval is between 0.72 and 0.88 for this interpretation, then this interpretation will now score 0.72. This method ensures that the lower limit is lower, especially for comments that receive very low interaction, preventing them from being at the top of the ranking.</li></ul><pre>def wilson_lower_bound(up, down, confidence=0.95):<br>n = up + down<br>    if n == 0:<br>        return 0<br>    z = st.norm.ppf(1 - (1 - confidence) / 2)<br>    phat = 1.0 * up / n<br><br>    return (phat + z * z / (2 * n) - z * math.sqrt((phat * (1 - phat) + z * z / (4 * n)) / n)) / (1 + z * z / n)</pre><blockquote>Let’s explore on my Github, how these concepts are applied in the context of rating products and sorting reviews on Amazon, and how addressing business challenges can enhance customer satisfaction, boost product visibility, and ensure a seamless shopping experience.</blockquote><p><a href="https://github.com/HandanDegerli/A-B_Testing_n_measurementproblems/blob/main/rating-product-n-sorting-reviews-in-amazon.ipynb">A-B_Testing_n_measurementproblems/rating-product-n-sorting-reviews-in-amazon.ipynb at main · HandanDegerli/A-B_Testing_n_measurementproblems</a></p><h3>What is Hypothesis Testing?</h3><p>A statistical method used to test a belief or an argument. The main purpose of group comparisons is to try to show whether possible differences arise by chance.</p><p>Has the average daily time spent by users in the application increased after the interface change in the mobile application?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*SN8KyYQNEGxC0zNonPzh1A.png" /><figcaption>Design 1: 55 min Design 2: 58 min</figcaption></figure><p>It looks like it has increased by 63 units. Did these 63 units increase by chance? We have to put it to the test.</p><p><strong>Comparing Two Group Means (Independent Two-Sample T-Test)</strong><br>Basically someone who has set a reference point. It would make sense if I could fit anything I have into this reference table and compare it accordingly. A standardization has been made. Like T table, Z table..<br>P &lt; 0.05 will be our shortcut. 0.05 is the reference point corresponding to the vertices. The programs we use will give us the p value. We will compare the calculated p value value with our comparison value, the alpha value of 0.05. If the P value is less than 0.05, we will be rejecting H0.</p><blockquote><strong><em>1. Define a hypothesis</em></strong></blockquote><blockquote><strong><em>2. Assumption Check</em></strong><em><br></em><strong>Normality:</strong>The data within each group should be normally distributed.<em><br></em><strong>Variance Homogeneity:</strong> The variances of the groups should be similar (equal).</blockquote><blockquote><strong><em>3. Application of the Hypothesis</em></strong><em><br></em>Use the independent two-sample t-test if assumptions are met.(parametric)<em><br></em>Use the Mann-Whitney U test if normality is not met.(non-parametric).</blockquote><blockquote><strong><em>Note:</em></strong><em><br>- </em>Use Welch’s t-test if variance homogeneity is not met but normality is met. For this case, an argument is entered into independent two-sample t-test.<em><br>- </em>It may be useful to perform outlier analysis and correction prior to normality analysis.</blockquote><h3>A/B Testing</h3><p>A/B testing, also known as split testing, compares two different versions of something (mobile app, web page, advertisement, etc.) to determine which one performs better. A/B testing is a common statistical test, especially in marketing strategy. We can see which version is making more purchases or more clicks after split testing, and then we can make strategic decisions. Many companies use A/B testing in the new technology world, like Instagram, Facebook, Google, LinkedIn, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*sP9OoH78hG_XLrOUDKo_7g.png" /></figure><p><strong>ANOVA (Analysis of Variance)</strong>: It is used to compare the mean of more than two groups. It is an analysis of variance.</p><p>Imagine above user interface change in mobile application example but we are not sure how it will perform. At this point, we can use A/B testing. We publish each page in the same URL and show the first page to half of our visitors. The rest of our visitors see our new page. After getting some responses from visitors, we can test which page performed better.</p><p>Let’s do an exercise to understand all these issues.</p><blockquote><strong>Business Problem:</strong><br>Facebook recently introduced a new type of bid, average bidding, as an alternative to the current type of bidding called maximum bidding.<br>One of our customers xxx.com decided to test this new feature and wants to do an A/B test to see if average bidding converts more than maximum bidding.</blockquote><blockquote><strong>Dataset Story</strong><br>In this data set, which includes the website information of xxx.com, there is information such as the number of advertisements that users see and click, as well as earnings information from here.<br>There are two separate data sets, the control and test groups.</blockquote><blockquote><strong>Variables</strong><br>Impression: Shows number of the advertisement<br>Click: Indicates the number of clicks on the displayed ad.<br>Purchase: Indicates the number of products purchased after the ads clicked.<br>Earning : Earnings after purchased products</blockquote><h4>1. Let’s define the hypothesis of the A/B test</h4><blockquote><strong><em>H0:</em></strong><em> </em>Average purchases are equal for control and test groups.<em><br></em><strong><em>H1:</em></strong><em> </em>Average purchases are NOT equal for control and test groups.</blockquote><blockquote><strong>M1: </strong>Average of purchase of control group<br><strong>M2:</strong> Average of purchase of test group</blockquote><blockquote><strong>H0 : M1 = M2<br>H1 : M1!= M2</strong></blockquote><h4><strong>2. Import Libraries</strong></h4><pre>import numpy as np<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>import statsmodels.stats.api as sms<br>from scipy.stats import ttest_1samp, shapiro, levene, ttest_ind, mannwhitneyu, \<br>pearsonr, spearmanr, kendalltau, f_oneway, kruskal</pre><h4>3. Read the data</h4><pre>df_control = pd.read_excel(&#39;.../ab_testing.xlsx&#39;, sheet_name=&#39;Control Group&#39;)<br>df_control.head()<br>df_test = pd.read_excel(&#39;.../ab_testing.xlsx&#39;, sheet_name=&#39;Test Group&#39;)<br>df_test.head()</pre><p><strong><em>Output after concat() and head() :</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*4n0SZ5fInM0IdlY6S0FSTw.png" /></figure><h4>4. Assumption Control</h4><p>Assumption checks are performed before hypothesis tests are performed. These are <strong>Normality Assumption</strong> and <strong>Variance Homogeneity</strong>. Let’s start with the assumption of normality.</p><p><strong>Normality Assumption</strong></p><blockquote><strong>H0:</strong> Distribution is normal.<br><strong>H1:</strong> Distribution is not normal.</blockquote><p>The Shapiro-Wilk test is a widely used and powerful test for assessing the normality of data. It rejects the hypothesis of normality if the p-value is less than or equal to 0.05, indicating that the data likely does not follow a normal distribution. This test is comparable in power to other normality tests and is a reliable tool for detecting departures from normality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*luystjoyAQTm58qqFkVzWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*kARcC16zxTY9yPGxe2sXrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*3l96Yr2s33GnYzMfc6H0ng.png" /></figure><p><em>For each group, p values are greater than 0.05 so we can not reject (fail to reject) the H0 hypothesis, which is distribution is normal.</em></p><p><strong>Variance Homogeneity</strong></p><blockquote><strong>H0: </strong>Variances are homogeneous.<br><strong>H1:</strong> Variances are not homogeneous.</blockquote><p>Levene’s test is an inferential statistic used to evaluate the equality of variances for a variable across two or more groups. It is commonly used to validate assumptions of equal variances in statistical procedures like ANOVA and t-tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*Hreeyfkh6YU3Zzu-nzZfIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*3l96Yr2s33GnYzMfc6H0ng.png" /></figure><p><em>P value is greater than 0.05 so we can not reject (fail to reject) the H0 that variances are homogeneous. Both assumptions are correct so we will use parametric test for this case.</em></p><h4>6. Application of the Hypothesis</h4><ol><li>Independent two-sample t-test (parametric test) if assumptions are confirmed. (The <strong>Z-test</strong> when you have a large sample size more than 30 and know the population standard deviation. The <strong>T-test</strong> when you have a small sample size and/or the population standard deviation is unknown.)</li><li>Mann-Whitney U test if assumptions are not confirmed (non-parametric test)</li></ol><p>If normality is not achieved, we will do all kinds of nonparametric tests.<br>If normality is achieved and variance homogeneity is not achieved, we will enter arguments to the t test function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*RgPdKksLFkIEf8DUUngROQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*5jIXcsET21fWngTlNPdsBQ.png" /></figure><p><em>P value is greater than 0.05 so we can not reject (fail to reject) the H0 hypothesis that average purchase are equal for each groups. In conclusion, there is no statistically difference between the maximum and average bidding methods with %95 confidence interval.</em></p><p>If you want to learn more come to visit my below pages!</p><p>Github: <a href="https://github.com/HandanDegerli/A-B_Testing_n_measurementproblems">https://github.com/HandanDegerli/A-B_Testing_n_measurementproblems</a></p><p>Kaggle: <a href="https://www.kaggle.com/work/code">https://www.kaggle.com/work/code</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=872403da3066" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Combining CRM Analytics with RFM Segmentation]]></title>
            <link>https://medium.com/@dgrl.handan/combining-crm-analytics-with-rfm-segmentation-57147b753012?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/57147b753012</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Mon, 27 May 2024 08:32:29 GMT</pubDate>
            <atom:updated>2024-05-27T20:39:11.782Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*--JZXPytHnIadsU6_QFv4Q.png" /></figure><p>Customer Relationship Management (CRM) is a strategy and technology used by businesses to manage and analyze customer interactions and data throughout the customer lifecycle. The primary goal is to improve customer service, enhance customer retention, and drive sales growth. CRM systems compile customer data across different channels to provide a comprehensive view of customer interactions and behaviors.</p><p>It provides the opportunity to monitor the communication or interaction with the customer using visual techniques and format and track them with various KPIs, as examples Retention Rate KPIs, Customer acquisition Rate KPIs, Customer Retention Rate KPIs, Customer churn rate KPIs, Conversion Rate KPIs, Growth Rate KPIs. KPIs (key performance indicators) are a basic performance indicators. KPIs are indicators used to track a specific business goal.</p><p>What is RFM analysis?</p><p>The “RFM” in RFM analysis stands for recency, frequency and monetary value. RFM analysis is a way to use data based on existing customer behavior to predict how a new customer is likely to act in the future. An RFM model is built using three key factors:</p><ul><li><em>how recently a customer has transacted with a brand</em></li><li><em>how frequently they’ve engaged with a brand</em></li><li><em>how much money they’ve spent on a brand’s products and services</em></li></ul><p>RFM segments can created that reflect their purchase behavior and potential value by assigning each customer a score from 1 to 5 for each metric.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*cieAcefoC2cT7GF29gvEOw.png" /></figure><p>Once you have performed RFM analysis and created RFM segments, you can use them to improve your CRM customer segmentation and target your customers with relevant and effective messages. For example, segment 555 are your best customers who buy frequently, recently, and spend a lot, and should be rewarded with loyalty programs, discounts, or personalized offers to increase their lifetime value and advocacy. Segment 551 are low-spending customers who buy frequently and recently; they are good candidates for upselling and cross-selling. Recommend higher-value products or complementary items that align with their purchase history to increase their average order value. Or implement or enhance loyalty programs to encourage higher spending. Finally, segment 115 customers who buy rarely and not recently, and spend more; they should be re-engaged with win-back campaigns, special deals to increase their purchase frequency and recency.</p><h3>How to do RFM analysis?</h3><p>At first, we need to calculate the recency, frequency, and monetary metrics we mentioned before and then scale them between 1–5 ranks called score. The key point when we calculate the score is that there is an inverse proportion between the recency and recency score. However other metrics are directly proportional to their scores.</p><p>Step 1: RFM metrics calculations for each customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*YW4ycM4lzeAw9uOeWhsUsQ.png" /></figure><p>Step 2: Convert RFM metrics to RFM scores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*FZwWMyZc4z3iU4IwFQWuDg.png" /></figure><p>Step 3: Concatenate the recency and frequency scores. Just bring the scores together and call them rf_score like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*VllnwJD-M_X0QrYNi7oDxg.png" /></figure><p>Step 4: Map the rf_scores with the RFM graph and segment all customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*N1MyB0xADUdvX-uV4K355A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*ecsWPLRQxP-2-wA29eHDGA.png" /></figure><p>Now we have customer segmentation and we can check all the group’s recency, frequency, and monetary metrics. It can give us a lot of information about customers, sales or marketing, etc. Below is an example of the group’s mean values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-MOvwLYDg7LdlXi_5zdblA.png" /></figure><p>I just give a basic example of how to make an RFM analysis in this article. If you want to learn more about how to clean and aggregate the data, also how to do RFM analysis with python, check these links :</p><p>Github link: <a href="https://github.com/HandanDegerli/crm_analitics/blob/main/flo-rfm-analysis-project.ipynb">https://github.com/HandanDegerli/crm_analitics/blob/main/flo-rfm-analysis-project.ipynb</a></p><p>Kaggle link: <a href="https://www.kaggle.com/code/handandegerli/flo-rfm-analysis-project">https://www.kaggle.com/code/handandegerli/flo-rfm-analysis-project</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57147b753012" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced Functional Exploratory Data Analysis]]></title>
            <link>https://medium.com/@dgrl.handan/advanced-functional-exploratory-data-analysis-246740015f0c?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/246740015f0c</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Wed, 22 May 2024 00:37:17 GMT</pubDate>
            <atom:updated>2024-05-22T00:37:17.411Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>General Framework</strong></p><p>Exploratory Data Analysis (EDA) is designed to efficiently analyze datasets of varying sizes using a set of general functions. It reveals both the detailed and overall characteristics of the data, such as the number of observations, variables, missing values, variable types, and samples of the initial and final entries. In this instance, we’ll be using the “titanic” dataset. To commence our data analysis, some useful functions include:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*uWUo2cgfa8nod5Ov91pcAQ.png" /></figure><p>It is crucial to encapsulate our tasks into functions. In Python, functions help us avoid redundancy and repetition in our code.</p><p><strong>capturing variables and generalizing operations</strong></p><p>In Python, there are three primary types of categorical variables: bool, object, and category. To efficiently gather these variables into a list, we use list comprehension. On the other hand, some variables appearing as int64 or float64, they can still be categorical if they possess fewer than 10 unique values(this number depends on dataset), indicating a limited number of classes. Detecting such variables is pivotal in data analysis. Conversely, categorical variables may have more than 20 classes, known as cardinal variables, which can include a vast array of values, such as names of individuals in a dataset. However, it’s essential to note that the more classes a categorical variable contains, the less informative it becomes. Identifying and listing such variables aids in data understanding and manipulation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*trVtOuPK0M5GNPuHMdmiQg.png" /></figure><p><strong>Analysis of Categorical and Numerical Variables</strong></p><p>Next, let’s functionalize the procedures that analyze the categorical and numerical variables. We construct a function that takes a data frame, variable name, and plot (default False) as parameters. It counts the number of values of the classes of the given categorical variable and computes the percentages of these classes. If the plot parameter is given True, then the function visualizes the variable by bar plot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*0OYZDvgC0cbW3rjoL1ITTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*smaHh3eU1bwwZBFVsHcfbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*BvOXyPgSdBoIwgpg4Am9-w.png" /></figure><p>We may construct a general function that analyzes the numerical variables of a given data frame. The function has a data frame, variable name, and plot(default False) as parameters. It gives some statistical values (beyond the standard values, our function computes some quantiles) of the variables and draws a histogram if the plot parameter is True.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*SZT_bQUHS9MiwluUqaTZsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*nnPzQIByUpcl29W8iOzkaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*zGO8Tngaok53IylNXERqEg.png" /></figure><p><strong>Analysis of Target Variable with Numerical and Categorical Variables</strong></p><p>In a given data set, “target variable” is the variable whose values are to be modeled and predicted by other variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*qvCIIV2pLjmSFRqbtPuKNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*8DDkhdU8hPIk-g3k_w-9iw.png" /></figure><p><strong>Analysis of Correlation</strong></p><p>Correlation is any statistical relationship, whether causal or not. It describes the strength of an association between two variables and is completely symmetrical. The value of a correlation coefficient ranges between -1 and +1. The correlation coefficient is +1 in the case of a perfect direct (increasing) linear relationship (correlation), −1 in the case of a perfect inverse (decreasing) linear relationship (anti-correlation), and some value in the interval (−1,1) in all other cases, indicating the degree of the linear relationship between the variables. As it approaches zero there is less of a relationship (closer to uncorrelated). The closer the coefficient is to either −1 or 1, the stronger the correlation between the variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*wHz-rvMj1ShqmKItMwNbRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*aA_-0epyu4ZieJv6VGkEuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*LSH1GMYtVus1D4RQzvNNXg.png" /></figure><blockquote>Thanks for reading :)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=246740015f0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types in Python]]></title>
            <link>https://medium.com/@dgrl.handan/data-types-in-python-ab59c283d638?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab59c283d638</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Wed, 15 May 2024 12:14:31 GMT</pubDate>
            <atom:updated>2024-05-15T12:47:37.856Z</atom:updated>
            <content:encoded><![CDATA[<p>No matter which programming language we use, the concepts of data and data types are an integral part of our lives. Therefore, it is important to first understand what data is and explore how it is used in computer science disciplines. In the data science discipline, the purposes for which data is used vary if we compare with other computer science discipline. In this article, we will explain what data is, discuss the purposes for which data is used in data science, and then focus on the data types used in Python, one of today’s popular programming languages. Let’s get into the details!</p><h4>Data</h4><p>Data is the raw or basic state of the information processed or represented. We use this data for a variety of purposes across computer science disciplines.</p><p>In Data Science context, the term “data” refers to information in numerical or textual format that typically represents information, including observations, measurements, or descriptive characteristics. In data science, this data is often used for analysis, modeling and prediction purposes. Data science attempts to extract meaning from data using tools such as data analysis, machine learning, and statistics. This often involves the process of deriving business decisions, forecasts, recommendations or insights.</p><h4>The importance of Data Types</h4><p>Understanding data types in Python is of fundamental importance in programming. Choosing the right data type ensures that your program is efficient, reliable and can produce the expected results.</p><p>Knowing what data type a variable represents allows you to decide how to use the variable and what types of operations to perform, allowing your program to run correctly. It prevents you from making simple mistakes that you may encounter while writing your code.</p><p>Using data types correctly will improve your program’s memory usage and make it run more efficiently.</p><p>Understanding data types helps your program run more efficiently by using the correct data type and applying operations specific to that data type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*zwwJQ0UChJjLUIoukh2BNA.png" /></figure><p>Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. Since everything is an object in Python programming, data types are actually classes and variables are instances (object) of these classes. Let’s explore Python’s diverse data types and their significance.</p><ol><li><strong>Numeric Data Types</strong></li></ol><p>The numeric data type in Python represents the data that has a numeric value. A numeric value can be an integer, a floating number, or even a complex number. These values are defined as <strong>Python integer</strong>, <strong>Python float</strong>, and <strong>Python complex </strong>classes in Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/122/1*osjgusVm4K_YO_ff_ub6VQ.png" /></figure><p><strong>2. Dictionary</strong></p><p>A dictionary is an unordered Python Collection(Array) of data values, used to store data values like a map, unlike other Data Types that hold only a single value as an element, a Dictionary holds a key: value pair. We use Dictionaries to check if an item is present or not . It is very flexible as the items in a dictionary do not need to be of the same type. We can use numbers, strings, tuples as dictionary keys except cannot use list as a key of it . First, “keys”in Dictionary are constant elements. So, what is the issue here? When search the key in dictionary, a hash value is generated for each key and it can be tracked Dictionary elements by this hash value. So if a hash function is generated from a list and then the items of the lists changed the dictionary will generate a new hash value for this list and it is not possible to find the same key. The reason is Lists are mutable objects which means that we can change values inside a list append or delete values of the list. But sure, there are some options in order to handle this issue. For instance convertion of the data type etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*EktQtALip04GQ-1CvzBQhg.png" /></figure><p><strong>3. Boolean</strong></p><p>A data type with built-in values, True or False, known as Boolean, denotes true or false states. Booleans, True or False, are distinct in Python; lowercase ‘true’ or ‘false’ will result in an error due to case sensitivity. Non-Boolean objects can also be assessed for truthiness or falseness within a Boolean context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/115/1*XY34qt3su7UK_CJiAcToWA.png" /></figure><p><strong>4. Set</strong><br>In Python, a set is an unordered collection of data types that is iterable and mutable, has unique elements. It is very flexible as the items in a set do not need to be of the same type. Sets do not allow duplicate elements and are commonly used for mathematical operations like intersection, union, and difference. They provide efficient membership testing and offer methods to modify, manipulate, and compare sets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*82V91CMwF2mJiN5dJRh65w.png" /></figure><p><strong>5. Sequence Type</strong></p><p>The sequence Data Type in Python is the ordered collection of similar or different data types. Sequences allow storing of multiple values in an organized and efficient fashion.</p><p><strong>5.1.String Data Type</strong></p><p>Strings in Python are arrays of bytes representing Unicode characters. A string is a collection of one or more characters put in a single quote, double-quote, or triple-quote. In python there is no character data type, a character is a string of length one. Where characters are represented by the string class (str).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/1*bySbf0n5BVf__BqUZsr9Dg.png" /></figure><p><strong>5.2.List Data Type</strong></p><p>A list in Python is a mutable and an ordered collection of items enclosed within square brackets. It allows for the storage of heterogeneous elements and supports indexing, slicing, and various methods for modification and manipulation. Lists are fundamental data structures widely used for storing, accessing, and processing data in Python programs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*ZhsGojm6VPGszt4lKSBsEg.png" /></figure><p><strong>5.3.Tuple Data Type</strong><br>Just like a list, a tuple is also an ordered collection of Python objects. The only difference between a tuple and a list is that tuples are immutable i.e. tuples cannot be modified after it is created. It is represented by a tuple class. It is very flexible as the items in a tuple do not need to be of the same type. Tuples are occasionally preferred for error reduction and provide beneficial in certain functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*VbLtGIPBnpzFg1xvA5HKtg.png" /></figure><blockquote><a href="https://docs.python.org/3/library/datatypes.html"><strong>python.org</strong></a><strong> , </strong><a href="https://www.geeksforgeeks.org/python-data-types/"><strong>geeksforgeeks.org</strong></a><strong> , </strong><a href="https://www.w3schools.com/python/python_datatypes.asp"><strong>w3school.com</strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab59c283d638" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using HTTP Methods in REST]]></title>
            <link>https://medium.com/@dgrl.handan/using-http-methods-in-rest-1d1b20df96f2?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d1b20df96f2</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Sat, 05 Nov 2022 11:45:21 GMT</pubDate>
            <atom:updated>2022-11-05T11:54:10.463Z</atom:updated>
            <content:encoded><![CDATA[<p>In REST-based web services, special meanings are attached to HTTP methods, so the method is run when an HTTP request is received to the web service. In this case, it is important how to use HTTP methods with REST. Now let&#39;s move on to the rules about using HTTP methods in REST.<br>There are many free test tools for testing, you can test one of them ( Postman, Swagger UI etc.).</p><p>An HTTP method tells the server what it needs to do to the resource. The following are four common HTTP methods:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*KEhwR923MjSBKsjzJ_zmOg.png" /><figcaption>This diagram is obtained from guru99.com</figcaption></figure><p><strong>Response Codes</strong><br>If there is an error, it will report the error, and if the sent request has been processed successfully, it will report the status of it. Status codes are divided into 5 categories.<br>· 1xx Information<br>· 2xx Successful<br>· 3xx Routing<br>· 4xx Client Error<br>· 5xx Server Error</p><p>Now let&#39;s examine the most used status codes in these categories.</p><p>· 200 (OK) : Successful GET, PUT or POST operation. Returned for a successful response<br>· 201 (Created) : Success in PUT or POST operation. The object has been successfully created or updated.<br>· 204 (No Content) : Success in PUT or POST operation. Directory or documents uploaded successfully.<br>· 400 (Bad Request ): The request URI is returned when there is an error in the headers or body.<br>· 401 (Unauthorized ): Indicates that an attempt is made to access a protected resource without providing the necessary authorization.<br>· 403 (Forbidden): Returned when you pass an invalid API key.<br>· 404 (Not Found): Indicates that the resource requested by the client could not be found.<br>· 405 (Method Not Allowed ): Indicates that the requested URI does not support the corresponding method<br>· 406 (Not Acceptable): Indicates that the server could not output in any format from the media types written in the Accept field in the header in the request sent by the client.<br>· 409 (Conflict ): Returned when there is a conflict of write operations.<br>· 500 (Internal Server Error): Used if the request cannot be fulfilled due to the server&#39;s error.</p><p>See you in our next article,<br>Good coding...</p><blockquote><a href="https://www.guru99.com/restful-web-services.html">guru99.com</a>, <a href="https://aws.amazon.com/what-is/restful-api/">aws.amazon.com</a>, <a href="https://www.ibm.com/tr-tr/cloud/learn/rest-apis">ibm.com</a>, <a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes">Wikipedia</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d1b20df96f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RESTful API(REST API)]]></title>
            <link>https://medium.com/@dgrl.handan/restful-api-rest-api-402e5adcaf8a?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/402e5adcaf8a</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Wed, 02 Nov 2022 17:41:10 GMT</pubDate>
            <atom:updated>2022-11-05T11:51:20.246Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will try to explain RESTful API…</p><p><strong>First of all, What is an API and how does it work?</strong></p><p>An Application Programming Interface(API) is a set of rules that define how applications or devices can connect and communicate with each other. API integration refers to several applications (two or more) that are interconnected via their APIs to exchange data and perform a common function, thereby enabling interaction between applications.</p><p>The application or service that performs the access is called the client, and the application or service that contains the resource is called the server.</p><p>To develop an Api you should follow one of the following design patterns:<br>- Rest<br>- SOAP<br>- gRPC<br>- XML-RPC<br>Generally, REST is used in modern software development processes. gRPC is a technology that has just entered our lives. Since the subject of our article is REST, we will continue from there.</p><p><strong>So What is REST?</strong></p><p>Representational State Transfer(REST) is an architecture that works over the HTTP protocol that provides communication between client and server. It enables the application to communicate by carrying XML and JSON data between client and server. APIs that conform to the REST architectural style are called REST APIs. Web services that implement REST architecture are called RESTful web services. The term RESTful API generally refers to RESTful web APIs. However, you can use the terms REST API and RESTful API interchangeably.</p><p>Restful has become popular mostly for the following reasons:</p><ol><li><strong>Programming Languages</strong>(various programming languages are used to built applications)</li><li><strong>Environments</strong>(applications can reside on different environments such as Linux, Windows)</li><li><strong>The event of Devices</strong>(everything needs to work on the mobile devices, the notebooks etc.)</li><li><strong>The event of the Cloud</strong>(applications are slowly moving to cloud-based systems for instance Azure or Amazon)</li></ol><h3><strong>REST DESIGN PRINCIPLES</strong></h3><p>Before moving on to the constraints and rules to be considered for creating RESTful APIs, let&#39;s talk about 3 basic concepts:<br><strong>Client</strong>: Client is the person or software that uses the API.<br><strong>Server</strong>: It is the system that hosts all APIs and functionalities. It is responsible for processing the requests from the client and returning the necessary answers in the desired format.<br><strong>Resource</strong>: A resource can be any object to which the API can provide information. Each resource has a unique identifier. The descriptor can be a name or a number.</p><p>Coming to the design principles of the Rest Api;</p><h4><strong>1. Client-Server</strong></h4><p>Server will have a RESTful web service which would provide the required functionality to the client. The client send’s a request to the web service on the server. The server would either reject the request or comply and provide an adequate response to the client. As a result, client and server are developed independently of each other, development is simple and scalability is high on the server side, and the portability of the code is high on the client side.</p><h4>2. Stateless</h4><p>The server does not keep information about the client such as session. Only the client holds such information. Therefore, the server does not keep information such as how many requests the client has made before or which requests. While the client, gives all the information the server needs in its request.</p><h4>3. Cache</h4><p>The cache is a concept implemented on the client to store requests which have already been sent to the server. So if the same request is given by the client, instead of going to the server, it would go to the cache and get the required information. This saves the amount of to network traffic from the client to the server.</p><h4>4. Layered System</h4><p>About client-server architecture do not always mean that a client sends a request directly to a server and receives a direct response from it. There may be layers such as security layer, cache layer in between. Each layer should only know the layers it communicates with. But the introduction of this layer needs to be transparent so that it does not disturb the interaction between the client and the server.</p><h4>5. Uniform Interface</h4><p>The uniform interface indicates that the server transfers information in a standard format. The formatted resource is called a representation in REST. This format can be different from the internal representation of the resource on the server application. For example, the server can store data as text but send it in an HTML representation format.</p><h4>6. Code On Demand</h4><p>In REST architectural style, servers can temporarily extend or customize client functionality by transferring software programming code to the client.</p><h4><strong>How does REST API work?</strong></h4><p>In REST architecture, operations are done with the concept of resources. It is defined by the resource URI and can be a method definition or a variable. With the URIs that will call the created method, a request is made to the web service with the HTTP protocol. Thus, operations for REST are done entirely over HTTP methods. The URL is all we need to work with a service written in the REST. When we request a URL, the URL returns you a response in JSON, TXT, HTML or XML format, the returned response is parsed and your service integration is complete. In other words, the client does not have to know the structure and details of a REST service. REST facilitates independent development of different areas of a project, due to the separation between client and server. The possibility of testing in different environments at the same time and easy communication even if the client-server is hosted on different servers, these provides a significant benefit in terms of management. Scalability, flexibility and independency are advantages of RESTful APIs.</p><blockquote><a href="https://www.guru99.com/restful-web-services.html">guru99.com</a>, <a href="https://aws.amazon.com/what-is/restful-api/">aws.amazon.com</a>, <a href="https://www.ibm.com/tr-tr/cloud/learn/rest-apis">ibm.com</a>, <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">Wikipedia</a>, <a href="https://www.codecademy.com/article/what-is-rest">www.codeacademy.com</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=402e5adcaf8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Interface in Java]]></title>
            <link>https://medium.com/@dgrl.handan/using-interface-in-java-18ade0194b09?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/18ade0194b09</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Tue, 18 Oct 2022 08:01:06 GMT</pubDate>
            <atom:updated>2022-10-20T11:44:24.175Z</atom:updated>
            <content:encoded><![CDATA[<p>First of all it is important to know definitions of class and abstract class to identify interfaces.</p><p>Class is the name given to the templates used in object-oriented programming languages ​​to describe the properties, behavior, and initial states of objects. An object derived from a class is defined as an instance of that class. Classes represent the behavior of objects with their methods, and the states of objects with their variables. All methods must be completed with a body.</p><p>Abstract class is a type of class in Java that is declared by the abstract keyword. Abstract class can contain abstract methods and non-abstract methods.</p><p>On the other hand, interface is not a class. Interfaces provide a mechanism that allow hierarchically unrelated classes to implement the same set of methods. Basically, an interface is a collection of method definitions and constant values that is free from dependency on a specific class or class hierarchy. Interface can have abstract, default and static methods.</p><p>Abstract classes should be used primarily for closely related objects(<strong>is-a</strong>). Interfaces are better at providing common functionality for unrelated classes(<strong>can-do</strong>).</p><h3><strong>What is the purpose of the interface?</strong></h3><p>The purpose of using interfaces in Java is to provide abstraction and multiple inheritance.</p><p>As we know that a class in Java can inherit only one class. However, in Java, a class can implement more than one Interface.</p><p>This allows us to achieve multiple inheritance patterns. Interfaces only carry the signature of the method, that is, they do not contain a method body. In other words, when interface tells the class what to do, interface does not tell how it should do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*yh_j1BBIiSCSHe34eIRWgw.png" /></figure><p>From this perspective, interfaces are designed to play a unifying role. Let me state an important point right away; Bodyless (abstract) methods of interfaces automatically have a public access modifier and you cannot change it.</p><p>Likewise, the global fields of the interfaces automatically have the public access modifier, in addition, these fields also automatically contain the final and static property. The initial values ​​of the fields defined in the interfaces can also be given at run-time. A class that implements an interface must implement all methods written in that interface.</p><p>If there are abstract methods inside interfaces that have everything the same except their return types, this can cause unexpected problems because Java cannot distinguish these methods by return types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/172/1*kJASfvhvBaFviK30YGogMQ.png" /></figure><p>On the other hand, the ability of an object of a class to be bound to many types of class references provides great flexibility within the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*7YgYwid6zjTT5Ju9B75rQw.png" /></figure><p>In addition to this interface can hold the reference of the class that implements it. (abstract class has the same situation)</p><h3><strong>Nested Interfaces</strong></h3><p>An interface can be defined inside another interface or class. Nested interfaces defined inside an interface cannot have access specifiers protected, friendly, or private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*HoBBVRJBJuKcLqb00gjBfw.png" /></figure><p>According to DRY(don’t repeat yourself) principle, common topics should be gathered in interfaces and implemented by classes that intersect with topics. As an example, overtime is a common topic at work. When an employee in another category is added in such a system, they are directly included in the system, and sustainability is ensured. In other words, our program would not have resisted development and change.</p><p>Another issue is similar to the Abstract class structure. An abstract class is a class structure, and just like classes, a class can only extend one abstract class. This prevents us from reaching the multiple inheritance structure.</p><p>In summary, the interface plays an important role in troubleshooting the problems described above.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18ade0194b09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types in Java]]></title>
            <link>https://medium.com/@dgrl.handan/data-types-in-java-4434e6d2aaa5?source=rss-9c663a1841c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4434e6d2aaa5</guid>
            <dc:creator><![CDATA[Handan Degerli]]></dc:creator>
            <pubDate>Fri, 14 Oct 2022 12:23:53 GMT</pubDate>
            <atom:updated>2022-10-14T12:23:53.827Z</atom:updated>
            <content:encoded><![CDATA[<p>In general, every class is a data type, every data type is a class in Object Oriented Programming language. Java programming language follows this general rule.</p><p><strong>Why data type?</strong></p><p>Java and some other programming languages ​​separate data into types. When defining a variable, it specifies which type of data it will hold. Thus, it allocates enough space for that variable in the main memory and allows operations to be performed according to that data type. As an example, it is possible to do four operations with numbers, but not with texts.</p><p>In addition to this, Java programming language is also a statically and strongly type language which means that helps detect errors at compile time.</p><p>Therefore, the types of the Java programming language are divided into three: primitive data types, reference data types and null data type.</p><p><strong>1.</strong> The primitive types are shown on the below table with default size, value range and wrapper classes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*tBGOiev9aL8Q3gUhOsoI2Q.png" /></figure><p><strong>2.</strong> The reference types are class types, interface types, and array types. Class type is a set of instructions including data values and methods which means that operates on data. Interface is implemented by classes. And the array gives the fixed-size data structure that keeps the values of the same type. Class type is also template that define objects of the same type. An object represents an entity in the real world that can be distinctly identified. An object has a unique state and behavior: The state of an object consists of a set of data fields with their current values; the behavior of an object is defined by a set of methods.</p><p>An object is a dynamically created class instance or an array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*wdtZIuphMus_30tkohIh4Q.png" /><figcaption>Example of creation an object of class</figcaption></figure><p>In the above example, objectName is a reference whose points a specific region in the heap memory . Where it points, there is the object or also called the instance.</p><p>What about String?</p><p>It is important to identify that String is an Object type and immutable which means that when you assign a value to a string expression, then when you want to make some additions to this value, it generates a new object, takes a new place in the heap, and leaves the previous value to the garbage collector.</p><p><strong>3.</strong> On the other hand, there is also a special null type, the type of the expression null, which has no name. Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type. The null reference is the only possible value of an expression of null type. The null reference can always be cast to any reference type. In practice, the Java programmer can ignore the null type and just pretend that null is merely a special literal that can be any of reference type.</p><p>Lastly, the main differences between <strong>primitive</strong> and <strong>reference</strong> data types are:</p><ol><li>Primitive types are predefined(already defined) in Java. Reference types are created by the programmer(except for String).</li><li>Reference types can be used to call methods to perform certain operations, while primitive types cannot.</li><li>A primitive type has always a value, while reference types can be null.</li><li>A primitive type starts with a lowercase letter, while reference types starts with an uppercase letter.</li><li>The size of a primitive type depends on the data type, while reference types have all the same size.</li><li>Primitive type values are kept in the stack memory. On the other hand reference type’s references are kept in the stack memory, while values ​​are kept in the heap memory.</li></ol><p><strong><em>Sources: </em></strong><a href="https://www.w3schools.com/java/java_data_types_non-prim.asp"><em>w3schools.com</em></a><em>, </em><a href="https://www.geeksforgeeks.org/reference-variable-in-java/"><em>geeksforgeeks.org</em></a><em>, </em><a href="http://web.deu.edu.tr/doc/oreily/java/langref/ch03_02.htm"><em>web.deu.edu.tr</em></a><em>, </em><a href="http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/4.doc.html"><em>berkeley.edu</em></a><em>, </em><a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html"><em>docs.oracle.com</em></a><em>, </em><a href="http://www.baeldung.com/"><em>www.baeldung.com</em></a>, <a href="https://www.oreilly.com/library/view/java-8-pocket/9781491901083/ch04.html"><em>www.oreilly.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4434e6d2aaa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>