0
$\begingroup$

I am trying to build an expectation model for my (19502,3) data using Keras Sequential model. This dataset has been generated using a parametric sweep in a simulation software.
With this model, I want to expect the length and the weight of an item based on the cost. This is like an inverse problem.
I used two hidden layers (the first one with input shape), and an output layer. I tried to improve my code by optimizing some parameters, e.g., the number of layers, the number of units inside each layer, the activation, the optimizer, the loss, and epochs. The results are good and relevant. The result of my model can be inspected using the same simulation software with which I generated my dataset. For example, the expected values for an input = 80 corresponds to 100 in the simulation software. This result is very good, however, I was wondering whether it can somehow be improved.
Am I using the correct model? Am I doing it correctly?
Any help, suggestion, recommendation, or comment would be highly appreciated!
Many thanks
Alex

Here is my code:

from IPython import get_ipython get_ipython().magic('reset -sf') import pandas as pd import numpy as np from sklearn.model_selection import train_test_split import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.models import Sequential model = Sequential() from tensorflow.keras.layers import Dense data_file_path = 'F:/Dl_project/dss_project/data_price.csv' my_data = pd.read_csv(data_file_path) my_data.columns = ["length","weight","cost"] X = my_data['cost'] y = my_data.drop(columns=['cost']) predictionData = ([[80]]) X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.10, random_state=40) X_train= X_train.values.reshape(-1, 1) #y_train= y_train.values.reshape(-1, 1) X_test = X_test.values.reshape(-1, 1) model.add(Dense(units=128, kernel_initializer='uniform', activation='sigmoid')) #hidden layer 1 with input model.add(Dense(units=128, kernel_initializer='uniform',activation='sigmoid'))#hidden layer 2 model.add(Dense(units=2)) #output layer model.compile(loss='MeanAbsolutePercentageError',optimizer='Adamax',metrics=['accuracy']) model.fit(X_train, y_train, epochs=15, batch_size=32) print(model.predict(predictionData),'\n') ``` 
$\endgroup$

1 Answer 1

0
$\begingroup$
  • change the activation to relu because it is a regression problem. Signmoid is used in classification problems
  • find whether model and high bias or variance. If variance is high, use regularization .
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.