GPT Flashcards

1
Q

Is step the same as batch in deep learning?

A

In deep learning, a “step” refers to a single update of the model’s parameters during training, whereas a “batch” refers to a set of samples that are processed together in the forward pass through the neural network.

The term “batch” is often used to refer to both the batch size (i.e., the number of samples in each batch) and the total number of batches processed during one epoch (i.e., the total number of batches needed to process the entire training set once).

So, while “batch” and “step” are related concepts in deep learning, they do not refer to exactly the same thing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does hidden_layer_sizes in this code mean?
model = MLPRegressor(hidden_layer_sizes=(100,50,25), activation=’relu’, solver=’adam’, max_iter=500)

A

the hidden_layer_sizes parameter is set to a tuple (100, 50, 25), which means that the neural network has 3 hidden layers with 100, 50, and 25 neurons, respectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

do I need to use ‘linear’ activation function in the output layer of a regression neural network designed using keras sequential?

A

Yes, it is recommended to use a ‘linear’ activation function in the output layer of a regression neural network designed using keras sequential.

The ‘linear’ activation function produces a continuous output, which is suitable for regression problems where the goal is to predict a numerical value. In contrast, for classification problems, different activation functions like ‘softmax’ or ‘sigmoid’ are used in the output layer to produce a probability distribution over the classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

I want to scale the target in train and test sets for using in a neural network. the neural network is designed using keras and dense layers, how can I do it and reverse the scaling so the predictions are accurate and not scaled?

A
from sklearn.preprocessing import StandardScaler

Scale the target variable in the training set
scaler = StandardScaler()
y_train_scaled = scaler.fit_transform(y_train.reshape(-1, 1))

Scale the target variable in the test set using the same scaler
y_test_scaled = scaler.transform(y_test.reshape(-1, 1))

Define and compile the neural network model
model = keras.Sequential([
    keras.layers.Dense(64, activation='relu', input_shape=(X_train.shape[1],)),
    keras.layers.Dense(1)
])
model.compile(loss='mse', optimizer='adam')

Train the model with scaled target variable
history = model.fit(X_train, y_train_scaled, epochs=50, batch_size=32, validation_split=0.2)

Make predictions on the test set with scaled target variable
y_pred_scaled = model.predict(X_test)

Reverse the scaling on the predicted values
y_pred = scaler.inverse_transform(y_pred_scaled)

Calculate the RMSE on the original scale
rmse = np.sqrt(mean_squared_error(y_test, y_pred))
print(f"RMSE on original scale: {rmse}")
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Hyperband is not a suitable method for hyperparameter tuning of tree-based models like Random Forest. True/False

A

True.
This is because the main hyperparameters of Random Forest, such as the number of trees, tree depth, and feature sample size, do not have a smooth relationship with the model’s performance. Therefore, tuning them using a gradient-based optimization algorithm like Hyperband is not effective.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly