<jupyter_start><jupyter_text>Venture Funding with Deep LearningYou work as a risk management associate at Alphabet Soup, a venture capital firm. Alphabet Soup’s business team receives many funding applications from startups every day. This team has asked you to help them create a model that predicts whether applicants will be successful if funded by Alphabet Soup.The business team has given you a CSV containing more than 34,000 organizations that have received funding from Alphabet Soup over the years. With your knowledge of machine learning and neural networks, you decide to use the features in the provided dataset to create a binary classifier model that will predict whether an applicant will become a successful business. The CSV file contains a variety of information about these businesses, including whether or not they ultimately became successful. Instructions:The steps for this challenge are broken out into the following sections:* Prepare the data for use on a neural network model.* Compile and evaluate a binary classification model using a neural network.* Optimize the neural network model. Prepare the Data for Use on a Neural Network Model Using your knowledge of Pandas and scikit-learn’s `StandardScaler()`, preprocess the dataset so that you can use it to compile and evaluate the neural network model later.Open the starter code file, and complete the following data preparation steps:1. Read the `applicants_data.csv` file into a Pandas DataFrame. Review the DataFrame, looking for categorical variables that will need to be encoded, as well as columns that could eventually define your features and target variables.   2. Drop the “EIN” (Employer Identification Number) and “NAME” columns from the DataFrame, because they are not relevant to the binary classification model. 3. Encode the dataset’s categorical variables using `OneHotEncoder`, and then place the encoded variables into a new DataFrame.4. Add the original DataFrame’s numerical variables to the DataFrame containing the encoded variables.> **Note** To complete this step, you will employ the Pandas `concat()` function that was introduced earlier in this course. 5. Using the preprocessed data, create the features (`X`) and target (`y`) datasets. The target dataset should be defined by the preprocessed DataFrame column “IS_SUCCESSFUL”. The remaining columns should define the features dataset. 6. Split the features and target sets into training and testing datasets.7. Use scikit-learn's `StandardScaler` to scale the features data. Compile and Evaluate a Binary Classification Model Using a Neural NetworkUse your knowledge of TensorFlow to design a binary classification deep neural network model. This model should use the dataset’s features to predict whether an Alphabet Soup&ndash;funded startup will be successful based on the features in the dataset. Consider the number of inputs before determining the number of layers that your model will contain or the number of neurons on each layer. Then, compile and fit your model. Finally, evaluate your binary classification model to calculate the model’s loss and accuracy.  To do so, complete the following steps:1. Create a deep neural network by assigning the number of input features, the number of layers, and the number of neurons on each layer using Tensorflow’s Keras.> **Hint** You can start with a two-layer deep neural network model that uses the `relu` activation function for both layers.2. Compile and fit the model using the `binary_crossentropy` loss function, the `adam` optimizer, and the `accuracy` evaluation metric.> **Hint** When fitting the model, start with a small number of epochs, such as 20, 50, or 100.3. Evaluate the model using the test data to determine the model’s loss and accuracy.4. Save and export your model to an HDF5 file, and name the file `AlphabetSoup.h5`.  Optimize the Neural Network ModelUsing your knowledge of TensorFlow and Keras, optimize your model to improve the model's accuracy. Even if you do not successfully achieve a better accuracy, you'll need to demonstrate at least two attempts to optimize the model. You can include these attempts in your existing notebook. Or, you can make copies of the starter notebook in the same folder, rename them, and code each model optimization in a new notebook. > **Note** You will not lose points if your model does not achieve a high accuracy, as long as you make at least two attempts to optimize the model.To do so, complete the following steps:1. Define at least three new deep neural network models (the original plus 2 optimization attempts). With each, try to improve on your first model’s predictive accuracy.> **Rewind** Recall that perfect accuracy has a value of 1, so accuracy improves as its value moves closer to 1. To optimize your model for a predictive accuracy as close to 1 as possible, you can use any or all of the following techniques:>> * Adjust the input data by dropping different features columns to ensure that no variables or outliers confuse the model.>> * Add more neurons (nodes) to a hidden layer.>> * Add more hidden layers.>> * Use different activation functions for the hidden layers.>> * Add to or reduce the number of epochs in the training regimen.2. After finishing your models, display the accuracy scores achieved by each model, and compare the results.3. Save each of your models as an HDF5 file.<jupyter_code># Imports
import pandas as pd
from pathlib import Path
import tensorflow as tf
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler,OneHotEncoder<jupyter_output>C:\Users\nehaja\Anaconda3\envs\dev\lib\site-packages\numpy\_distributor_init.py:32: UserWarning: loaded more than 1 DLL from .libs:
C:\Users\nehaja\Anaconda3\envs\dev\lib\site-packages\numpy\.libs\libopenblas.TXA6YQSD3GCQQC22GEQ54J2UDCXDXHWN.gfortran-win_amd64.dll
C:\Users\nehaja\Anaconda3\envs\dev\lib\site-packages\numpy\.libs\libopenblas.WCDJNK7YVMPZQ2ME2ZZHJJRJ3JIKNDB7.gfortran-win_amd64.dll
  stacklevel=1)<jupyter_text>--- Prepare the data to be used on a neural network model  Step 1: Read the `applicants_data.csv` file into a Pandas DataFrame. Review the DataFrame, looking for categorical variables that will need to be encoded, as well as columns that could eventually define your features and target variables.<jupyter_code># Read the applicants_data.csv file from the Resources folder into a Pandas DataFrame
applicant_data_df = pd.read_csv(Path("./Resources/applicants_data.csv"))

# Review the DataFrame
applicant_data_df.head()

# Review the data types associated with the columns
applicant_data_df.dtypes<jupyter_output><empty_output><jupyter_text>Step 2: Drop the “EIN” (Employer Identification Number) and “NAME” columns from the DataFrame, because they are not relevant to the binary classification model.<jupyter_code># Drop the 'EIN' and 'NAME' columns from the DataFrame
applicant_data_df = applicant_data_df.drop(columns=['EIN','NAME'])

# Review the DataFrame
applicant_data_df<jupyter_output><empty_output><jupyter_text>Step 3: Encode the dataset’s categorical variables using `OneHotEncoder`, and then place the encoded variables into a new DataFrame.<jupyter_code># Create a list of categorical variables 
categorical_variables = list(applicant_data_df.dtypes[applicant_data_df.dtypes == "object"].index)

# Display the categorical variables list
display(categorical_variables)
# Create a OneHotEncoder instance
enc = OneHotEncoder(sparse=False)

# Encode the categorcal variables using OneHotEncoder
encoded_data = enc.fit_transform(applicant_data_df[categorical_variables])

# Create a DataFrame with the encoded variables
encoded_df =pd.DataFrame(
    encoded_data,
    columns = enc.get_feature_names(categorical_variables)
)

# Review the DataFrame
encoded_df.head()<jupyter_output><empty_output><jupyter_text>Step 4: Add the original DataFrame’s numerical variables to the DataFrame containing the encoded variables.> **Note** To complete this step, you will employ the Pandas `concat()` function that was introduced earlier in this course.<jupyter_code># Add the numerical variables from the original DataFrame to the one-hot encoding DataFrame

encoded_df = pd.concat([encoded_df, applicant_data_df.drop(columns=categorical_variables)], axis = 1)
# Review the Dataframe
encoded_df.head()<jupyter_output><empty_output><jupyter_text>Step 5: Using the preprocessed data, create the features (`X`) and target (`y`) datasets. The target dataset should be defined by the preprocessed DataFrame column “IS_SUCCESSFUL”. The remaining columns should define the features dataset.<jupyter_code># Define the target set y using the IS_SUCCESSFUL column
y =encoded_df["IS_SUCCESSFUL"]

# Display a sample of y
y[:5]
# Define features set X by selecting all columns but IS_SUCCESSFUL
X = encoded_df.drop(columns=["IS_SUCCESSFUL"])

# Review the features DataFrame
X.head()<jupyter_output><empty_output><jupyter_text>Step 6: Split the features and target sets into training and testing datasets.<jupyter_code># Split the preprocessed data into a training and testing dataset
# Assign the function a random_state equal to 1
X_train, X_test, y_train, y_test = train_test_split(X,y, random_state=1)<jupyter_output><empty_output><jupyter_text>Step 7: Use scikit-learn's `StandardScaler` to scale the features data.<jupyter_code># Create a StandardScaler instance
scaler = StandardScaler()

# Fit the scaler to the features training dataset
X_scaler = scaler.fit(X_train)

# Fit the scaler to the features training dataset
X_train_scaled = X_scaler.transform(X_train)
X_test_scaled = X_scaler.transform(X_test)<jupyter_output><empty_output><jupyter_text>--- Compile and Evaluate a Binary Classification Model Using a Neural Network  Step 1: Create a deep neural network by assigning the number of input features, the number of layers, and the number of neurons on each layer using Tensorflow’s Keras.> **Hint** You can start with a two-layer deep neural network model that uses the `relu` activation function for both layers.<jupyter_code># Define the the number of inputs (features) to the model
number_input_features = len(X_train.iloc[0])

# Review the number of features
number_input_features

# Define the number of neurons in the output layer
number_output_neurons = 1
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer1 =  (number_input_features+number_output_neurons) // 2

# Review the number hidden nodes in the first layer
hidden_nodes_layer1

# Define the number of hidden nodes for the second hidden layer
hidden_nodes_layer2 =  (hidden_nodes_layer1+number_output_neurons) // 2

# Review the number hidden nodes in the second layer
hidden_nodes_layer2

# Create the Sequential model instance
nn = Sequential()

# Add the first hidden layer
nn.add(Dense(units=hidden_nodes_layer1, input_dim=number_input_features, activation="relu"))

# Add the second hidden layer
nn.add(Dense(units=hidden_nodes_layer2, activation="relu"))

# Add the output layer to the model specifying the number of output neurons and activation function
nn.add(Dense(units=number_output_neurons, activation="sigmoid"))

# Display the Sequential model summary
nn.summary()<jupyter_output>Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
dense (Dense)                (None, 58)                6786      
_________________________________________________________________
dense_1 (Dense)              (None, 29)                1711      
_________________________________________________________________
dense_2 (Dense)              (None, 1)                 30        
=================================================================
Total params: 8,527
Trainable params: 8,527
Non-trainable params: 0
_________________________________________________________________<jupyter_text>Step 2: Compile and fit the model using the `binary_crossentropy` loss function, the `adam` optimizer, and the `accuracy` evaluation metric.<jupyter_code># Compile the Sequential model
nn.compile(loss="binary_crossentropy",optimizer ="adam", metrics=["accuracy"])
# Fit the model using 50 epochs and the training data
fit_model = nn.fit(X_train_scaled, y_train, epochs =50)<jupyter_output>Epoch 1/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5756 - accuracy: 0.7203
Epoch 2/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5539 - accuracy: 0.7298
Epoch 3/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5501 - accuracy: 0.7305
Epoch 4/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5477 - accuracy: 0.7325
Epoch 5/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5464 - accuracy: 0.7328
Epoch 6/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5449 - accuracy: 0.7340
Epoch 7/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5442 - accuracy: 0.7343
Epoch 8/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5432 - accuracy: 0.7329
Epoch 9/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5422 - accuracy: 0.7345
Epoch 10/50
804/804 [==============================] - 1s 2ms/step - loss: 0.5426 - accuracy: 0.7350[...]<jupyter_text>Step 3: Evaluate the model using the test data to determine the model’s loss and accuracy.<jupyter_code># Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn.evaluate(X_test_scaled, y_test, verbose=2)

# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")<jupyter_output>268/268 - 0s - loss: 0.5569 - accuracy: 0.7301
Loss: 0.5568558573722839, Accuracy: 0.7301457524299622<jupyter_text>Step 4: Save and export your model to an HDF5 file, and name the file `AlphabetSoup.h5`.<jupyter_code># Set the model's file path
file_path =  Path("Resources/AlphabetSoup.h5")

# Export your model to a HDF5 file
nn.save(file_path)<jupyter_output><empty_output><jupyter_text>--- Optimize the neural network model  Step 1: Define at least three new deep neural network models (resulting in the original plus 3 optimization attempts). With each, try to improve on your first model’s predictive accuracy.> **Rewind** Recall that perfect accuracy has a value of 1, so accuracy improves as its value moves closer to 1. To optimize your model for a predictive accuracy as close to 1 as possible, you can use any or all of the following techniques:>> * Adjust the input data by dropping different features columns to ensure that no variables or outliers confuse the model.>> * Add more neurons (nodes) to a hidden layer.>> * Add more hidden layers.>> * Use different activation functions for the hidden layers.>> * Add to or reduce the number of epochs in the training regimen.  Alternative Model 1<jupyter_code># Define the the number of inputs (features) to the model
number_input_features_A1 = len(X_train.iloc[0])

