Created
May 23, 2021 11:07
-
-
Save adhadse/956aad00f46af55309d6fdcce590d74c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WideAndDeepModel(keras.Model): | |
| def __init__(self, units=30, activation="relu", **kwargs): | |
| super().__init__(**kwargs) # handles standard aruments ( name, etc.) | |
| self.hidden1 = keras.layers.Dense(units, activation=activation) | |
| self.hidden2 = keras.layers.Dense(units, activation=activation) | |
| self.main_output = keras.layers.Dense(1) | |
| self.aux_output = keras.layers.Dense(1) | |
| def call(self, inputs): | |
| input_A, input_B = inputs | |
| hidden1 = self.hidden1(inputs_B) | |
| hidden2 = self.hidden2(hidden1) | |
| concat = keras.layers.Concatenate([input_A, hidden2]) | |
| main_ouput = self.main_ouput(concat) | |
| aux_ouput = self.aux_ouput(hidden2) | |
| return main_ouput, aux_output | |
| model = WideAndDeepModel() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment