Question: In this part, you need to apply a simple ANN model ( same as in part 1 ) on the MobilePriceDataset , which has 2

In this part, you need to apply a simple ANN model (same as in part 1) on the
MobilePriceDataset, which has 20 features and one label price_range(as category range
between 0 to 3). Your task is:
(1)Simply use the same steps in the previous part to implement ANN.
(2)Note that:
a. After reading the dataset you need to change dataframe to numpy by using this code:
#Changing pandas dataframe to numpy array
X_data = data.iloc[:,:20].values
y = data.iloc[:,20:21].values
b. You need to split the dataset into 80% train set and 20% test set.
c. To normalize the data, you can use this method:
#Normalizing the data
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.fit_transform(X_test)
d. No need to flatten the data because it is already in one dimensional shape.
e. Define the ANN model with this setting:
model = keras.Sequential()
model.add(keras.layers.Dense(16, input_shape=(20,), activation='sigmoid'))
model.add(keras.layers.Dense(12, activation='sigmoid'))
model.add(keras.layers.Dense(4, activation='softmax'))
f. When you train the model change the number of epochs to be any number of your
choice between 100 and 120.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!