# Review the number of features
number_input_features_A1
# Define the number of neurons in the output layer
number_output_neurons_A1 = 1
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer1_A1 = (number_input_features_A1+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the first layer
hidden_nodes_layer1_A1
# Define the number of hidden nodes for the additional hidden layers
hidden_nodes_layer2_A1 = (hidden_nodes_layer1_A1+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the additional layer
hidden_nodes_layer2_A1
# Define the number of hidden nodes for the additional hidden layers
hidden_nodes_layer3_A1 = (hidden_nodes_layer2_A1+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the additional layer
hidden_nodes_layer3_A1
# Define the number of hidden nodes for the additional hidden layers
hidden_nodes_layer4_A1 = (hidden_nodes_layer3_A1+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the additional layer
hidden_nodes_layer4_A1
# Define the number of hidden nodes for the additional hidden layers
hidden_nodes_layer5_A1 = (hidden_nodes_layer4_A1+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the additional layer
hidden_nodes_layer5_A1
# Create the Sequential model instance
nn_A1 = Sequential()
# First hidden layer
nn_A1.add(Dense(units=hidden_nodes_layer1_A1, input_dim=number_input_features, activation="relu"))
nn_A1.add(Dense(units=hidden_nodes_layer2_A1, activation="relu"))
nn_A1.add(Dense(units=hidden_nodes_layer3_A1, activation="relu"))
nn_A1.add(Dense(units=hidden_nodes_layer4_A1, activation="relu"))
nn_A1.add(Dense(units=hidden_nodes_layer5_A1, activation="relu"))
# Output layer
nn_A1.add(Dense(units=number_output_neurons, activation="sigmoid"))


# Check the structure of the model
nn_A1.summary()
# Compile the Sequential model
nn_A1.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

# Fit the model using 50 epochs and the training data
fit_model_A1 = nn_A1.fit(X_train_scaled, y_train, epochs=50)<jupyter_output>Epoch 1/50
804/804 [==============================] - 3s 2ms/step - loss: 0.5810 - accuracy: 0.7155
Epoch 2/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5527 - accuracy: 0.7304
Epoch 3/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5494 - accuracy: 0.7329
Epoch 4/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5469 - accuracy: 0.7335
Epoch 5/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5453 - accuracy: 0.7329
Epoch 6/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5445 - accuracy: 0.7350
Epoch 7/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5431 - accuracy: 0.7352
Epoch 8/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5429 - accuracy: 0.7354
Epoch 9/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5419 - accuracy: 0.7363
Epoch 10/50
804/804 [==============================] - 2s 2ms/step - loss: 0.5413 - accuracy: 0.7360[...]<jupyter_text>Alternative Model 2<jupyter_code># Define the the number of inputs (features) to the model
number_input_features_A2 = len(X_train.iloc[0])

# Review the number of features
number_input_features_A2
# Define the number of neurons in the output layer
number_output_neurons_A2 = 1
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer1_A2 = (number_input_features_A2+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the first layer
hidden_nodes_layer1_A2
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer2_A2 = (hidden_nodes_layer1_A2+number_output_neurons_A1) // 2

# Review the number of hidden nodes in the first layer
hidden_nodes_layer2_A2
# Create the Sequential model instance
nn_A2 = Sequential()
# First hidden layer
nn_A2.add(Dense(units=hidden_nodes_layer1_A2, input_dim=number_input_features, activation="relu"))
nn_A2.add(Dense(units=hidden_nodes_layer2_A2, activation="relu"))
# Output layer
nn_A2.add(Dense(units=number_output_neurons, activation="linear"))

# Check the structure of the model
nn_A2.summary()

# Compile the model
nn_A2.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

# Fit the model
fit_model_A2 = nn_A2.fit(X_train_scaled, y_train, epochs=100)

#### Alternative Model 3
# Define the the number of inputs (features) to the model
number_input_features_A3 = len(X_train.iloc[0])

# Review the number of features
number_input_features_A3

# Define the number of neurons in the output layer
number_output_neurons_A3 = 1
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer1_A3 = (number_input_features_A3 + number_output_neurons_A3) // 2

# Review the number of hidden nodes in the first layer
hidden_nodes_layer1_A3
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer2_A3 = (hidden_nodes_layer1_A3 + number_output_neurons_A3) // 2

# Review the number of hidden nodes in the first layer
hidden_nodes_layer2_A3
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer3_A3 = (hidden_nodes_layer2_A3 + number_output_neurons_A3) // 2

# Review the number of hidden nodes in the first layer
hidden_nodes_layer3_A3

# Create the Sequential model instance
nn_A3 = Sequential()
# First hidden layer
nn_A3.add(Dense(units=hidden_nodes_layer1_A3, input_dim=number_input_features, activation="LeakyReLU"))

# Output layer
nn_A3.add(Dense(units=1, activation="sigmoid"))

# Check the structure of the model
nn_A3.summary()
# Compile the model
nn_A3.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])
# Fit the model
fit_model_A3 = nn_A3.fit(X_train_scaled, y_train, epochs=80)
#### Alternative Model 4
# Define the the number of inputs (features) to the model
number_input_features_A4 = len(X_train.iloc[0])

# Review the number of features
number_input_features_A4

# Define the number of neurons in the output layer
number_output_neurons_A4 = 1
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer1_A4 = (number_input_features_A4 + number_output_neurons_A4) // 3

# Review the number of hidden nodes in the first layer
hidden_nodes_layer1_A4

# Create the Sequential model instance
nn_A4 = Sequential()
# First hidden layer
nn_A4.add(Dense(units=hidden_nodes_layer1_A4, input_dim=number_input_features, activation="relu"))

# Output layer
nn_A4.add(Dense(units=1, activation="sigmoid"))

# Check the structure of the model
nn_A4.summary()

# Compile the model
nn_A4.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])
# Fit the model
fit_model_A4 = nn_A4.fit(X_train_scaled, y_train, epochs=120)<jupyter_output>Epoch 1/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5887 - accuracy: 0.7114
Epoch 2/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5584 - accuracy: 0.7276: 0s - loss: 0.562
Epoch 3/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5532 - accuracy: 0.7306
Epoch 4/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5516 - accuracy: 0.7311
Epoch 5/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5506 - accuracy: 0.7307
Epoch 6/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5494 - accuracy: 0.7314
Epoch 7/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5486 - accuracy: 0.7318
Epoch 8/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5475 - accuracy: 0.7311: 0s - loss: 0.5459 - accuracy: 
Epoch 9/120
804/804 [==============================] - 1s 1ms/step - loss: 0.5472 - accuracy: 0.7311
Epoch 10/120
804/804 [===================[...]<jupyter_text>Step 2: After finishing your models, display the accuracy scores achieved by each model, and compare the results.<jupyter_code>print("Original Model Results")

# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn.evaluate(X_test_scaled, y_test, verbose=2)

# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")
print("Alternative Model 1 Results")

# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn_A1.evaluate(X_test_scaled, y_test, verbose=2)

# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")
print("Alternative Model 2 Results")

# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn_A2.evaluate(X_test_scaled, y_test, verbose=2)

# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")
print("Alternative Model 3 Results")

# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn_A3.evaluate(X_test_scaled, y_test, verbose=2)

# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")
print("Alternative Model 4 Results")

# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn_A4.evaluate(X_test_scaled, y_test, verbose=2)

# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")<jupyter_output>Alternative Model 4 Results
268/268 - 0s - loss: 0.5638 - accuracy: 0.7294
Loss: 0.5638464689254761, Accuracy: 0.7294460535049438<jupyter_text>Step 3: Save each of your alternative models as an HDF5 file.<jupyter_code># Set the file path for the first alternative model
file_path = Path("Resources/alternative1.h5")

# Export your model to a HDF5 file
nn_A1.save(file_path)

# Set the file path for the second alternative model
file_path =Path("Resources/alternative2.h5")

# Export your model to a HDF5 file
nn_A2.save(file_path)

# Set the file path for the third alternative model
file_path =Path("Resources/alternative3.h5")

# Export your model to a HDF5 file
nn_A3.save(file_path)
# Set the file path for the fourth alternative model
file_path =Path("Resources/alternative4.h5")

# Export your model to a HDF5 file
nn_A4.save(file_path)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup