<?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 SALSABILA BASALAMAH on Medium]]></title>
        <description><![CDATA[Stories by SALSABILA BASALAMAH on Medium]]></description>
        <link>https://medium.com/@salsabilabasalamah?source=rss-3edadd214748------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*X7PEFz7-Fsse0C8bJxexuA.jpeg</url>
            <title>Stories by SALSABILA BASALAMAH on Medium</title>
            <link>https://medium.com/@salsabilabasalamah?source=rss-3edadd214748------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 08:23:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@salsabilabasalamah/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[Unveiling the Power of Response Surface Methodology in Process Optimization]]></title>
            <link>https://salsabilabasalamah.medium.com/unveiling-the-power-of-response-surface-methodology-in-process-optimization-b0239643b796?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0239643b796</guid>
            <category><![CDATA[response-surface-method]]></category>
            <category><![CDATA[regression-modeling]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[quadratic-model]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Mon, 16 Sep 2024 07:41:32 GMT</pubDate>
            <atom:updated>2024-09-16T07:44:13.650Z</atom:updated>
            <content:encoded><![CDATA[<p>As we navigate an era of rapid growth, optimizing our time has become increasingly essential. Streamlining analysis processes and maximizing results from every step of production or research are now critical. Imagine a method that not only enhances efficiency in product testing but also clarifies the complex interactions between factors in a process. This is precisely where Response Surface Methodology (RSM) comes into play — a sophisticated technique poised to transform our approach to experimentation and optimization.</p><p>When creating top-quality products or reducing production costs without compromising the final result, RSM allows us to explore various possibilities through efficient experimental design, visualize how variables interact, and ultimately discover the optimal point that delivers the best outcomes. My experience in learning and applying RSM could be the key to making significant breakthroughs in data analysis work.</p><p>In this article, we will explore RSM’s benefits, the specific data structure we use, how it works, the challenges you may encounter, and examples of its application. Prepare to understand one of the most effective techniques in process optimization and see how RSM can transform the way you tackle complex challenges.</p><h3><strong>What is Response Surface Methodology?</strong></h3><p>Response Surface Methodology (RSM) is a statistical method consisting of experimental design and regression components. It is used to optimize and analyze the response (output) influenced by several independent variables.</p><h3>Benefits of Response Surface Methodology</h3><p>In short, the benefits of Response Surface Methodology are:</p><ol><li><strong>Efficiency: </strong>Reduces the number of experiments needed to find the optimal combination of variables.</li><li><strong>Accuracy:</strong> Provides a model that can predict the performance of the response.</li><li><strong>Optimization: </strong>Capable of performing processes to find the optimal value (maximum value).</li></ol><h3>Data Structure</h3><p>The data structure for this method is built with the help of experimental design. Many data structures can be used in RSM, but here I will briefly explain two common ones:</p><ol><li><strong>Box-Behnken Design (BBD):</strong> A type of experimental design that uses combinations of midpoints between the high and low limits of factors. Advantages of BBD: It requires fewer experiments, making it time- and resource-efficient.</li><li><strong>Central Composite Design (CCD):</strong> A type of experimental design that uses a combination of factorial points (low and high levels), axial points (outside the factorial limits), and center points to build an effective quadratic model.</li></ol><p>This article will focus more on the Box-Behnken Design, as illustrated in Fig 1, for three factors and the data matrix. The design consists of Factorial and Center points, with the Center point data collected three or five times, depending on the source. This gives us 15 rows of data (12 points for the factorial and 3 for the central point). When we have four factors, we will have 23 rows of data; with five factors, we will have 27 rows, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*8BsGeOrqtj7hBpgzuGSqKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-h7AzghS7vtcV_hbWFtlw.jpeg" /><figcaption><strong>Figure 1.</strong> Box-Behnken Design</figcaption></figure><p>The optimal point can only be determined in the second or quadratic order in optimization analysis. The first order is limited to understanding linear relationships, specifically how independent variables affect the response, while the Quadratic order estimates where the optimal point lies.</p><blockquote>Quadratic order can determine critical points and assess whether those vital points are maxima.</blockquote><h3><strong>Challenges in Determining the Optimum Point</strong></h3><p>The optimum point can be determined using a Response Surface plot, as shown in Fig 2. However, we may face dimensional limitations in the plot, which can only represent up to 3 dimensions. This means we can only use one response and two factors. In reality, more than two factors can influence a single reaction. Should we separate the factors, such as using factors 1 and 2 first, then factors 2 and 3, and finally factors 1 and 3? This could result in different optimization points and introduce an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*S_4WcCBajtWfi9g8" /><figcaption><strong>Figure 2.</strong> Response Surface plot</figcaption></figure><p>The solution to this issue is to use the Stationary Point. This point analyzes quadratic functions and determines optimization in high-dimensional space.</p><h3>Example of Application</h3><p>One of the applications I have previously worked on is the <a href="https://journal.stats.id/index.php/ijsa/article/view/817"><strong>Response Surface Model with Comparison of OLS Estimation and MM Estimation</strong></a>. This research used data from the snack-making process, where observations were made on frying temperature (X1), frying time (X2), and the percentage of peanut flour used in the mixture (X3). The purpose of observing these three variables was to optimize the snack’s expansion capacity.</p><p>For a more straightforward application, data will be created with two factors and one response. Many tools are available for this analysis, such as Matlab, Design-Expert, and the R language. This article will implement it using the R language and the “rsm” package.</p><pre>#install.packages(&quot;rsm&quot;)<br>library(rsm)<br><br># example response values<br>dataRSM &lt;- data.frame(<br>  x1 = c(-1, 1, -1, 1, 0, 0, 0),<br>  x2 = c(-1, -1, 1, 1, 0, 0, 0),<br>  y  = c(552, 549, 521, 595, 504, 502, 505) <br>)<br><br># Fitting Response Surface Model<br>fit &lt;- rsm(y ~ SO(x1, x2), data = dataRSM)<br>summary(fit)<br><br># Response Surface 3D plot<br>persp(fit, ~ x1 + x2, zlab = &quot;Response&quot;, col = &quot;lightpink&quot;)</pre><p>This syntax will generate the RSM model and Response Surface plot (Fig 3). The model can be evaluated using R-square and adj-R-square.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*FUe1WQL9KghTZFt060NR1Q.png" /><figcaption><strong>Figure 3.</strong> Response Surface plot in case study</figcaption></figure><p>For a case with three factors, the <strong>Stationary Point</strong> will be used to determine the optimal point due to the limitations of dimensional space.</p><blockquote><strong>Explanation</strong>: Visualizing and finding the exact optimal point in a three-dimensional response surface can be challenging due to the complexity of the space. The Stationary Point provides a mathematical approach to pinpointing the optimal condition by finding where the gradient of the response surface is zero. This technique helps efficiently locate the optimal settings for the factors involved, even when direct visualization is difficult.</blockquote><pre>&gt; fit &lt;- rsm(y ~ SO(x1, x2, x3), data = dataRSM)<br>&gt; summary(fit)<br><br>Call:<br>rsm(formula = y ~ SO(x1, x2, x3), data = dataRSM)<br><br>            Estimate Std. Error t value  Pr(&gt;|t|)    <br>(Intercept)  917.667     30.951 29.6486 8.185e-07 ***<br>x1            53.625     18.954  2.8292  0.036707 *  <br>x2           -75.625     18.954 -3.9900  0.010427 *  <br>x3            24.000     18.954  1.2662  0.261215    <br>x1:x2         74.250     26.805  2.7700  0.039364 *  <br>x1:x3          4.000     26.805  0.1492  0.887207    <br>x2:x3        -15.000     26.805 -0.5596  0.599891    <br>x1^2        -113.458     27.899 -4.0667  0.009665 ** <br>x2^2         -49.958     27.899 -1.7907  0.133350    <br>x3^2         -22.708     27.899 -0.8139  0.452684    <br>---<br>Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1<br><br>Multiple R-squared:  0.9129, Adjusted R-squared:  0.7562 <br>F-statistic: 5.826 on 9 and 5 DF,  p-value: 0.03333<br><br>Analysis of Variance Table<br><br>Response: y<br>                Df Sum Sq Mean Sq F value  Pr(&gt;F)<br>FO(x1, x2, x3)   3  73366 24455.4  8.5092 0.02078<br>TWI(x1, x2, x3)  3  23016  7672.1  2.6695 0.15868<br>PQ(x1, x2, x3)   3  54299 18099.7  6.2978 0.03762<br>Residuals        5  14370  2874.0                <br>Lack of fit      3   6453  2151.1  0.5434 0.69906<br>Pure error       2   7917  3958.3                <br><br>Stationary point of response surface:<br>         x1          x2          x3 <br>-0.04940772 -0.91778145  0.82720934 <br><br>Eigenanalysis:<br>eigen() decomposition<br>$values<br>[1]  -19.76071  -35.57803 -130.78626<br><br>$vectors<br>         [,1]       [,2]       [,3]<br>x1 -0.1365847 -0.4003069  0.9061451<br>x2 -0.3936901 -0.8174461 -0.4204640<br>x3  0.9090395 -0.4141693 -0.0459462</pre><h3>Conclusion</h3><p>In summary, Response Surface Methodology (RSM) provides a <strong>powerful tool for optimizing processes by modelling complex relationships between factors</strong>. Using RSM, as demonstrated with the RSM package in R, allows for practical analysis and visualization of these relationships, enhancing decision-making and process efficiency.</p><p>RSM remains a crucial technique in statistical modelling, offering valuable insights for improving systems and processes across various fields.</p><p>We hope this article proves useful and insightful. Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0239643b796" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improving Training Stability: Convolutional Neural Networks and Batch-Normalization Synergy]]></title>
            <link>https://salsabilabasalamah.medium.com/improving-training-stability-convolutional-neural-networks-and-batch-normalization-synergy-1bb6ad7a6d03?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bb6ad7a6d03</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[batch-normalization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Thu, 28 Sep 2023 05:40:25 GMT</pubDate>
            <atom:updated>2023-09-28T05:40:25.437Z</atom:updated>
            <content:encoded><![CDATA[<p>One thing never changes in the dynamic world of deep learning, where advancement occurs at an astounding rate: the quest for powerful and robust neural network training. Imagine setting out on a tour through the complex world of convolutional neural networks (CNNs), the foundation of contemporary computer vision. These networks have demonstrated an outstanding ability to interpret images, spot patterns, and make sense of the visual environment.</p><p>However, as you delve deeper into the realms of CNNs, you will encounter a crucial ally in your quest for excellence and efficiency: <strong>Batch-Normalization</strong>. It’s not just a technique; it’s a paradigm shift.</p><h3><strong>Convolutional Neural Network (CNN)</strong></h3><p>Convolutional neural networks (CNNs) are a particular kind of artificial neural network that researchers have created to process data with a grid-like structure, such as images and video. With layers of neurons that gradually extract hierarchical information from the incoming data, it closely resembles the human visual system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*T_ByDTHEOm_pCvF9CwXWjw.png" /><figcaption>Typical CNN</figcaption></figure><p>A typical CNN consists of multiple layers, including:</p><ul><li><strong>Convolutional Layers:</strong> These layers apply Convolutional procedures to the input data. To find details in a picture, like edges, textures, and patterns, they employ filters (kernels).</li><li><strong>Pooling Layers:</strong> To save computation and improve the network’s resilience, pooling layers actively lower the spatial dimensions of the feature maps produced by the convolutional layers.</li><li><strong>Fully Connected Layers:</strong> These layers flatten the feature maps and feed them into traditional neural network layers for classification or regression tasks.</li></ul><h3>Batch Normalization</h3><p>Batch Normalization (BatchNorm) is a technique used to improve profound neural networks’ training speed and stability. It operates by normalizing the input of a layer during training.</p><p>The critical steps in Batch Normalization are:</p><ol><li><strong>Normalization</strong>: BatchNorm normalizes the input to have zero mean and unit variance for each mini-batch, actively contributing to stabilizing the training process.</li><li><strong>Scaling and Shifting</strong>: BatchNorm offers learnable parameters (scaling and shifting) to modify the normalized data. As a result, the model can alter and improve its representation.</li></ol><h4>Imagine Training a CNN without Batch Normalization:</h4><p>Consider training a neural network to identify several fruit varieties in pictures. It’s similar to having a classroom full of pupils attempting to study individually without Batch Normalization. There is an imbalance in learning since some pupils pick things up fast while others find learning difficult. This imbalance may hinder learning in general and can make it more challenging to identify fruits correctly.</p><h4><strong>Now, Introduce Batch Normalization:</strong></h4><p>Batch Normalization intervenes like an astute teacher who keeps track of each pupil’s learning rate. It guarantees that each learner (neuron in the network) develops similarly. Batch Normalization pushes those neurons that learn too slowly to catch up. It advises preserving consistency if others are picking things up too rapidly. The entire classroom (the network) learns in harmony, and learning progresses more quickly and effectively.</p><p>These “wise tutors” (BatchNorm layers) in a Convolutional Neural Network with Batch Normalization are positioned thoughtfully between the network layers. They normalize the inputs at each training stage to ensure that the network learns quickly and smoothly.</p><h4><strong>The Outcome:</strong></h4><p>Your fruit identification network learns faster and is more reliable with batch normalization. As a result, it can manage faster learning rates and arrive at an accurate model more rapidly. The result is a neural network with enhanced training stability and speed that excels at differentiating fruits in photos.</p><p>To ensure that learning is effective and balanced, a Convolutional Neural Network with Batch Normalization is essentially like having the ideal teaching assistant in your classroom.</p><h3>Study Cases</h3><p>In the next real-world application, we examine a case study in which, using PyTorch and the MNIST database, we compare Convolutional Neural Networks (CNNs) to CNNs with Batch Normalization. The <a href="https://www.kaggle.com/datasets/hojjatk/mnist-dataset">MNIST dataset</a> comprises 60,000 training examples and 10,000 test examples of the handwritten digits 0–9, formatted as 28x28-pixel monochrome images.</p><pre># The image for the fourth data element<br>show_data(train_dataset[3])</pre><p>In this code:</p><ul><li>train_dataset refers to the dataset containing training data from the MNIST database.</li><li>[3] is an index, indicating that we want to access the fourth data element (Python uses 0-based indexing, so the fourth element corresponds to index 3).</li></ul><p>Then, the line show_data(train_dataset[3]) suggests that there is a function or method called show_data being called with the fourth data element from the MNIST training dataset as its argument.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*sX-_LqWzbFYf43VxvBcOdg.png" /></figure><p>This code shows or visually represents the fourth data piece in the MNIST dataset’s picture to analyze the dataset and verify the data format. The code sample does not provide the particular implementation of the show_data method and how it renders the view.</p><p>The full syntax is available on <a href="https://github.com/salsabilabasalamah/Deep_Neural_Networks_with_PyTorch/blob/main/CNN_with_Batch_Normalization.ipynb">my GitHub</a> website. I’ll concentrate on describing the process here. Two methods were employed to assess the outcomes: plotting the loss and accuracy and plotting the accuracy.</p><blockquote><strong>Loss Values:</strong> Loss values are a statistic for evaluating a neural network’s performance during training. In the context of the training process, minimizing this loss is typically the primary goal. A smaller loss number indicates that the model’s predictions on the training set are more accurate.</blockquote><p>The image below shows the output of Plotting the loss and accuracy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*ylrpXi06D2fGRiaMQhEtCw.png" /><figcaption>Output : plotting the loss and accuracy</figcaption></figure><ul><li><strong>Blue Line (loss normal CNN):</strong> The blue line in the plot represents the loss values for a “normal CNN” model, which implies a Convolutional Neural Network without Batch Normalization.</li><li><strong>Red Line (loss CNN with Batch Normalization):</strong> The red line illustrates the loss values for a “CNN with Batch Normalization” model, incorporating Batch Normalization layers into the CNN architecture.</li></ul><p>Based on the output, the “CNN with Batch Normalization” consistently maintains lower loss values throughout training, indicating better convergence and improved training stability.</p><p>In summary, the output demonstrates that incorporating Batch Normalization into the CNN architecture (as represented by the “CNN with Batch Normalization”) aids in achieving faster convergence, improved training stability, and ultimately lower loss values compared to a “normal CNN” model. This underscores the effectiveness of Batch Normalization in enhancing neural network training.</p><blockquote><strong>Accuracy </strong>measures how often a machine learning model makes correct predictions. It’s a vital indicator of the model’s performance, with higher accuracy indicating better predictive power.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*7nt9xwZtqABcnx_OS6zzqA.png" /></figure><p>The “Plot the accuracy” also improved the evaluation’s thoroughness. (Normal CNN) The red line continuously resides above the blue line. From epoch 0 through epoch 20, a total of 20 epochs, CNN with Batch Normalization constantly beats the standard CNN.</p><blockquote><strong>Epochs </strong>are the number of times a machine learning model iterates over the entire training dataset. They represent the model’s learning cycles and are vital in training accuracy and convergence.</blockquote><p>This finding shows that, throughout training and across several epochs, the CNN model with Batch Normalization continuously outperforms the standard CNN in terms of accuracy.</p><h3>Summary</h3><p>Our results are convincing and under our goal of comparing a Convolutional Neural Network (CNN) with Batch Normalization to a conventional CNN for categorizing handwritten digits from the MNIST database. Throughout our research, the CNN with Batch Normalization consistently showed superior performance, including quicker convergence, improved training stability, and increased accuracy. This result confirms that batch normalization is crucial in enhancing neural networks’ capabilities, making it an essential tool for image classification tasks like MNIST digit identification.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bb6ad7a6d03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cara Mengidentifikasi dan Penanganan Data Outlier]]></title>
            <link>https://salsabilabasalamah.medium.com/cara-mengidentifikasi-dan-penanganan-data-outlier-d2fe16c6d62c?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2fe16c6d62c</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[parametric]]></category>
            <category><![CDATA[non-parametric]]></category>
            <category><![CDATA[asumsi]]></category>
            <category><![CDATA[outliers]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Fri, 23 Oct 2020 10:22:33 GMT</pubDate>
            <atom:updated>2023-10-01T16:21:04.022Z</atom:updated>
            <content:encoded><![CDATA[<h3>Outliers Unveiled: A Practical Approach to Detection and Solutions</h3><p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*nFBGkH7ARTk_mjhxOy-qkQ.jpeg" /></figure><p>In this discussion, we delve into the intriguing realm of outliers — how to spot them, what signifies their presence, and the optimal strategies for dealing with these data mavericks. However, before venturing into the nuanced art of handling outlier-related challenges, we must acquaint ourselves with what outliers are.</p><h3>Outlier</h3><p>An outlier, or maverick, is an observation within a dataset that deviates in pattern or value from the rest of the statements. According to Kleinbum et al. (2008), an outlier is something rare or an unusual observation that emerges at one of the extremes within the dataset. Extremes, in words, are values that significantly differ or stand out from the majority of other deals in their group, such as being too small or too large.</p><blockquote>Let’s illustrate with a simple example: imagine a classroom where students’ exam scores are as follows — 50, 54, 62, 50, 52, 59, 61, 63, 65, 10, 53, 63, 65, 50, 59, 62, 50, 51, 57, 60, 63, 65, 65, 53, 99. Among these 25 students, two outliers stand out with extreme scores of 10 and 99, making them the distinctive outliers in this set of grades.</blockquote><h3>The Emergence of Outliers</h3><p>Outliers in a dataset can stem from various possibilities, including:</p><ul><li>Errors in the data entry procedure</li><li>Mistakes in measurement or analysis</li><li>An unknown factor can influence respondents’ perspectives, leading to a deviation even the researcher might not be aware of in exceptional circumstances.</li></ul><blockquote>“Outliers are data points that are far from other data points”</blockquote><h3>Identifying Outliers</h3><h4><strong>1. Scatter Plot</strong></h4><p>The advantage of this method lies in its ease of understanding, presenting data visually without involving complex calculations. However, relying solely on a scatter plot to determine outliers is not highly recommended, as deciding whether data is an outlier depends mainly on the researcher’s judgment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*_NaeucVxV6CJzBxBFyrKVA.jpeg" /><figcaption><strong>Image 1.</strong> Scatter Plot</figcaption></figure><h4>2. <em>Boxplot</em></h4><p>Metode <em>boxplot </em>merupakan metode grafik yang kedua dengan menggunakan nilai kuartil dari jangkauan.</p><figure><img alt="Gambar 2. Boxplot" src="https://cdn-images-1.medium.com/max/956/1*Hq3a3mKOpYxwND58fcQVmQ.jpeg" /><figcaption><strong>Image 2.</strong> Boxplot</figcaption></figure><p>Boxplot method is the second graphical method using quartile values within the range.</p><h4>3. Standardized Residual</h4><p>As the name suggests, standardized residuals are standardized residuals. The primary advantage of using standardized residuals is their independence from measurement units, as they are all standardized. If the residual of an observation is three times greater than the standard deviation (or the standardized residual is greater than 3), that observation can be considered an outlier.</p><h4>4. Cook&#39;s Distance</h4><p>One outlier detection method is Cook&#39;s distance. This method is designed to measure the change in the estimator of the Beta parameter when a specific observation is omitted. This method indicates the substantial influence of outliers on the results (Rawlings et al., 1998). The procedure involves calculations and the display of a plot.</p><h4>5. DFFITS Method (Difference Fitted Value FITS)</h4><p>DFFITS is used to determine the impact of a particular observation on the regression model in terms of its fitted value. After understanding how to identify the position of an outlier (nth observation), the thought of removing the outlier may arise, aiming to normalize the research data or eliminate outliers. However, this action is strongly discouraged because an outlier observation could significantly influence the dataset. If the removal or exclusion of outlier data is forced, the statistical equations and conclusions will substantially alter. Another suggestion often given to address outlier data is to &quot;transform the data,&quot; but this action frequently results in transformed data not meeting the underlying assumptions.</p><blockquote>Data Transformation is like giving your data a makeover — it’s a strategic effort to transform the scale of raw measurements into a more captivating form, ensuring that your data not only meets but dazzles the underlying assumptions.</blockquote><h4>What’s the Solution for Data Outliers?</h4><p>So, what should a researcher do to tackle this challenge? One approach is to swap our methods for more outlier-sensitive techniques, known as non-parametric methods.</p><blockquote>Parametric Statistics is the statistical art that considers the type of distribution or data spread — whether the data follows a normal distribution or not. Parametric statistics are used to test hypotheses and measurable variables. In other words, data analyzed using parametric statistics must adhere to the normality assumption.</blockquote><blockquote>On the other hand, Non-parametric Statistics is a testing ground where the models don’t dictate conditions about population parameters. Simply put, non-parametric statistics don’t demand measurements as stringent as their parametric counterparts.</blockquote><p>For instance, when we desire to employ multiple or straightforward regression analysis, but our data contains outliers, we can substitute it with robust research. Another example of using non-parametric statistics is replacing parametric t-tests with Mann-Whitney or Wilcoxon tests in non-parametric scenarios, and replacing parametric F-tests with Kruskal-Wallis tests in non-parametric settings, and so forth.</p><p>That concludes the explanation regarding issues with data identified to contain outliers, hoping it proves beneficial and insightful. Thank you.</p><h4>References</h4><ul><li>Kleinbum, D., Kupper, L., Nizam, A., &amp; Keith, M. 2008. <em>Applied Regression Analysis and Other Multivariable Methods</em>. USA: Thomson.</li><li>Rawlings, J. O., Pantula, S. G., &amp; Dickey, D. A. 1998. <em>Applied Regression Analysis:A Research Tool-Second Edition</em>. New York: Springer-Verlag.</li><li>Soemartini. 2007. <em>Pencilan (Outlier)</em>. Bandung: UNPAD.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2fe16c6d62c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Market Basket Analysis with R]]></title>
            <link>https://salsabilabasalamah.medium.com/market-basket-analysis-with-r-7104c09cedab?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/7104c09cedab</guid>
            <category><![CDATA[mba]]></category>
            <category><![CDATA[dataset]]></category>
            <category><![CDATA[groceries]]></category>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[market-basket-analysis]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 18:00:53 GMT</pubDate>
            <atom:updated>2019-07-09T18:00:53.696Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lDsuCxpR28kcX9ncryWLLw.jpeg" /></figure><h3>Introduction</h3><p>Market basket Analysis, ini bekerja dengan mencari kombinasi yang sering terjadi dalam transaksi. Dengan kata lain, ini adalah hubungan antara barang yang dibeli oleh konsumen. Aturan Asosiasi banyak digunakan untuk menganalisis keranjang ritel atau data transaksi, dan dimaksudkan untuk mengidentifikasi aturan-aturan kuat yang ditemukan dalam data transaksi menggunakan ukuran-ukuran menarik, berdasarkan konsep aturan-aturan kuat.</p><h3>Case Study</h3><p>Untuk lebih memahami Market basket Analysis penulis akan membuat sebuah studi kasus mengenai Market basket Analysis. Penulis menggunakan data Groceries Dataset. Langkah pertama adalah mengaktifkan package.</p><pre># Load the libraries<br>library(arules)<br>library(arulesViz)<br>library(datasets)</pre><p>Selanjutnya penulis memanggil dataset Groceries. Untuk memanggil penulis menggunakan script:</p><pre># Load the data set<br>data(Groceries)</pre><p>Kemudian penulis menampilkan frekuensi item untuk 20 item teratas dengan menggunakan plot.</p><pre># Create an item frequency plot for the top 20 items<br>itemFrequencyPlot(Groceries,topN=20,type=&quot;absolute&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgpI8yGZCnGNi7kq8uIARQ.png" /></figure><p>Berdasarkan frekuensi item teratas pada plot didapatkan item teratas adalah whole milk diikuti other vegetables dan peringkat ke 20 diisi dengan item domestic eggs. Selanjutnya membuat spesifikasi parameter. Penulis akan menentukan atau menetapkan minimum support yaitu 0.001, untuk minimum confidence adalah 0.8, kemudian akan menampilkan peringkat 5 teratas.</p><pre># Get the rules<br>rules &lt;- apriori(Groceries, parameter = list(supp = 0.001, conf = 0.8))</pre><pre># Show the top 5 rules, but only 2 digits<br>options(digits=2)<br>inspect(rules[1:5])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0R24cy-fN-AHX2V0pWUlfw.png" /></figure><p>Berdasarkan hasil output jika seseorang membeli yogurt dan sereal, 81% kemungkinannya akan membeli susu juga. Hasil output ini dapat memberikan info ringkasan, tentang aturan yang memberi penulis beberapa informasi menarik seperti:</p><ul><li>Jumlah aturan yang dihasilkan: 410</li><li>Distribusi aturan dengan panjang: Kebanyakan aturan panjangnya 4 item</li><li>Ringkasan ukuran kualitas: menarik untuk melihat rentang dukungan, daya angkat, dan kepercayaan diri.</li><li>Informasi tentang data yang ditambang: total data yang ditambang, dan parameter minimum.</li></ul><p>Setelah mendapatkan info ringkasan, selanjutnya adalah mencari jawaban dari pertanyaan “Apa yang cenderung dibeli pelanggan sebelum membeli susu murni?” atau pertanyaan “Apa yang mungkin pelanggan beli jika mereka membeli susu murni?”. Untuk mendapatkan jawaban dari pertanyaan ini kita membutuhkan penargetan item. Pada dasarnya berarti dibutuhkan mengatur Sisi Kiri dan Sisi Kanan. Menjawab pertanyaan pertama kita menyesuaikan fungsi apriori () kami sebagai berikut:</p><pre>rules&lt;-apriori(data=Groceries, parameter=list(supp=0.001,conf = 0.08), <br>               appearance = list(default=&quot;lhs&quot;,rhs=&quot;whole milk&quot;),<br>               control = list(verbose=F))<br>rules&lt;-sort(rules, decreasing=TRUE,by=&quot;confidence&quot;)<br>inspect(rules[1:5])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*YpOBIdmiiolxRlBGcvxyww.png" /></figure><p>Penulis dapat mengatur sisi kiri menjadi “whole milk” dan menemukan antesedennya. Aturan yang ditetapkan penulis adalah keyakinan ke 0,15 karena penulis tidak mendapatkan aturan dengan 0,8 dan menetapkan panjang minimum 2 untuk menghindari item sisi kiri kosong.</p><p>Langkah terakhir adalah menampilkan secara visualisasi. Katakanlah ingin memetakan aturan dalam grafik. Dapat melakukannya dengan perpustakaan lain yang disebut “arulesViz”.</p><pre>### Visualization<br>library(arulesViz)<br>plot(rules,method=&quot;graph&quot;,interactive=TRUE,shading=NA)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JlCrns48u0n1HD8sA5mFhQ.png" /></figure><p>Untuk <em>script</em> R yang lebih lengkap dapat diperoleh <a href="https://github.com/salsabilabasalamah/Market-Basket-Analysis/blame/master/Groceries%20Dataset"><em>disini</em></a>!!</p><p><a href="https://github.com/salsabilabasalamah/Market-Basket-Analysis/blame/master/Groceries%20Dataset">salsabilabasalamah/Market-Basket-Analysis</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7104c09cedab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping in R]]></title>
            <link>https://salsabilabasalamah.medium.com/web-scraping-in-r-7d6748defbf0?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d6748defbf0</guid>
            <category><![CDATA[garuda-indonesia]]></category>
            <category><![CDATA[scraping]]></category>
            <category><![CDATA[trivago]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[comment]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 13:01:40 GMT</pubDate>
            <atom:updated>2019-07-09T13:01:40.070Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*2g0D-iqjtHOoLmz2.jpeg" /></figure><blockquote><em>Web scraping is one of the most robust and reliable ways of getting web data from the internet.</em></blockquote><p>Data and information on the web is growing exponentially. All of us today use Google as our first source of knowledge — be it about finding reviews about a place to understanding a new term. All this information is available on the web already.</p><h3>What is Web Scraping?</h3><p>Scraping the Web (also called Screen Scraping, Web Data Extraction, Web Harvesting etc.) is a technique used to extract large amounts of data from websites where data is extracted and stored to local files on your computer or to databases in tables (spreadsheet format). <strong>Web scraping is the process of extracting data from a website.</strong> One example of web scraping is copying contact lists from a web directory.</p><h3>Why do we need Web Scraping?</h3><p>With the development of Big Data, the amount of data available is no longer counted. Imagine if we had to store a large amount of data alone in one file, what happened was only a mistake and a headache. <strong>Web scraping can help you to collect data faster.</strong> In addition, if indeed the data collected is large, we can also do automation and we don’t need to bother anymore because the important thing is we can let our server run. <strong>With the efficiency of web scraping, this also helps our data analysis process.</strong> Because web scraping helps collect all data without being left behind, we will get complete data from this process.</p><h3>Example Web Scraping with R</h3><p>Web scraping will be done on the <a href="https://www.tripadvisor.co.id/">Tripadvisor</a> website on the <a href="https://www.tripadvisor.com/Airline_Review-d8729079-Reviews-Garuda-Indonesia#REVIEWS">Garuda Indonesia page.</a> Comments will be taken to find out reviews of Garuda Indonesia flight usage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jmW369IqDSloYfGBjcFmVQ.png" /></figure><p>Now let’s understand how the packages we’re going to use will be installed. With Script will be used to go to the Garuda Indonesia page URL on tripadvisor.</p><pre># Parsing of HTML/XML fileslibrary(rvest)#search for Garuda Indonesia pages on tripadvisorurl&lt;-read_html(&quot;https://www.tripadvisor.com/Airline_Review-d8729079-Reviews-Cheap-Flights-Garuda-Indonesia#REVIEWS&quot;)</pre><p>Hadley Wickham authored the rvest package for web scraping in R. rvest is useful in extracting the information you need from web pages. Along with this, you also need to install the stringr packages.</p><pre>library(stringr)</pre><p>rvest contains the basic web scraping functions, which are quite effective. Using the following functions, we will try to extract the data from web sites.</p><ul><li>read_html(url) : scrape HTML content from a given URL</li><li>html_nodes(): identifies HTML wrappers.</li><li>html_nodes(“.class”): calls node based on CSS class</li><li>html_nodes(“#id”): calls node based on &lt;div&gt; id</li><li>html_nodes(xpath=”xpath”): calls node based on xpath (we’ll cover this later)</li><li>html_attrs(): identifies attributes (useful for debugging)</li><li>html_table(): turns HTML tables into data frames</li><li>html_text(): strips the HTML tags and extracts only the text</li></ul><p>Most large companies have several review pages. On this page has 363 pages of reviews. Where one review page contains 10 comments. After getting to know the page Scraping Web process can be done, by taking html_node for each desired variable where the variables to be taken are id, quote, rating, date, review, and flights. To retrieve html_nodesusing SelectorGadget.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*uoP8AsJQb5ImEVYW.jpeg" /></figure><p>Variable description:</p><ul><li>Id: contains the id of the comment author</li><li>Quote: Quote in the comment</li><li>Rating: rating from 1 to 5</li><li>Date: date comment sent</li><li>Review: content of comments</li><li>Flights: Flight destination comment maker</li></ul><p>All of these variables will be stored in a data frame named tableout.</p><pre># starting from page i until afor (i in seq_along(a)) {<br>  res[i]&lt;-a[i]*b  <br>}<br>tableout&lt;-data.frame() # prepare data frame for tableout<br>for (i in res) {<br>  cat(&quot;.&quot;)<br>url&lt;-paste(&quot;https://www.tripadvisor.com/Airline_Review-d8729079-Reviews-Cheap-Flights-or&quot;,i,&quot;Garuda-Indonesia#REVIEWS&quot;,sep = &quot;&quot;)reviews&lt;-url%&gt;%html()%&gt;%html_nodes(&quot;#REVIEWS .innerBubble&quot;)...<br>id&lt;-reviews%&gt;%<br>    html_node(&quot;.quote a&quot;)%&gt;%<br>    html_attr(&quot;id&quot;)<br>review&lt;-reviews%&gt;%<br>    html_node(&quot;.entry .partial_entry&quot;)%&gt;%<br>    html_text()<br>...reviewnospace&lt;-gsub(&quot;\n&quot;,&quot;&quot;,review)<br>  temp.tableout&lt;-data.frame(id,quote,rating,date,reviewnospace,flight)<br>  tableout&lt;-rbind(tableout,temp.tableout)}<br>View(tableout)</pre><p>The results of scraping data are then stored in a CSV file with the file name Garuda Indonesia</p><pre>write.csv(tableout,&quot;...//Garuda Indonesia.csv&quot;)<br>save.image()</pre><p>Then you have scraping results data on the Garuda Indonesia page on tripadvisor. The results of this data can then be used for analysis.</p><p>As you can see, R can give you great leverage in scraping data from websites. With this practical illustration of how R can be used, you can now explore it on your own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d6748defbf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cluster Analysis in R]]></title>
            <link>https://salsabilabasalamah.medium.com/cluster-analysis-in-r-fb715df4fc69?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb715df4fc69</guid>
            <category><![CDATA[cluster-analysis]]></category>
            <category><![CDATA[cluster]]></category>
            <category><![CDATA[kelompok]]></category>
            <category><![CDATA[hierarchy]]></category>
            <category><![CDATA[plot]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 05:37:48 GMT</pubDate>
            <atom:updated>2021-08-07T16:13:11.776Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Metode Hirarki Cluster (</strong>Membuat Grafik Dendrogram)</h4><p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxJKGyJPnnEleNzEZzyR3g.jpeg" /></figure><p>Clustering analysis merupakan metode pengelompokkan setiap objek ke dalam satu atau lebih dari satu kelompok,sehingga tiap objek yang berada dalam satu kelompok akan memiliki nilai interaksi yang sama. Clustering analysisbertujuan untuk membentuk kelompok dengan karakteristik yang sama. (Sharma, 1996)</p><blockquote>Tujuan dari Analisis Cluster adalah <strong>mengelompokkan obyek berdasarkan kesamaan karakteristik</strong> di antara obyek-obyek tersebut.</blockquote><h3>Metode Analisis Cluster</h3><p>Adapun metode pengelompokan dalam analisis cluster meliputi :</p><ul><li><strong>Metode Hirarkis </strong>memulai pengelompokan dengan dua atau lebih obyek yang <strong>mempunyai kesamaan paling dekat</strong>. Kemudian diteruskan pada obyek yang lain dan seterusnya hingga cluster akan membentuk semacam ‘pohon’ dimana terdapat tingkatan (hirarki) yang jelas antar obyek, dari yang paling mirip hingga yang paling tidak mirip. Alat yang membantu untuk memperjelas proses hirarki ini disebut “dendogram”.</li><li><strong>Metode Non-Hirarkis</strong> dimulai dengan menentukan terlebih dahulu <strong>jumlah cluster yang diinginkan </strong>(dua, tiga, atau yang lain). Setelah jumlah cluster ditentukan, maka proses cluster dilakukan dengan tanpa mengikuti proses hirarki. Metode ini biasa disebut “K-Means Cluster”.</li></ul><blockquote>K-mean kluster sangat efektif dan efisien jika <strong>digunakan untuk mengelompokkan objek yang berjumlah besar</strong>. K-mean cluster digunakan untuk objek yang berjumlah lebih dari 100.</blockquote><h3>Membuat Analisi Cluster dengan R</h3><p>Penulis akan membuat grafik dendrogram menggunakan R. Data yang digunakan Data Global Slavery Index. Langkah pertama adalah melakukan install package dan mengaktifkan.</p><pre>### Package yang digunakan<br>library(cluster)<br>library(dendextend)<br>library(factoextra)</pre><p>Selanjutnya melakukan input data di R dan menampilkan gambaran data Global Slavery Index dengan menggunakan plot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6l0ERxQ4ZX8BIuDYv5pzw.png" /></figure><p>Dalam metode hirarki cluster terdapat dua tipe dasar yaitu <strong><em>agglomerative </em></strong>(pemusatan) dan <strong><em>divisive</em></strong> (penyebaran). Dalam metode <strong><em>agglomerative</em></strong>, setiap obyek atau observasi dianggap sebagai sebuah cluster tersendiri. Dalam <em>agglomerative</em> ada lima metode yang cukup terkenal, yaitu : <strong><em>Single Linkage, Complete Linkage</em></strong>, <strong><em>Average Linkage</em></strong>, <strong><em>Ward’s Method</em></strong>, <strong><em>Centroid Method</em></strong>. Penulis akan menggunakan beberapa merode<strong> </strong><em>agglomerative.</em></p><pre>## Metode Single<br>hasil&lt;-hclust(dist(data),&quot;single&quot;)</pre><pre>##  Metode Compla<br>hasil&lt;-hclust(dist(data),&quot;complete&quot;)</pre><pre>## Metode Average<br>hasil&lt;-hclust(dist(data),&quot;average&quot;)</pre><ul><li><strong>Metode<em> Single </em></strong>didasarkan pada <strong>jarak terkecil</strong>. Jika dua obyek terpisah oleh jarak yang pendek maka kedua obyek tersebut akan digabung menjadi satu cluster daan demikian saterusnya.</li><li><strong>Metode<em> Complete</em></strong>, berlawanan dengan <strong><em>metode Single </em></strong>prosedur ini pengelompokkannya berdasarkan <strong>jarak terjauh</strong>.</li><li><strong>Metode<em> Average </em></strong>digunakan adalah <strong>rata-rata jarak</strong> seluruh individu dalam suatu cluster dengan jarak seluruh individu dalam cluster yang lain.</li></ul><p>Setelah mencoba beberapa metode, penulis akan memilih metode terbaik dari data yang dimiliki. Dalam pemilihan <strong>metode terbaik dapat dilihat dari persebaran pengelompokan yang paling merata dari masing-masing metode</strong>. Penulis akan menggunakan plot dan menampilkan hasil penyebaran di tiap kelompok yang dibagi menjadi 3.</p><pre>## Menampilkan plot<br>plot(hasil, col=&quot;green&quot;)</pre><pre>## Membagi menjadi 3 kelompok<br>rect.hclust(hasil,k=3,border=2:3)<br>hasil.cut&lt;-cutree(hasil,3)</pre><pre>## Menampilkan jumlah pembagian tiap kelompok<br>table(hasil.cut)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SEN2BMfKO1Bh00TulWP9fw.png" /></figure><p>Pada metode single pada kelompok 1 sebanyak 165, kelompok 2 sebanyak 1, dan kelompok 3 sebanyak 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNud_wo9hnbmDf7E5HgJaw.png" /></figure><p>Pada metode complete pada kelompok 1 sebanyak 45, kelompok 2 sebanyak 46, dan kelompok 3 sebanyak 76.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_t8WXZdJurDwD0RUgIY7w.png" /></figure><p>Pada metode average pada kelompok 1 sebanyak 87, kelompok 2 sebanyak 79, dan kelompok 3 sebanyak 1. Berdasarkan pembagian kelompok pada masing-masing metode dapat dilihat pembagian pada metode complete adalah pembagian yang lebih merata dibandingkan metode lainnya, sehingga metode ini dijadikan metode terbaik.</p><p>Langkah berikutnya adalah penulis melihat jumlah cluster yang optimal menggunakan metode LBOOK.</p><pre>fviz_nbclust(data, FUN=hcut,method = &quot;wss&quot;) <br>fviz_nbclust(data, FUN=hcut,method = &quot;silhouette&quot;,hc_method=&quot;complete&quot;)</pre><p>Script diatas adalah script yang digunakan untuk menampilkan jumlah clster optimal pada data ini. Method wss adalah nilai variansi masing-masing cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UB6npSckyL7sBiCaBDxc3g.png" /></figure><p>Berdasarkan hasil plot cluster optimum didapatkan k optimum berada di 2, sedangkan untuk</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ey2jMqYwceauFR9bCv2qvQ.png" /></figure><pre>##hasilnya k=3 dengan nilai tertinggi yang bagian x, k=3<br>data2.dist&lt;-dist(data2, method = &quot;euclidean&quot;)<br>hc1&lt;-hclust(data.dist, method = &quot;complete&quot;)<br>hc2&lt;-hclust(data.dist, method = &quot;average&quot;)<br>## bisa metodenya complate, dan ward.D2</pre><pre>dend1&lt;-as.dendrogram(hc1)<br>dend2&lt;-as.dendrogram(hc2)<br>dend_list&lt;-dendlist(dend1,dend2)</pre><pre>## bagi tempat plot menjadi 2<br>par(mfrow=c(1,2))<br>plot(hc1, hang = -1)<br>plot(hc2, hang = -1)<br>## melihat lebih jelas perbedaan berdasrakan terbelitnya atau jalurnya<br>tanglegram(dend1, dend2)<br>##lihat nilai terbelitnya<br>tanglegram(dend1, dend2, main = paste(&quot;entanglemet=&quot;, round(entanglement(dend_list),2)))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PFC9XIrGhjPoGfO8FBPiA.png" /></figure><p>Gambar diatas merupakan hasil visualisasi klaster menggunakan metode complete dan average, plot ini menggambarkan perbandingan dari keduanya.</p><blockquote>Script lebih lengkap klik <a href="https://github.com/salsabilabasalamah/Cluster-Analysis/blob/master/Metode%20Hirarki%C2%A0Cluster">disini </a>!!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb715df4fc69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Membangun Halaman Web Sederhana]]></title>
            <link>https://salsabilabasalamah.medium.com/membangun-halaman-web-sederhana-622cb1db2420?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/622cb1db2420</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[website]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 15:36:10 GMT</pubDate>
            <atom:updated>2020-07-09T14:48:07.050Z</atom:updated>
            <content:encoded><![CDATA[<h4>Menggunakan PHP dan MySQL</h4><p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBbFgm6Dtay6aT-ENxxfLA.png" /></figure><p>Web adalah aplikasi yang disimpan dan dieksekusi di lingkungan web <em>server</em>. Setiap permintaan yang dilakukan oleh <em>user</em> melalui aplikasi klien (web <em>browser</em>) akan direspon oleh aplikasi web dan hasilnya akan dikembalikan lagi ke hadapan <em>user</em>.</p><h3>Bagaimana Cara Membangun Web?</h3><p>Dalam membangun sebuah web kita membutuhkan kerja sama antara PHP, Apache, dan MySQL.</p><ul><li><strong>PHP </strong>ketika dipanggil dari web <em>browser</em>, <strong>program yang ditulis dengan PHP akan di-parsing di dalam web <em>server</em> oleh interpreter PHP dan diterjemahkan ke dalam dokumen HTML</strong>, yang selanjutnya akan ditampilkan kembali ke web <em>browser</em>. Karena pemrosesan program PHP dilakukan di lingkungan web<em> server</em>, PHP dikatakan sebagai bahasa sisi <em>server </em>(<em>server-side</em>). Dengan kata yang lebih sederhana <strong>PHP adalah bahasa script atau kode yang digunakan untuk mengkoneksikan ke database.</strong></li><li>Salah satu <strong>Web server</strong> yang <strong>bersifat <em>open source</em></strong> atau masih bersifat lokal (didalam pc) adalah <strong>Apache</strong>. Ketika seseorang hendak mengakses suatu website, ia harus memasukkan nama domain ke kolom alamat pada <em>browser</em>. Setelah itu, web <em>server </em>akan mengirimkan file yang diminta. Dalam hal ini, server berperan sebagai pengirim <em>virtual</em>. Sehingga, web server adalah sebuah server yang memberikan layanan berbasis data dan berfungsi menerima permintaan dari HTTP atau HTTPS.</li><li><strong>MySQL</strong> merupakan sebuah perangkat lunak /<em>software </em>sistem manajemen basis data SQL atau DBMS Multithread dan multi <em>user</em>. MySQL sebenarnya merupakan turunan dari<strong> salah satu konsep utama dalam database</strong> untuk pemilihan atau seleksi dan pemasukan data yang memungkinkan pengoperasian data dikerjakan secara mudah dan otomatis. Sehingga, MySQL adalah tempat penampungan inputan yang berasal dari web server.</li></ul><blockquote>Perlu diingat bahwa <strong>MySQL dan Apache merupakan software yang berbeda dan tidak saling berkaitan</strong> serta dikembangkan oleh vendor yang berbeda. Cara cepat yang dapat digunakan untuk <strong>memasang atau mengaktifkan PHP dan Apache adalah dengan menggunakan XAMPP</strong>.</blockquote><h3>Pembuatan Web</h3><p>Kali ini kita akan membuat salah satu contoh web yang menampilkan data dari database. Kita akan membuat sebuah tampilan data buku dimana nantinya data buku dapat dicari dan <em>sort</em> berdasarkan variabel data. Tabel yang akan dibuat mengunakan data tables dan tampilan web akan ditambah dengan menggunakan css dan javascript. Tabel yang akan dibuat terdiri dari beberapa variabel atau field serta tipe data sebagai berikut:</p><ul><li><strong>Id </strong>dengan menggunakan type data Integer</li><li><strong>Penulis</strong> dengan menggunakan type data Varchar</li><li><strong>Penerbit</strong> dengan menggunakan type data Varchar</li></ul><blockquote>Integer adalah tipe data yang mempresentasikan bilangan bulat.</blockquote><p>Langkah pertama adalah mengaktifkan Apache dan MySQL menggunakan XAMPP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*nqECo1gwpiPOVUdLi8qItw.png" /></figure><p>Selanjutnya membuat database, pembuat database berada di localhost. Database yang akan dibuat bernama buku dan nama tabel penulis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhBEJQNj0s740kAirhT1Xw.png" /></figure><p>Setelah membuat database, selanjutnya menyusun kode-kode untuk membangun web. File php pertama yang dibuat adalah index.php. Dalam file index.php terdiri dari:</p><pre><strong>&lt;!-- kode php --&gt;</strong></pre><pre>&lt;?php <br>include &#39;koneksi.php&#39;;<br>?&gt;</pre><p>Kode diatas merupakan tag dalam php, perintah atau tag include untuk memanggil koneksi database dimana database akan dikoneksikan menggunakan kode-kode yang berada dalam file koneksi.php.</p><pre><strong>&lt;!-- Kode header atau judulnya --&gt;</strong><br>&lt;h3&gt;Form Pencarian&lt;/h3&gt;</pre><pre><strong>&lt;!-- kode cdn--&gt;</strong></pre><pre>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<a href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css</a>&quot;&gt; </pre><pre>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<a href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css</a>&quot;&gt;  </pre><p>Kode diatas merupakan kode yang terdiri dari judul dan cdn. <strong>cdn</strong> <strong>digunakan untuk manggil kodingan secara online</strong>, kali ini penulis akan memanggil koding css. <strong>css adalah terdiri dari kode-kode untuk mempercantik tampilan</strong> suatu web. Untuk link pertama merupakan css untuk data tabel dan untuk link kedua merupakan css untuk data bootstrap.</p><blockquote><strong>Bootstrap</strong> adalah sebuah library frame work css yang dibuat kusus untuk pengembangan website.</blockquote><p>Langkah berikutnya adalah membuat tabel, dalam pembuatan tabel dimulai dari pemubuatan kepala tabel, untuk membuat tabel dimulai dengan tag &lt;table&gt; dan diakhiri &lt;/table&gt;.</p><pre><strong>&lt;!-- membuat tabel dan kepala tabel--&gt;</strong></pre><pre>&lt;table id=&quot;myTable&quot; class=&quot;display&quot;&gt; <br> &lt;thead&gt; <br>  &lt;tr&gt;<br>   &lt;th&gt;No&lt;/th&gt; <br>   &lt;th&gt;Penulis&lt;/th&gt;<br>   &lt;th&gt;Penerbit&lt;/th&gt;<br>  &lt;/tr&gt;<br> &lt;/thead&gt;</pre><p>Keterangan tag yang digunakan pada kode diatas sebagai berikut:</p><ul><li>&lt;thead&gt; digunakan untuk memulai menuliskan kepala tabel</li><li>&lt;tr&gt; adalah tabel row untuk membuat baris baru</li><li>&lt;th&gt; tag ini digunakan untuk penamaan variabel pada kepala tabel</li></ul><p>Setelah membuat kepala tabel dan menutup kepala tabel dengan &lt;/tag&gt; selanjutnya pembuatan badan tabel. Pembuatan badan tabel menggunakan tag &lt;tbody&gt; dan menutup dengan &lt;tbody&gt; .</p><pre><strong>&lt;!-- kode badan tabel--&gt;</strong></pre><pre>&lt;tbody&gt; <br> &lt;?php <br> $no = 1;<br> $data = $kon-&gt;query(&quot;SELECT * FROM penulis&quot;);<br> foreach ($data as $d) {<br>  ?&gt;<br>  &lt;tr&gt; <br>   &lt;td&gt;&lt;?php echo $no++; ?&gt;&lt;/td&gt; <br>   &lt;td&gt;&lt;?php echo $d[&#39;penulis&#39;]; ?&gt;&lt;/td&gt;<br>   &lt;td&gt;&lt;?php echo $d[&#39;penerbit&#39;]; ?&gt;&lt;/td&gt;<br>  &lt;/tr&gt;<br> &lt;?php } ?&gt;<br> &lt;/tbody&gt;<br>&lt;/table&gt;</pre><p>Keterangan tag yang digunakan pada kode badan tabel diatas sebagai berikut:</p><ul><li>&lt;td&gt; digunakan untuk memasukkan data</li><li>query(&quot;SELECT * FROM penulis”)artinya memberikan perintah (query) untuk mengambil semua kolom yang ada ditabel penulis.</li></ul><pre><strong>&lt;!-- kode script --&gt;</strong></pre><pre>&lt;script <br>  src=&quot;<a href="https://code.jquery.com/jquery-3.4.1.js">https://code.jquery.com/jquery-3.4.1.js</a>&quot;<br>  integrity=&quot;sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=&quot;<br>  crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;<a href="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js">https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js</a>&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;<a href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js</a>&quot;&gt;&lt;/script&gt;<br>&lt;script type=&quot;text/javascript&quot;&gt;<br> $(document).ready( function () {<br>  $(&#39;#myTable&#39;).DataTable();<br> } );<br>&lt;/script&gt;</pre><p>Kode diatas adalah kode terakhir yang ada didalam file index.php. Kode ini merupakan kode script. Script adalah untuk membuka tag javascript. Kemudian kode $(&#39;#myTable&#39;) ini fungsi untuk memanggil (excute) data tabel.</p><p>File kedua yang dibuat adalah file koneksi.php. Kode dalam koneksi.php sebagai berikut.</p><pre><strong>&lt;!-- kode koneksi.php--&gt;</strong></pre><pre>&lt;?php<br>$kon = mysqli_connect(&#39;localhost&#39;,&#39;root&#39;,&#39;&#39;);<br>$link = mysqli_select_db($kon,&quot;buku&quot;) or die(mysqli_error());<br>?&gt;</pre><p>Pada kode diatas menunjukan perintah $kon adalah untuk memisalkan bahwa “mysqli_connect(‘localhost’,’root’,’’)” adalah $kon . Untuk perintah mysqli_connect digunakan untuk menghubungkan ke server web. Sedangkan, mysqli_select_db digunakan untuk menghubungkan koneksi ke database. Hasil dari kode-kode pada file index.php dan koneksi.php beserta database yang dibuat menghasilkan tampilan web sebagai berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_nQeZ8eBGiI-oU6PJ1egw.png" /></figure><p>Untuk penambahan data pada web dapat penulis lakukan dengan menambah pada database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=622cb1db2420" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Artificial Neural Network Part 2]]></title>
            <link>https://salsabilabasalamah.medium.com/artificial-neural-network-part-2-644a7af4d073?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/644a7af4d073</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-neural-network]]></category>
            <category><![CDATA[ann]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Fri, 21 Jun 2019 11:51:31 GMT</pubDate>
            <atom:updated>2019-06-21T11:51:31.848Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*d9_pXyLAuQyz0nGv_18upg.jpeg" /></figure><blockquote>“Neural network adalah model yang terinspirasi oleh bagaimana neuron dalam otak manusia bekerja. Tiap neuron pada otak manusia saling berhubungan dan informasi mengalir dari setiap neuron tersebut.”</blockquote><h3>Cara Kerja Neural Network</h3><p>Neural Network memproses informasi berdasarkan cara kerja otak manusia. Dalam hal ini Neural Network terdiri dari sejumlah besar elemen pemrosesan yang saling terhubung dan <strong>bekerja secara paralel untuk memecahkan suatu masalah tertentu</strong>. Di sisi lain, komputer konvensional menggunakan pendekatan kognitif untuk memecahkan masalah; dimana cara pemecahan masalah haruslah sudah diketahui sebelumnya untuk kemudian dibuat menjadi beberapa instruksi kecil yang terstruktur. Instruksi ini kemudian dikonversi menjadi program komputer dan kemudian ke dalam kode mesin yang dapat dijalankan oleh komputer.</p><blockquote>Pembahasan lainnya mengenai Artificial Neural Network dapat dipelajari di <a href="https://medium.com/@salsabilabasalamah/artificial-neural-network-296e3a525b9e">sini</a>!!!</blockquote><ul><li><a href="https://medium.com/@salsabilabasalamah/artificial-neural-network-296e3a525b9e">Artificial Neural Network</a></li><li><a href="https://medium.com/@salsabilabasalamah/cross-validation-of-an-artificial-neural-network-f72a879ea6d5">Cross Validation of an Artificial Neural Network</a></li></ul><h3>Studi Kasus</h3><p>Penulis akan membuat sebuah contoh Artificial Neural Network (ANN) dengan menggunakan data tentang pemilihan rekreasi memancing atau data Fishing, data sebagai berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*Je_AYHEORRmRGqdY0vnPGg.png" /></figure><p>Dari data ini akan di gunakan variabel mode, price, catch, income. Kemudian jadikan variabel mode sebagai targetnya. Jika price = 50.32, catch = 0.0451 dan income = 4583.332, apakah pilihan mode rekreasi memancingnya? Untuk menyelesaikan studi kasus ini praktikan kemudian akan menggunakan Artificial Neural Network (ANN) sebagai berikut:</p><p>Langkah pertama adalah menginput data pada R. Untuk input data Fishing, perintah yang akan digunakan adalah read.csv.</p><pre>fishing&lt;- read.csv(“…\\Fishing.csv”)<br>View(fishing)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*V4oWv8cLxNy3LGH_BmE7Ow.png" /></figure><p>Berdasarkan hasil dapat dilihat bentuk data, dimana data terdiri dari 13 variabel dan 1182 banyaknya baris data. Selanjutnya penulis akan memilih variabel yang dibutuhkan yaitu 4 variabel. Keempat variabel tersebut adalah mode, price, catch, dan income. Untuk memilih variabel-variabel ini praktikan menggunakan perintah data.frame(). Sebagai berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*7Kg5jL4aN6dxc3FgaYB_qA.png" /></figure><p>Berdasarkan data pada gambar penulis memberikan nama untuk keempat variabel tersebut dengan nama fishing. Kemudian penulis juga menampilkan tipe data yang dimiliki, dapat dilihat pada gambar variabel mode memiliki tipe data faktor, kemudian untuk variabel price, catch dan income merupakan variabel yang memiliki tipe data numerik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*IxvbyR1Fj74SRmqKo2wbiQ.png" /></figure><p>Data mode adalah data tempat rekreasi memancing dimana terdapat empat jenis tempat beach, boat, charter, dan pier. Selanjutnya penulis menampilkan sampel yang diambil dari berdasar mode pada model. Hasil sampel seperti gambar berikut.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*2HsUNcR3Y96yfLAUhIgoJA.png" /></figure><p>Setelah mendapatkan sampel penulis kemudian membuat pembagian data <em>train </em>dan <em>test</em>, menggunakan <em>script</em>:</p><pre>fishing.train &lt;-fishing[sampel,]<br>fishing.test&lt;-fishing[-sampel,]</pre><blockquote><strong>Apa itu Data <em>Train </em>dan <em>Data Test ?</em></strong></blockquote><blockquote><strong>Data <em>train</em> </strong>adalah data <strong>yang kita latih</strong> untuk membuat prediksi atau algoritma Machine Learning lainnya sesuai tujuannya masing-masing. Sedangkan, <strong>data<em> test</em></strong><em> </em>adalah data <strong>yang kita tes</strong> untuk melihat keakuratannya.</blockquote><p>Setelah selesai melakukan pembagian data <em>train</em> dan <em>test </em>maka penulis akan melakukan Artificial Neural Network, dengan menggunakan <em>package</em> nnet, maka penulis melakukan pengaktifkan <em>package</em> nnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*eGQepjJ-HavbwxgB9YXY0Q.png" /></figure><p>Selanjutnya penulis kemudian menampilkan plot ANN yang terdiri dari <em>input, node, </em>bias, dan<em> output</em>, untuk studi kasus ini memiliki plot sebagai berikut.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*V3b0BLpoMUrwkGspkCTBAw.png" /></figure><p>Berdasarkan hasil diatas dapat dilihat ada 3 <em>input</em> yang kemudian disaring atau terdapat node sebanyak 5, kemudian memiliki nilai bias atau <em>error</em> sebanyak 2. <em>Input</em> node dan bias ini menghasilakan 4 <em>output</em>. Dimana keempat <em>output</em> itu adalah beach, boat, charter, dan pier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*mPgHkKEymTc66HJUJnXyRw.png" /></figure><p>Pada gambar diatas merupakan hasil tampilan nilai bobot dari data. Kemudian penulis akan memasukkan data baru, dimana data baru itu adalah price = 50.32, catch = 0.0451 dan income = 4583.332. Setelah memasukkan data baru maka penulis melakukan prediksi untuk menentukan mode yang tepat untuk data baru ini sebagai berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*dWpi9GZlXZCwur56jZ1wLQ.png" /></figure><p>Berdasarkan hasil prediksi dapat dilihat nilai probabilitas terbesar adalah <em>charter</em> yaitu 0.4584674, sehingga mode terbaik untuk data baru ini adalah <em>charter</em>. Selanjutnya penulis akan menampilkan plot jumlah nilai <em>hidden layer</em> dan nilai errornya sebagai berikut.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*2KEru7J6ow1G_tVrggpOyg.png" /></figure><p>Berdasarkan hasil plot pada gambar didapatkan <em>hidden </em>yang memiliki nilai <em>error</em> terkecil adalah pada <em>hidden </em>6.</p><blockquote>Script R lengkap klik <a href="https://github.com/salsabilabasalamah/Artificial-Neural-Network/blob/master/Fishing"><em>disini</em></a> !!!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=644a7af4d073" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[K-Nearest Neighbor (KNN) in R part 2]]></title>
            <link>https://salsabilabasalamah.medium.com/k-nearest-neighbor-knn-in-r-part-2-b350c4c737bb?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/b350c4c737bb</guid>
            <category><![CDATA[k-nearest-neighbors]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[knn-algorithm]]></category>
            <category><![CDATA[knn]]></category>
            <category><![CDATA[r]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Sun, 09 Jun 2019 16:27:06 GMT</pubDate>
            <atom:updated>2021-08-07T16:10:22.617Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EJs4W-7fez-GRA-GTNCog.jpeg" /></figure><h3>Introduction</h3><p>The KNN algorithm is a robust and versatile classifier that is often used as a benchmark for more complex classifiers such as Artificial Neural Networks (ANN) and Support Vector Machines (SVM). Despite its simplicity, KNN can outperform more powerful classifiers and is used in a variety of applications such as economic forecasting, data compression and genetics. For example, KNN was leveraged in a 2006 study of functional genomics for the assignment of genes based on their expression profiles.</p><blockquote>“KNN is non-parametric, instance-based and used in a supervised learning setting.”</blockquote><h3>How does KNN work?</h3><p>In the classification setting, the K-nearest neighbor algorithm essentially boils down to forming a majority vote between the K most similar instances to a given “unseen” observation.</p><blockquote>KNN searches the memorized training observations for the K instances that most closely resemble the new instance and assigns to it the their most common class.</blockquote><p>An alternate way of understanding KNN is by thinking about it as calculating a decision boundary (i.e. boundaries for more than 2 classes) which is then used to classify new points.</p><blockquote>If you want another KNN explanation you can learn <a href="https://medium.com/@salsabilabasalamah/k-nearest-neighbor-knn-in-r-c3e0ad4f5447">here</a> !!!</blockquote><h3>Study Case</h3><p>Now we will match KNN in R. In this article, <strong>we use the Yogurt dataset provided in R.</strong> The Yogurt data consists of 10 variables, where the id variable is the individual identifier, then the choice variable is the type of the yogurt brand yoplait, dannon, hiland, weight (weight watcher). For the feat variable is the variable regarding whether there are newspaper feature advertisements for each brand, and price is the price for each brand. <strong>The author will use the price.yoplait, price.danno, price.hila, price.weight, and choice variables.</strong> The first step is to know the picture of Yogurt data to better understand the data by displaying a summary of yogurt data.</p><pre>#summary of yogurt data<br>summary(Yogurt)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*SdxqodYIVZ8Xq4xCaxMhqw.png" /></figure><p>After knowing the yogurt data summary, then the class for each brand was targeted. Based on the summary results, there were 818 of the Yoplait brands, and 970 in total, 71 in total, and 553 in brand weight.</p><pre>yogurt_class&lt;-c(rep(&quot;y&quot;,818),rep(&quot;d&quot;,970),rep(&quot;h&quot;,71),rep(&quot;w&quot;,553))</pre><p>Next is making frame data and in this example, yogurt data will be taken only 4 variables, while choice variable is replaced with yogurt.</p><pre>yogurt&lt;-data.frame(Yogurt[,6:9],species=yogurt_class)</pre><p>Then divide the odd data evenly, where taking the odd numbered yogurt data sequence is used as training data.</p><pre>genap.n&lt;-2*(1:1206)-1<br>yogurt.latihan&lt;-Yogurt[genap.n,]<br>yogurt.uji&lt;-Yogurt[-genap.n,]</pre><pre>yogurt.knn&lt;-knn(yogurt.latihan[,-10],yogurt.uji[,-10], yogurt.latihan[,10], k=5)<br>(table(yogurt.knn,yogurt.uji[,10]))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*NxxsYJh0BHkPboKriYVaJQ.png" /></figure><p>Based on the output, it can be seen that there are 6 Yoplait yogurt brands that do not match and enter into Hiland, thus there is a misclassification of 6/1206. In addition there is also one Weight that is not suitable and entered into Hiland, thus there is a misclassification of 1/1206. To see the results of the visual classification, the writer uses a plot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*LwW_DA-Cwn6qGUFBeI9Aaw.png" /></figure><p>Based on the results of the plot of the variable pairs above, it appears that there is a lot of red in each brand that shows that it does not match the classification, and the blue color refers to the classification.</p><blockquote>K-Nearest Neighbor R script <a href="https://github.com/salsabilabasalamah/K-Nearest-Neighbor/blob/607cbde25ed659e9d40d631a72e5e8155328e86f/KNN%20Yogurt%20dataset">here</a>!!!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b350c4c737bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Animating Your Data Visualization Using ggplot2 and plotly in R]]></title>
            <link>https://salsabilabasalamah.medium.com/animating-your-data-visualization-using-ggplot2-and-plotly-in-r-2bf8cdcf9e3c?source=rss-3edadd214748------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bf8cdcf9e3c</guid>
            <category><![CDATA[panel]]></category>
            <category><![CDATA[plotly]]></category>
            <category><![CDATA[ggplot2]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[SALSABILA BASALAMAH]]></dc:creator>
            <pubDate>Thu, 11 Apr 2019 20:49:39 GMT</pubDate>
            <atom:updated>2023-08-05T15:49:36.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enlivening Data Visualization with Animation</h3><p><a href="https://medium.com/u/3edadd214748">SALSABILA BASALAMAH</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*seAV8o4PU4iWCrqHaK60MA.gif" /></figure><p>Dunia saat ini dipenuhi dengan data dan menjadi penting bahwa kita menganalisisnya dengan benar untuk mendapatkan wawasan yang bermakna. Visualisasi Data adalah alat vital yang dapat menggali kemungkinan wawasan penting dari data. Saat menceritakan kisah yang didorong oleh data, beberapa hal menarik perhatian lebih dari sekadar gerakan. Mata kita secara alami tertarik pada warna dan gerakan yang cerah. Visualisasi yang baik menangkap minat audiens dan membuat kesan. Untungnya, pada saat ini membuat tampilan visualisasi secara menarik menjadi sangat sederhana dengan beberapa paket R yang mudah digunakan.</p><blockquote>R is an amazing platform for data analysis, capable of creating almost any type of graph.</blockquote><h4>Apa itu Data Visualisasi?</h4><p>Data Visualisasi adalah teknik menyajikan data secara visual melalui grafik, chart , peta agar tampilan menarik namun tetap informatif. Alasan ada nya data visualisasi adalah tidak lepas dari “kebosanan” dan “monoton” apabila data disajikan dalam bentuk baris dan kolom seperti dalam tabel tabel.</p><blockquote>Dalam melakukan visualisasi data penulis akan menggunakan software R dengan bantuan package ggplot2 dan plotly.</blockquote><h4><strong>Package ggplot2</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*x55-3ZDnBDIBXph9uW83iw.png" /></figure><p>Fungsi-fungsi dalam paket ggplot2 membangun grafik berlapis-lapis. ggplot2 berfungsi seperti data dalam format ‘panjang’, yaitu, kolom untuk setiap dimensi, dan baris untuk setiap pengamatan. Data yang terstruktur dengan baik akan menghemat banyak waktu Anda ketika membuat angka dengan ggplot2. Untuk membangun ggplot, dapat menggunakan templat dasar berikut yang dapat digunakan untuk berbagai jenis plot:</p><pre>ggplot(data = &lt;DATA&gt;, mapping = aes(&lt;MAPPINGS&gt;)) + &lt;GEOM_FUNCTION&gt;()</pre><p>Argumen pertama ggplot () adalah dataset yang digunakan dalam grafik. Jadi ggplot (data = &lt;DATA&gt;) membuat grafik kosong, Selanjutnya melengkapi grafik yang akan dibuat dengan menambahkan satu atau lebih layer ke ggplot (). Misalnya fungsi geom_point () menambahkan lapisan poin ke plot Anda, yang menciptakan sebar plot. ggplot2 hadir dengan banyak fungsi geom yang masing-masing menambahkan tipe layer yang berbeda ke plot.</p><h4>Package <a href="https://plot.ly/r/animations/">Plotly</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*rFJyj4yjuURVS8vocMjQWw.png" /></figure><p>Plotly adalah paket R untuk membuat grafik berbasis web interaktif melalui perpustakaan grafik JavaScript open source plotly.js. Plotly graph diberikan secara lokal melalui kerangka kerja htmlwidgets. <em>Package </em>plotly lebih dikenal sebagai perpustakaan plot interaktif yang memiliki fitur animasi.</p><p>Untuk menambah pengatahuan mengenai pembuatan grafik animasi dengan R penulis akan memberikan contoh pembuatan grafik animasi dengan R.</p><h4>Studi Kasus</h4><p>Penulis akan menggunakan data life_pop data dapat di download <a href="https://drive.google.com/file/d/1kp9q5vkLX_-YSa-nL8RzN38LVd8syrs_/view">disini</a>. Data dengan nama life_pop memiliki 4 sheet, penulis akan menggabungkan gdp, population, years, life Expectancy, dan region menjadi satu tampilan <em>dataset</em>. Sehingga akan di gabungkan 4 <em>sheet</em> tersebut menjadi bentuk data panel.</p><p>Langkah pertama adalah mengaktifkan <em>package</em> yang telah terinstall yaitu <em>package</em> ggplot2 dan <em>package</em> plotly . Kemudian untuk memanggil data dalam <em>Microsoft Excel </em>penulis juga menggunakan<em> package </em>openxlsx2<em>.</em></p><pre>library(openxlsx)<br>library(plotly)<br>library(ggplot2).</pre><p>Setelah <em>package</em> yang dibutuhkan telah diaktifkan penulis kemuadian <em>input </em>data gapminder untuk <em>sheet =</em>1 yang berisi <em>gdp</em>, <em>startRow </em>=1 yaitu dibuat dari baris pertama. <em>Script</em> yang digunakan:</p><pre>gapminder &lt;- read.xlsx(&quot;...//gapminder.xlsx&quot;, sheet = 1, startRow = 1, colNames = TRUE)</pre><p>Kemudian penulis akan membuat vektor atau rumah baru untuk masing-masing country.name dan tahun. Untuk tahun akan dilakukan <em>transpose</em> untuk setiap masing-masing negara akan berulang sebanyak 47 tahun.</p><pre>#mengambil varibel<br>country.vec &lt;- gapminder [,1]<br>country.vec</pre><p>Penulis selanjutnya membuat perulangan dari data ke 1–170. Kemudian lakukan replikasi negara sebanyak 47 kali sesuai lama tahun yang digunaan yaitu dari tahun 1970–2016 menggunakan <em>script</em>:</p><pre># membuat pengulangan variabel panel (replikasi)</pre><pre>country_panel &lt;- c()<br>for (i in 1:170) {<br>x = rep(country.vec[i], 47)<br>country_panel &lt;- append(country_panel, x)<br>}</pre><p>Langkah berikutnya membuat vektor replikasi dengan perintah rep() dari tahun 1970–2016 sebanyak 170 negara, dengan <em>script</em>:</p><pre>years_panel &lt;- rep(1970:2016, 170)</pre><p>Langkah berikutnya dibuat suatu perulangan untuk <em>years </em>dari 1970 hingga 2016 sebanyak 170 kali atau sebanyak negara yang ada. Kemudian mengambil data pada variabel <em>gdp</em>. Untuk mengambil data variabel gdp untuk 170 negara, akan dilakukan<em> transpose</em> menggunakan <em>script</em> x=t(x) untuk merubah bentuk awalnya berupa kolom kemudian dijadikan berbentuk baris.</p><pre>#mengambil data pada variabel gdp</pre><pre>gdp_panel &lt;- c()<br>for (i in 1:170) {<br>x = gapminder[i,]<br>x =  x[-c(1:3)]<br>x = t(x)<br>gdp_panel &lt;- append(gdp_panel, x)}<br>gdp_panel</pre><p>Hasil <em>output</em> sebagai berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*LlQjGxxCbJBv3XhkuhyWrA.png" /></figure><p>Selanjutnya melakukan langkah yang sama pada <em>sheet population, life,</em> dan <em>region</em>. <em>Input </em>data gapminder kembali untuk <em>sheet </em>2 atau variabel <em>pop</em>.</p><pre>#mengambil data untuk sheet populasi</pre><pre>gapminder1 &lt;- read.xlsx(&quot;...//gapminder.xlsx&quot;, sheet = 2, startRow = 1, colNames = TRUE)</pre><p>Nama gapminder1 merupakan nama untuk memanggil data gapminder yang berada di <em>sheet = 2</em> yang berisi <em>pop</em>, <em>startRow </em>=1 yaitu dibuat dari baris pertama. Selanjutnya membuat vektor pop_panel diambil dari data kolom ketiga yaitu variabel Continent, lakukan replikasi sebanyak 170 kemudian <em>transpose.</em></p><pre>pop_panel &lt;- c()<br>for (i in 1:170) {<br>x = gapminder1[i,]<br>x =  x[-c(1:3)]<br>x = t(x)<br>pop_panel &lt;- append(pop_panel, x)<br>}</pre><p>Langkah berikutnya melakukan<em> input </em>data gapminder kembali untuk <em>sheet </em>3 atau variabel life ke R, menggunakan <em>script</em>:</p><pre>#mengambil data untuk sheet 3</pre><pre>gapminder2 &lt;- read.xlsx(&quot;...//gapminder.xlsx&quot;, sheet = 3, startRow = 1, colNames = TRUE)</pre><p>Selanjutnya membuat vektor life_panel diambil dari data kolom ketiga yaitu variabel Continent, lakukan replikasi sebanyak 170 kemudian <em>transpose, </em>menggunakan<em> script</em>:</p><pre>life_panel &lt;- c()<br>for (i in 1:170) {<br>x = gapminder2[i,]<br>x =  x[-c(1:3)]<br>x = t(x)<br>life_panel &lt;- append(life_panel, x)<br>}<br>life_panel</pre><p>Langkah berikutnya melakukan<em> input </em>data gapminder kembali untuk <em>sheet 4 </em>atau variabel region ke R, menggunakan <em>script</em>:</p><pre>#mengambil varialbel region</pre><pre>gapminder3 &lt;- read.xlsx(&quot;...//gapminder.xlsx&quot;, sheet = 4, startRow = 1, colNames = TRUE)</pre><p>Kemudian penulis membuat vektor region.vec diambil dari data kolom enam yaitu variabel Continent, lakukan replikasi sebanyak 170 kemudian <em>transpose, </em>menggunakan<em> script</em>:</p><pre>region.vec &lt;- gapminder3 [,6]<br>region.vec</pre><p>Hasil <em>output</em> untuk ragion sebagai berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*v0C7USwmMLJVqSaXnembLw.png" /></figure><p>Selanjutnya membuat replikasi negara sebanyak 47 seperti yang telah dibuat untuk country.vec, <em>script</em> yang digunakan:</p><pre>region_panel &lt;- c()<br>for (i in 1:170) {<br>x = rep(region.vec[i], 47)<br>region_panel &lt;- append(region_panel, x)<br>}<br>View(region_panel)</pre><p>Setelah menjalankan script diatas maka akan dimiliki 6 vektor, yaitu: country_panel, years_panel, gdp_panel, pop_panel, life_panel, dan region_panel. Kemudian 6 vektor ini digabungkan menjadi 1 file dengan cara membuat data frame, <em>script </em>untuk menggabungkan 6 vektor sebagai berikut:</p><pre>#membuat data frame</pre><pre>gapminder_frame &lt;- data.frame(region_panel,country_panel, years_panel, gdp_panel, pop_panel, life_panel)</pre><pre>View(gapminder_frame)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*PzX_86qAe7DMEHX5bh-ZOg.png" /></figure><p>Selanjutnya kita akan membuat ggplot2 dengan nama gap yang terdiri dari gapminder_frame dengan axis x adalahh gdp_panel dan axis y adalah life_panel, pemberian warna berdasarkan country_panel, ukurannya (<em>size</em>) berdasarkan pop_panel, dan bentuk atau <em>shape </em>berdasarkan region_panel. Lalu <em>frame</em>-nya berdasarkan tahun atau years_panel sehingga akan bergerak dari tahun ke tahun. <em>Script</em> sebagai berikut:</p><pre>gap &lt;- ggplot(gapminder_frame, aes(x = log(gdp_panel), y = life_panel, color = country_panel)) + geom_point(aes(shape = region_panel,size = pop_panel,frame = years_panel))</pre><pre>gap</pre><pre>ggplotly(gap)</pre><p>Hasil animasi plot bergeraknya akan terlihat seperti gambar berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*VwXo9U8wp5j2vQOQEyj3ag.jpeg" /></figure><blockquote>Untuk <em>script</em> lengkapnya dapat dilihat <a href="https://github.com/salsabilabasalamah/Data-Visualizations.git">disini</a>.</blockquote><p><a href="https://github.com/salsabilabasalamah/Data-Visualizations.git">salsabilabasalamah/Data-Visualizations</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bf8cdcf9e3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>