<?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 Sruthi Sivakumar on Medium]]></title>
        <description><![CDATA[Stories by Sruthi Sivakumar on Medium]]></description>
        <link>https://medium.com/@sruthi-sivakumar?source=rss-8262a75ece0d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SvGyTOS3UfW-Gv-Mj7_ZFA.png</url>
            <title>Stories by Sruthi Sivakumar on Medium</title>
            <link>https://medium.com/@sruthi-sivakumar?source=rss-8262a75ece0d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:53:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sruthi-sivakumar/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[Estimating the compressive strength of concrete using Machine Learning]]></title>
            <link>https://sruthi-sivakumar.medium.com/estimating-the-compressive-strength-of-concrete-using-machine-learning-1637c9ca2c73?source=rss-8262a75ece0d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1637c9ca2c73</guid>
            <category><![CDATA[machinelerning]]></category>
            <category><![CDATA[compressive-strength]]></category>
            <category><![CDATA[concrete]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[regression]]></category>
            <dc:creator><![CDATA[Sruthi Sivakumar]]></dc:creator>
            <pubDate>Sun, 27 Dec 2020 20:24:04 GMT</pubDate>
            <atom:updated>2020-12-28T09:08:24.973Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kW6QF87JX5TKyI24" /><figcaption>Photo by <a href="https://unsplash.com/@ballonandon?utm_source=medium&amp;utm_medium=referral">Ben Allan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Concrete dates back to approximately 300 BC when the Romans packed a mixture of volcanic ash, lime and seawater into a wooden block and stacked them like bricks once hardened. I mean, sure the definition and the ingredients of concrete have changed along the way, but the durability and endurance of the material never fail to fascinate researchers. For any concrete to be durable, it must first be manufactured as a high-quality concrete. One of the many ways to evaluate the quality of concrete is in terms of its compressive strength.</p><h4><strong>What is compressive strength, anyway?</strong></h4><p>Compressive strength is a measure of the concrete’s capacity to resist loads that aim to compress it. How well a concrete can withstand load determines the quality of the concrete. Generally, the concrete is tested for a period of 28 days which can be cumbersome and could be subject to errors. To avoid all this mind-numbing work, we could automate the process using Machine Learning to predict the compressive strength and arrive at an estimate.</p><h3><strong>Dataset Description</strong></h3><p>The dataset was taken from the <a href="http://archive.ics.uci.edu/ml/datasets/Concrete+Compressive+Strength">UCI Machine Learning Repository</a>. It contains 1030 instances and 9 attributes with surprisingly no missing values. Among the 8 input variables, 7 represent the amount of raw materials needed and 1 represents age. The target variable is Concrete Compressive Strength (obviously) measured in Mega Pascal(MPa).</p><p><strong><em>Raw materials</em></strong></p><ul><li>Cement (component 1)(kg in a m³ mixture)</li><li>Blast Furnace Slag (component 2)(kg in a m³ mixture)</li><li>Fly Ash (component 3)(kg in a m³ mixture)</li><li>Water (component 4)(kg in a m³ mixture)</li><li>Superplasticizer (component 5)(kg in a m³ mixture)</li><li>Coarse Aggregate (component 6)(kg in a m³ mixture)</li><li>Fine Aggregate (component 7)(kg in a m³ mixture)</li></ul><p><strong><em>Other stuff</em></strong></p><ul><li>Age (day)</li></ul><p><strong><em>Target variable</em></strong></p><ul><li>Concrete compressive strength(MPa, megapascals)</li></ul><h4><strong>Importing the dependencies</strong></h4><p>Let us first import the libraries that we need.</p><pre>import numpy as np<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>import pickle as pkl<br>from sklearn.model_selection import train_test_split<br>from sklearn.tree import DecisionTreeRegressor<br>from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score<br>from sklearn.ensemble import RandomForestRegressor<br>%matplotlib inline</pre><p>After importing the libraries and the dataset, we can see that the column names appear to be really messy, so we can rename those for better readability and easy access.</p><pre>rename_cols = [&quot;Cement&quot;, &quot;Blast_Furnace_Slag&quot;, &quot;Fly_Ash&quot;, &quot;Water&quot;, &quot;Superplasticizer&quot;,&quot;Coarse_Aggregate&quot;, &quot;Fine_Aggregate&quot;, &quot;Age&quot;, &quot;CCS&quot;]<br>cols = list(df.columns)</pre><pre>map = {}<br>for i, name in enumerate(cols):<br>    map[name] = rename_cols[i]</pre><pre>df = df.rename(columns=map)</pre><h3>Exploratory Data Analysis (EDA)</h3><p>To get a better understanding of what we’re dealing with, we ought to explore the dataset and get insights from it. Exploring the dataset involves looking for missing values, plotting pretty graphs between different variables etc. You don’t have to go all Dora on this, but a little bit of curiosity is appreciated.</p><p>Let us first print the first few rows of the dataset.</p><pre>df.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rf_ZaaKiRdRyPLp0_EVTQ.png" /><figcaption>Fig 1 : First four rows of the dataset</figcaption></figure><pre>df.info()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*n9p75Q89JRybf9N1LFzgXw.png" /><figcaption>Fig 2 : Overview of the dataset</figcaption></figure><p>A quick overview of the dataset tells us that all of the variables in the dataset are integer and float variables. And now, we check for missing values in the dataset (if any) to perform the missing value analysis.</p><pre>df.isna().any()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*4p4tX9CqvUNfFPIL1alj9g.png" /><figcaption>Fig 3 : Checking for missing values</figcaption></figure><p>Fortunately, there are no missing values in the dataset. This makes our job much easier!</p><pre>df.describe()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gtwOHTiD5zLXw7phAiXKug.png" /><figcaption>Fig 4 : Statistics of the dataset</figcaption></figure><p>The average age is 45.666 days and the lowest is 1 day.</p><h3><strong>Data Visualisation</strong></h3><p>And now, the fun part! To make pretty graphs we’re going to make use of a library called Seaborn in python. Seaborn is a data visualisation library based on matplotlib which provides a top-notch interface for drawing statistical graphs that are nice to look at.</p><pre>dist = sns.distplot(df[&#39;CCS&#39;], color = &#39;limegreen&#39;)<br>plt.title(&#39;Distribution of Compressive Strength&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*908iSnXON_J8IUVoueKtRA.png" /><figcaption>Fig 5 : Distribution of Compressive Strength</figcaption></figure><p>To see how every feature affects another, we have to check for the correlation between them. In order to make use of the linear regression models, we must remove the correlated features.</p><pre>corr = df.corr()<br>plt.figure(figsize=(13,8))<br>plt.title(&quot;Feature Correlation Heatmap&quot;)<br>sns.heatmap(corr,cmap= &quot;Purples_r&quot;,annot=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*5fbhgnVJG8QlPsSsbDfElA.png" /><figcaption>Fig 6 : Feature Correlation Heatmap</figcaption></figure><p>From the above heatmap, we can infer that Cement is strongly correlated with CCS with a value of 0.5. Superplasticizer and Age are also highly correlated with CCS with values 0.37 and 0.33 respectively. Water does not influence Superplasticizer at all. These values allow us to comprehend the data in-depth as they provide an overview of how each feature affects the other.</p><p>Since Cement, Superplasticizer and Age are strongly correlated with CCS, we can draw scatter plots between the same.</p><pre>plt.figure(figsize=(10,7))<br>sns.scatterplot(data =df,y=&quot;CCS&quot;,x=&quot;Cement&quot;,hue=&quot;Superplasticizer&quot;,size=&quot;Age&quot;,sizes=(50,300))<br>plt.title(&quot;CCS vs (Cement,Superplasticizer, Age)&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*Ee7GM3C_2OdD9S2ZrPChIQ.png" /><figcaption>Fig 7 : CCS vs Cement, Superplasticizer, Age</figcaption></figure><ul><li>Compressive strength increases with the amount of Cement.</li><li>Compressive strength increases with Superplasticizer as well.</li><li>Cement with low age requires more cement for higher strength</li></ul><pre>plt.figure(figsize=(10,7))<br>sns.scatterplot(data = df,y=&quot;CCS&quot;,x=&quot;Coarse_Aggregate&quot;,hue=&quot;Water&quot;,size=&quot;Superplasticizer&quot;,sizes=(50,300))<br>plt.title(&quot;CCS vs (Coarse_Aggregate,Water, Superplasticizer)&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*bTIPjHuTu4VHSvchAEZH9A.png" /><figcaption>Fig 8 : CCS vs Coarse_Aggregate, Water, Superplasticizer</figcaption></figure><ul><li>Compressive strength decreases with increase in water but increases with increase in Superplasticizer ( since CCS and Superplasticizer are highly correlated)</li><li>The amount of coarse aggregate is larger when less amount of water and superplasticizer is used.</li></ul><h3>Data Preprocessing</h3><p>Before we build the models, we need to split the data into testing and training sets.</p><pre>x = df.iloc[:,:-1]<br>y = df.iloc[:,-1]<br>X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=2)</pre><h3><strong>Building the model</strong></h3><h4>Decision Tree Regressor</h4><p>Decision Tree is a widely used supervised learning algorithm for decision-making problems. The model predicts the target variable values by learning simple decision rules obtained from the data features. It could however have an overfitting problem that can be overcome using the Random forest algorithm.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3d7facd588b37af26feca82bda59054/href">https://medium.com/media/a3d7facd588b37af26feca82bda59054/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*iw3W6-vOvFrpV5_4_YwpLg.png" /><figcaption>Fig 9 : Decision Tree Model</figcaption></figure><h4><strong>Random Forest Regressor</strong></h4><p>To get a more accurate and reliable prediction, Random Forest constructs several decision trees and merges them together. It uses averaging to improve the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html">predictive accuracy and control overfitting</a>. One of the significant advantages of a random forest is that it can be used for the majority of existing machine learning systems for both classification and regression problems.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a42e17248d64fb49653089e47b2e7ae/href">https://medium.com/media/6a42e17248d64fb49653089e47b2e7ae/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*qWJzPSPRAgniU_hfXbTBqg.png" /><figcaption>Fig 10 : Random Forest Model</figcaption></figure><h3><strong>Comparing the models</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0a06358533dee316a4caecdae9201c9/href">https://medium.com/media/a0a06358533dee316a4caecdae9201c9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*wcz4-AAuCUO_tN1S_bMx1w.png" /><figcaption>Fig 11 : Decision Tree vs Random Forest based on their RMSE values</figcaption></figure><p>Now that we have analysed the dataset, created our models and picked a model to estimate the CCS values, it’s time to put them to test. Here, I’m initialising an array called random_values with the following:</p><ul><li>Cement = 520</li><li>Blast Furnace Slag = 130</li><li>Fly Ash = 17.5</li><li>Water = 173</li><li>Superplasticizer = 2.5</li><li>Coarse Aggregate = 999</li><li>Fine Aggregate = 825</li><li>Age = 275 days</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38e0b2a9a9b579caf82180ab7a1ebbb8/href">https://medium.com/media/38e0b2a9a9b579caf82180ab7a1ebbb8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*tmMYSkCE8z5NZMHIvS1fig.png" /><figcaption>Fig 12 : Estimation of Compressive Strength</figcaption></figure><h3><strong>Conclusion</strong></h3><p>We’ve successfully analysed the dataset and estimated the compressive strength using Decision Tree Regressor and Random Forest Regressor. The Random Forest model provided the least RMSE. Hence, it is the relatively best model for predicting the strength of concrete. The accuracy of the model can be further improved by using ensemble learning and other techniques.</p><blockquote>Kudos to you, if you have made it this far! Thanks for reading this article, I hope you find it helpful!</blockquote><h3>Resources</h3><ul><li><a href="http://archive.ics.uci.edu/ml/datasets/Concrete+Compressive+Strength">Concrete Compressive Strength Dataset</a></li><li><a href="https://www.researchgate.net/publication/258255660_Strength_Prediction_Model_for_Concrete">https://www.researchgate.net/publication/258255660_Strength_Prediction_Model_for_Concrete</a></li><li><a href="https://towardsdatascience.com/machine-learning-basics-decision-tree-regression-1d73ea003fda">https://towardsdatascience.com/machine-learning-basics-decision-tree-regression-1d73ea003fda</a></li></ul><p>You can find the link to my Github repository with relevant files here :</p><p><a href="https://github.com/sruthisivakumar16/Estimating-Compressive-Strength-Of-Concrete/blob/main/README.md">sruthisivakumar16/Estimating-Compressive-Strength-Of-Concrete</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1637c9ca2c73" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>