<jupyter_start><jupyter_text>------------------------------------------------  By <NAME>  -------------------------------------------------------------------     Regression Models with Keras By <NAME>  The model Start with importing the various libaries that will be needed for modeling.<jupyter_code>import keras
from keras.models import Sequential
from keras.layers import Dense
import pandas as pd
import numpy as np
concrete_data = pd.read_csv('https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0101EN/labs/data/concrete_data.csv')
concrete_data.head()<jupyter_output><empty_output><jupyter_text>**Output the data so we can see, and analyse it using Pandas.**<jupyter_code>concrete_data.shape
concrete_data.describe()
concrete_data.isnull().sum()<jupyter_output><empty_output><jupyter_text>Split the Dataset into dependent and independant varaibles. that is what we are looking for, "Target" and what we use to get the target which is "Predictors", which are also called features.<jupyter_code>concrete_data_columns = concrete_data.columns

predictors = concrete_data[concrete_data_columns[concrete_data_columns != 'Strength']] # all columns except Strength
target = concrete_data['Strength'] # Strength column
predictors.head()
target.head()
predictors_norm = (predictors - predictors.mean()) / predictors.std()
predictors_norm.head()
n_cols = predictors_norm.shape[1] # number of predictors

# define regression model
def regression_model():
    # create model
    model = Sequential()
    model.add(Dense(50, activation='relu', input_shape=(n_cols,)))
    model.add(Dense(50, activation='relu'))
    model.add(Dense(1))
    
    # compile model
    model.compile(optimizer='adam', loss='mean_squared_error')
    return model
# build the model
model = regression_model()
# fit the model
model.fit(predictors_norm, target, validation_split=0.3, epochs=100, verbose=2)<jupyter_output>Epoch 1/100
23/23 - 15s - loss: 1698.1317 - val_loss: 1189.9132
Epoch 2/100
23/23 - 0s - loss: 1591.7388 - val_loss: 1101.3759
Epoch 3/100
23/23 - 0s - loss: 1440.2180 - val_loss: 963.7808
Epoch 4/100
23/23 - 0s - loss: 1202.3130 - val_loss: 760.0726
Epoch 5/100
23/23 - 0s - loss: 862.8348 - val_loss: 522.9415
Epoch 6/100
23/23 - 0s - loss: 520.0082 - val_loss: 321.0190
Epoch 7/100
23/23 - 0s - loss: 298.2442 - val_loss: 214.3805
Epoch 8/100
23/23 - 0s - loss: 223.6868 - val_loss: 188.6359
Epoch 9/100
23/23 - 0s - loss: 209.7953 - val_loss: 183.8350
Epoch 10/100
23/23 - 0s - loss: 199.5290 - val_loss: 179.4361
Epoch 11/100
23/23 - 0s - loss: 191.4227 - val_loss: 176.5671
Epoch 12/100
23/23 - 0s - loss: 185.5787 - val_loss: 174.7630
Epoch 13/100
23/23 - 0s - loss: 180.5093 - val_loss: 172.7216
Epoch 14/100
23/23 - 0s - loss: 176.2099 - val_loss: 171.4049
Epoch 15/100
23/23 - 0s - loss: 173.4205 - val_loss: 170.8058
Epoch 16/100
23/23 - 0s - loss: 169.4897 - val_loss: 165.2624
Epoch 17/1[...]
{'fraction_non_alphanumeric': 0.15481886534518113, 'fraction_numerical': 0.13738892686261106, 'mean_word_length': 3.414781297134238, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '168017', 'license': 'MIT', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1045, 'n_words': 274, 'path': 'Keras_Regression_Models.ipynb', 'repo_name': 'Christian-Sajere/Keras-Regression-Models', 'size': '2951'}