I've tried this same exercise with a shallow Machine Learning algorithm (Ridge Regression), but I wanted to give a Neural Network a try.
I have access to raw sensor data in the following format. (+100k rows)
Timestamp OilPressure OilTemperature RPM FilterRestriction
0001 145 90 1100 15
0002 140 92 1100 15
0003 134 93 1123 16
0004 143 91 1135 14
The label for this exercise is OilPressure, and I've trained the following model on it.
model = keras.Sequential([
layers.Dense(64, activation='relu', input_shape=[len(train_dataset.keys())]),
layers.Dense(64, activation='relu'),
layers.Dense(1)
])
I split my original data set 25% and 75%, since I want to train and test the model on the original 25% an use that as the baseline for my "healthy" equipment. So I sorted the data set ascending by date and split it accordingly.
That 25% was further randomly split 80%/20% for train test.
The resulting model gives me a MSE of 3 PSI roughly...
What I would like to do now is populate the original dataframe with another column where I can compare the actual OilPressure to the predicted OilPressure. The predictions will be generated by the model trained off the 25% but will apply to the 85% that wasn't trained or tested.
I was thinking of applying a lambda function but I'm not sure if that would work, can I define some other sort of function that takes in OilTemperature, RPM and FilterRestriction, passes it to my model and spits out a PredictedOilPressure?
This is what I'm trying to achieve:
Timestamp OilPressure OilTemperature RPM FilterRestriction PredictedOilPressure
1000 139 89 1203 11 141
1001 142 89 1109 10 142
1002 146 87 1177 10 147
1003 143 84 1205 12 144
Create a pandas dataframe for every record you would like to make predictions on. (X_features) and then just use the model.predict() function in order to make the predictions. save the results as a column in the dataset.
dataset['PredictedOilPressure'] = model.predict(X_features)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.