Concrete strength
by: Chris Cave
Feyn version: 2.1+
Last updated: 27/09/2021
Importing the dataset
Here we use the QLattice
to predict the compressive strength of concrete based on the ingredients that have been used to make it. You can find this dataset and further descriptions of the features on UCI Machine Learning Repository.
import pandas as pd
import feyn
import numpy as np
from sklearn.model_selection import train_test_split
data = pd.read_csv("../data/concrete.csv")
data.head()
cement | blast_furnace_slag | fly_ash | water | superplasticizer | coarse_aggregate | fine_aggregate | age | concrete_compressive_strength | |
---|---|---|---|---|---|---|---|---|---|
0 | 540.0 | 0.0 | 0.0 | 162.0 | 2.5 | 1040.0 | 676.0 | 28 | 79.99 |
1 | 540.0 | 0.0 | 0.0 | 162.0 | 2.5 | 1055.0 | 676.0 | 28 | 61.89 |
2 | 332.5 | 142.5 | 0.0 | 228.0 | 0.0 | 932.0 | 594.0 | 270 | 40.27 |
3 | 332.5 | 142.5 | 0.0 | 228.0 | 0.0 | 932.0 | 594.0 | 365 | 41.05 |
4 | 198.6 | 132.4 | 0.0 | 192.0 | 0.0 | 978.4 | 825.5 | 360 | 44.30 |
QLattice
Connect to the random_state = 42
train, test = train_test_split(data, test_size=0.4, random_state=random_state)
ql = feyn.connect_qlattice()
ql.reset(random_state)
output_name = "concrete_compressive_strength"
auto_run
to obtain models
Use models = ql.auto_run(train, output_name=output_name)
best = models[0]
Summary plot to evaluate performance
best.plot(train, test)