<?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 Oyku Akkoyun on Medium]]></title>
        <description><![CDATA[Stories by Oyku Akkoyun on Medium]]></description>
        <link>https://medium.com/@oyku.akkoyun?source=rss-1beced90ebec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oZsL96XibB3v8_9fZho8sg.jpeg</url>
            <title>Stories by Oyku Akkoyun on Medium</title>
            <link>https://medium.com/@oyku.akkoyun?source=rss-1beced90ebec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:58:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oyku.akkoyun/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[React Programming-Fundamentals]]></title>
            <link>https://medium.com/@oyku.akkoyun/react-programming-fundamentals-82dee9450d18?source=rss-1beced90ebec------2</link>
            <guid isPermaLink="false">https://medium.com/p/82dee9450d18</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Oyku Akkoyun]]></dc:creator>
            <pubDate>Fri, 18 Feb 2022 15:22:27 GMT</pubDate>
            <atom:updated>2022-02-18T15:22:27.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*SpyDWLLXR2v2bWw_kRhgXQ.png" /></figure><p>JavaScript is a programming language used to create and control dynamic web content. Its libraries provide functions that are commonly needed while developing applications. <strong>React</strong> is one of these JavaScript libraries. React provides a component based library that uses the Virtual DOM architecture and it is generally used to create fast user interfaces for web applications.</p><p>I’ll try to explain some important fundamentals about React in this article.</p><ul><li><strong>Component</strong></li></ul><p>With classical html, components could be insufficient and code repetitions were required for similar operations. With React, we can write our own component; so we can use it wherever we want. And also, we can build our components to manage their own state, and then we can easily compose them to make complex UIs.</p><pre>class App extends Component {</pre><pre>    componentDidMount() {<br>        this.props.dispatch(handleInitialData());<br>    }<br>...<br>}</pre><p>ComponentDidMount means placing the component in the DOM and showing it in the browser. It is also called as an event that runs after rendering. In my example, App component works after rendering to Dom.</p><p>Components can be stateful or stateless.</p><ul><li>Stateful components have a render method that will run on each state change.</li></ul><pre>class PollResult extends Component {</pre><pre>render() {<br>        const {id, questions} = this.props;<br>        const question = questions[id];<br>        <br>        return (<br>            &lt;div&gt; ... &lt;/div&gt;<br>        )<br>    }<br>}</pre><ul><li>Stateless components don’t have a render method to change the own state.</li></ul><pre>const Poll = props =&gt; {</pre><pre>    const { id } = props.match.params;<br>    const { answeredIds, unansweredIds } = props;<br>    return (<br>        &lt;div&gt;<br>            ...<br>        &lt;/div&gt;<br>    );<br>};</pre><ul><li><strong>State</strong></li></ul><p>We can use state to store values in our Components. State also can be used in many different situations, such as updating a value after clicking a button; storing an input value entered by the user or saving the result from services.</p><p>The state definition is made in the constructor function which will run in the invocations of components that have not yet been mounted. Otherwise, the constructor is not called repeatedly if component is mounted.</p><pre>class PollList extends Component {</pre><pre>    state = {<br>        tab: &#39;unanswered&#39;<br>    };</pre><pre>    handleTabs = event =&gt; {<br>        <strong>this.setState</strong>({<br>            tab: event.target.value<br>        });<br>    };<br>...<br>}</pre><p>We can use the this.setState() method to update states. Thus, we only update the state values which are passing in setState method.</p><ul><li><strong>Lifecycle Methods</strong></li></ul><p>There are 3 different events to manage lifecycle of Component: <strong>Mounting, Updating and Unmounting</strong>. Mounting events allow components to be placed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*338UPU_QQOmSvqpUuS4A3g.png" /><figcaption>Component Lifecycle Source:Author</figcaption></figure><p><strong><em>Mounting</em></strong> is the process of creating an element and rendered for the first time on the web page. This event has two methods that can hook up with <strong>componentWillMount()</strong> and <strong>componentDidMount().</strong></p><p>These two methods are invoked before/after the component is mounted as clearly their names suggest.</p><pre>class Logout extends Component {<br><br>    componentWillMount() {<br>        this.props.dispatch(setAuthedUser(null))<br>    }<br><br>    render() {<br>        return &lt;Redirect to=&quot;/login&quot; /&gt;;<br>    }<br>}</pre><p><strong><em>Updating</em></strong> is triggered with 2 ways: changing state or receiving new props from parent. With update methods we can change the nodes which are already placed in.</p><p><strong><em>Unmounting</em></strong> is the process of removing components from the DOM. It is called before the render function. There is only one method for this event: <strong>componentWillUnmount().</strong></p><ul><li><strong>Virtual DOM</strong></li></ul><p><strong>DOM</strong> (Document Object Model) allows HTML elements to appear hierarchically. It shows a basic representation of our UI. <strong>Virtual DOM</strong> is the in-memory copy of the DOM. Our document objects are stored as key-value pairs on the Virtual DOM. So, there is both a Dom and a Virtual Dom in memory at the same time.</p><p>With the Virtual DOM, an update is provided not for the entire DOM, just only for the modified area. React detects differences between old and new state, and then triggers the render method again. When the render method is triggered again, it doesn’t recreate the entire DOM, just update the changed part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JpkJqgKGIyRv7bwJdknYQ.png" /><figcaption>Reference: <a href="https://www.cashapona.com/2019/04/10/the-significance-of-virtual-dom-in-reactjs/">https://www.cashapona.com/2019/04/10/the-significance-of-virtual-dom-in-reactjs/</a></figcaption></figure><p>So, this feature provides a great advantage to both users and developers with its low computational power and load times in complex and high user interaction websites.</p><p><strong><em>Some helpful links:</em></strong></p><ul><li><a href="https://ui.dev/react-aha-moments">React &#39;Aha&#39; Moments</a></li><li><a href="https://camjackson.net/post/9-things-every-reactjs-beginner-should-know">9 things every React.js beginner should know</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82dee9450d18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Emoji Prediction]]></title>
            <link>https://medium.com/turkcell/emoji-prediction-747597bb1224?source=rss-1beced90ebec------2</link>
            <guid isPermaLink="false">https://medium.com/p/747597bb1224</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[prediction-model]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <category><![CDATA[multinomial-naive-bayes]]></category>
            <dc:creator><![CDATA[Oyku Akkoyun]]></dc:creator>
            <pubDate>Mon, 06 Dec 2021 08:40:42 GMT</pubDate>
            <atom:updated>2022-01-21T07:16:41.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Vhvc-u41-WLLOyVQa8sfxQ.png" /></figure><p>Social media constitutes an important and large area in our lives. Considering this high usage, it will be seen how important it is to understand. In particular, studies in Natural Language Processing have found a large area to work with social media data.</p><p>In social media, which people often use to communicate and express their likes and opinions, there are many areas that can be analyzed and contributed to the literature. One of them is the emoji estimation study, which will also contribute to sentiment analysis. Emojis are now included in almost every sentence. It can even replace words most of the time. Because it can convey emotions and information to us more and more effectively than words. In fact, it has also created its own universal language with its increasing usage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*l2Fdhz2GWoOgounFxJGQzg.png" /><figcaption>Fig1. Emoji Usage [1]</figcaption></figure><p>Considering the high data set that comes with a high usage rate, it is very obvious to use emojis in sentiment analysis. I was tried to predict emoji by working on Twitter data. A corpus was created with tweet data set that can be studied on the prediction. The 2 models used in emoji prediction are Support Vector Machine and Multinomial Naive Bayes.</p><ul><li>DATA</li></ul><p>The data was pulled from Kaggle. There is a dataset containing 70000 tweets in total. Emoji labeling has been done on the data set. There are 20 label assignments in data. These are mostly hearts and also smiling face with sunglasses, winking face, christmas tree, etc. First of all, the distribution of tweets according to these emoji labels in the data set was examined. It was noted that there is no normal distribution here and the imbalance between the number of classes corresponding to some emoji classes. Emoji labels with similar expressions were combined and the number of classes was reduced to 4. The emoji labels of these classes are: Joy, Vacation, Sadness(Dark Heart), Love.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cYxWi92vmeC9hN6R9WlppQ.png" /><figcaption>Fig2. Data Distribution</figcaption></figure><ul><li>LEMATIZATION PROCESS</li></ul><p>The preprocessing work on the data continues by removing the stop words while creating the TF-IDF model. Wordnet corpus was used while creating word vectors. Each word is tagged as noun, verb, adjective and adverb. After the lemmatization process, the appearance of the data set is as in the table below. The TEXT_FINAL column contains the vectors made up of words before and after the lemmatization process for each sentence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3edbJCH5b1xIgJ5oM281g.png" /><figcaption>Fig3. Before Lemmatization Process</figcaption></figure><p>Punctuation marks or meaningless characters, expressions were not removed in the preprocessing step. There was no need for such a process since there were root words after the lemmatization process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ylxLSHeZhTanZ5En-n--ug.png" /><figcaption>Fig4. After Lemmatization Process</figcaption></figure><p>After this process, the data set is separated for training and testing. It is divided into 80% training and 20% test data. Then, the train and test data were converted from text to numeric data with LabelEncoder.</p><p>‘TF-IDF is a statistical measure that evaluates how relevant each word in a document collection is to the document.’ [2] The method is implemented by multiplying these two values: how many times a word appears in the document (term frequency-TF) and how many times it appears in a series of documents (inverse document frequency-IDF) [3]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*ZFPcB7QMet5DnsAT_b2ZOA.png" /><figcaption>TF Formula</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*Gdx1pKo7PvfJ3H44WBJNlg.png" /><figcaption>IDF Formula</figcaption></figure><p>The IDF value remains constant until new documents are added; but the TF value will differ in each sentence for each word. Therefore, it is calculated individually for each sentence.</p><p>TF-IDF Vectorizer and Count Vectorizer were used together. This unity is provided by the pipeline architecture. This architecture enabled to produce very fast responses. Normally, Naive Bayes training takes a short time and SVM takes a long time, while the training process is completed at almost the same time with the pipeline architecture.</p><ul><li>TRAINING &amp; TESTING</li></ul><ol><li>Multinomial Naive Bayes</li></ol><p>Naive Bayes is a probabilistic method used in classification especially NLP. In this classifier method, the presence or absence of a feature does not affect the state of the other feature. This algorithm is used to predict the label of a given text and is basically based on Bayes’ theorem. The probability of each tag is calculated on the sample set we have determined, and the tag with the highest rate of these probabilities is found.</p><p>Bayes’ theorem looks at the conditions associated with a situation and calculates the probability of occurrence of the situation based on prior knowledge of these conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*hxhVmyOfzYkf_2OgaKl6wg.png" /><figcaption>Bayes Theorem</figcaption></figure><p>Multinomial Naive Bayes uses the term frequency, i.e. how many times a particular term appears in a document. The term frequency is normalized by dividing the document length. After this normalization process, term frequency can be used to compute maximum likelihood estimates based on the training data to estimate the conditional probability. [4]</p><p>This algorithm can be used for both discrete and continuous data. It is easy to implement and also highly scalable. Therefore, it can easily handle large datasets. Despite these advantages, the prediction rate may remain low compared to other probability algorithms. Although not suitable for regression, it is a pretty good method for textual classification.</p><p>The emoji prediction results after MNB training are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*O25w7Xuvx__uR2_UeW20iQ.png" /><figcaption>Multinomial Naive Bayes (MNB) Confusion Matrix</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcvZ7THqST1d0Cs2227vcA.png" /><figcaption>MNB Accuracy Scores</figcaption></figure><p>Here, looking at the F1 score, it is seen that the prediction success of Multinomial Naive Bayes is 67% for this data set.</p><p>2. SUPPORT VECTOR MACHINES</p><p>SVM is a learning method which is supervised often used in classification problems. It does the classification by separating data points on a plane. In this, a line is drawn in the plane. There are different classes on different sides of this drawn line. The aim here is that the drawn line is at the maximum distance to both classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*B2hAQq4XDWT1aT60H81HiQ.png" /><figcaption>Fig.5. Support Vector Machine[5]</figcaption></figure><p>Hyperplanes are used to classify data points. If data points fall on different sides of the hyperplane, they are in a different class. The dimension in the hyperplane is related to the number of features in our data.</p><p>There are two different classes in the figure 5, blue and red. The main issue of classification is to decide in which class the new data will come. The ±1 interval of the line separating the two classes is called the margin. The higher the margin, the more accurate the classification will be for class 2 or more. [5]</p><p>The emoji prediction results after SVM training are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-7HOjW1wLa5IL9CWavqiCg.png" /><figcaption>SVM Confusion Matrix</figcaption></figure><p>Confusion matrix shows the matching rates of correct labels and predictions after Support Vector Machine training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0x8_QrJJFt2K5Ticq4tQqw.png" /><figcaption>SVM Accuracy Scores</figcaption></figure><p>Here, looking at the F1 score, it is seen that the prediction success of Support Vector Machine is 71% for this data set.</p><p>CONCLUSION</p><p>The two predictions do not seem to fail. One of the factors affecting the result here is that the entire dataset does not consist of English tweets. There are also Italian, French and Chinese words in the sentences. Apart from this, the sarcasm issue, which creates problems in all sentiment analysis processes, is also a factor here. There may be sentences that we label as joy but contain sarcasm, which will affect the success rate.</p><p>Apart from all these factors, the distribution of emoji in the dataset is the biggest problem. This problem has been tried to be solved by reducing the class, but still, since the classes are combined here, it cannot be said that the correct data set is fully formed.</p><p>You can download Jupyter notebook and csv file from <a href="https://github.com/OykuAkkoyun/EmojiPrediction">here</a>.</p><p>References</p><ol><li><a href="https://www.statista.com/chart/17275/number-of-emojis-from-1995-bis-2019/">https://www.statista.com/chart/17275/number-of-emojis-from-1995-bis-2019/</a></li><li><a href="https://www.semanticscholar.org/paper/Using-Neural-Networks-to-Predict-Emoji-Usage-from-Zhao-Zeng/453769b9e338a6ebf6026225515df8fb012a11e3">https://www.semanticscholar.org/paper/Using-Neural-Networks-to-Predict-Emoji-Usage-from-Zhao-Zeng/453769b9e338a6ebf6026225515df8fb012a11e3</a></li><li><a href="https://towardsdatascience.com/word2vec-research-paper-explained-205cb7eecc30">https://towardsdatascience.com/word2vec-research-paper-explained-205cb7eecc30</a></li><li><a href="https://towardsdatascience.com/mse-is-cross-entropy-at-heart-maximum-likelihood-estimation-explained-181a29450a0b">https://towardsdatascience.com/mse-is-cross-entropy-at-heart-maximum-likelihood-estimation-explained-181a29450a0b</a></li><li><a href="https://towardsdatascience.com/support-vector-machine-introduction-to-machine-learning-algorithms-934a444fca47">https://towardsdatascience.com/support-vector-machine-introduction-to-machine-learning-algorithms-934a444fca47</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=747597bb1224" width="1" height="1" alt=""><hr><p><a href="https://medium.com/turkcell/emoji-prediction-747597bb1224">Emoji Prediction</a> was originally published in <a href="https://medium.com/turkcell">turkcell</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>