Concrete is one of the most important building materials used. It is a composite of fine and coarse aggregates bonded together with a fluid cement that hardens over time to form a solid mass.
Typically, it is reinforced with steel, nevertheless, ensuring its strength and durability is critical for stability of buildings. Because of this, concrete must pass quality control to ensure its strength.
Compressive strength is one of the parameters evaluated. In short, compressive strength is the capacity to withstand loads. It is measured on a universal testing machine. Concrete cubes are prepared from random samples, then after several days, they are taken to load testing.
It is known that concrete compressive strength can be modelled with a nonlinear function with age and ingredients as input parameters. We will demonstrate how to build models with TIM and see whether such models can be used to estimate compressive strength from historical data.
|Business objective:||Reduce operational costs|
|Business value:||Increase efficiency|
import logging import pandas as pd import plotly as plt import plotly.express as px import plotly.graph_objects as go import numpy as np import json import datetime from sklearn.metrics import mean_squared_error, mean_absolute_error import math import tim_client
with open('credentials.json') as f: credentials_json = json.load(f) # loading the credentials from credentials.json TIM_URL = 'https://timws.tangent.works/v4/api' # URL to which the requests are sent SAVE_JSON = False # if True - JSON requests and responses are saved to JSON_SAVING_FOLDER JSON_SAVING_FOLDER = 'logs/' # folder where the requests and responses are stored LOGGING_LEVEL = 'INFO'
level = logging.getLevelName(LOGGING_LEVEL) logging.basicConfig(level=level, format='[%(levelname)s] %(asctime)s - %(name)s:%(funcName)s:%(lineno)s - %(message)s') logger = logging.getLogger(__name__)
credentials = tim_client.Credentials(credentials_json['license_key'], credentials_json['email'], credentials_json['password'], tim_url=TIM_URL) api_client = tim_client.ApiClient(credentials)
Dataset contains measurement of key factors from concrete production process. Our goal is to calculate compressive strength. Outlier values were removed from original file (more than 40 records were reduced).
Original dataset was enhanced with regular timestamps (with daily sampling rate) so it can be used with TIM. It is not expected to use any time related features (except age, however that has no link to sequential order of points on a timeline).
Structure of CSV file:
|Concrete compressive strength||MPa||Target||t-1|
|Blast Furnace Slag||kg/m3||Predictor||t+0|
We want TIM to quantify current condition based on measurement (actual values), it means that we want to caculate value of target based on predictors values only, hence the last record of target must be kept empty (NaN/None) in dataset. This situation will be replicated by TIM to calculate results for all out-of-sample records.
CSV files used in experiments can be downloaded here.
Original files were acquired at UCI Machine Learning Repostitory.
Reuse of database is unlimited with retention of copyright notice for Prof. I-Cheng Yeh and the following published paper: I-Cheng Yeh, "Modeling of strength of high performance concrete using artificial neural networks," Cement and Concrete Research, Vol. 28, No. 12, pp. 1797-1808 (1998).
(C) Prof. I-Cheng Yeh, Department of Information Management, Chung-Hua University, Hsin Chu, Taiwan 30067, R.O.C., e-mail:icyeh '@' chu.edu.tw, TEL:886-3-5186511
data = tim_client.load_dataset_from_csv_file('data_concrete_strength_1312.csv', sep=',') data.tail()
|timestamp||Concrete compressive strength||Cement||Blast Furnace Slag||Fly Ash||Water||Superplasticizer||Coarse Aggregate||Fine Aggregate||Age|
target_column = 'Concrete compressive strength' timestamp_column = 'timestamp'
prediction_horizon = 1
fig = go.Figure() fig.add_trace(go.Scatter( x = data.index, y = data['Concrete compressive strength'], name='Concrete compressive strength' ) ) fig.add_trace(go.Scatter( x = data.index, y = data['Water'], name='Water' ) ) fig.add_trace(go.Scatter( x = data.index, y = data['Age'], name='Age' ) ) fig.update_layout( height = 700, width = 1200, title='Dataset' ) fig.show()