1. Question 1 Lambda layer allows to execute an arbitrary function only within a Sequential API model. False True Answer: False 2. Question 2 Which one of the following is the correct syntax for mapping an increment of 2 to the value of “x” using a Lambda layer? (tf = Tensorflow) tf.keRead more
1.
Question 1
Lambda layer allows to execute an arbitrary function only within a Sequential API model.
False
True
Answer: False
2.
Question 2
Which one of the following is the correct syntax for mapping an increment of 2 to the value of “x” using a Lambda layer? (tf = Tensorflow)
One drawback of Lambda layers is that you cannot call a custom built function from within them.
True
False
Answer: False
4.
Question 4
A Layer is defined by having “States” and “Computation”. Consider the following code and check all that are true:
def call(self, inputs): performs the computation and is called when the Class is instantiated.
You use def build(self, input_shape): to create the state of the layers and specify local input states.
After training, this class will return a w*X + b computation, where X is the input, w is the weight/kernel tensor with trained values, and b is the bias tensor with trained values.
In def __init__(self, units=32): you use the super keyword to initialize all of the custom layer attributes
Answer: You use def build(self, input_shape): to create the state of the layers and specify local input states.
5.
Question 5
Consider the following code snippet.
What are the function modifications that are needed for passing an activation function to this custom layer implementation?
1. Question 1 One of the ways of declaring a loss function is to import its object. Is the following code correct for using a loss object? True False Answer: False 2. Question 2 It is possible to add parameters to the object call when using the loss object. True False Answer: True Read more
1.
Question 1
One of the ways of declaring a loss function is to import its object. Is the following code correct for using a loss object?
True
False
Answer: False
2.
Question 2
It is possible to add parameters to the object call when using the loss object.
True
False
Answer: True
3.
Question 3
You learned that you can do hyperparameter tuning within custom-built loss functions by creating a wrapper function around the loss function with hyperparameters defined as its parameter. What is the purpose of creating a wrapper function around the original loss function?
No particular reason, it just looks neater this way.
The loss ( model.compile(…, loss = ) ) expects a function that is only a wrapper function to the loss function itself.
That’s one way of doing it. We can also do the same by passing y_true, y_pred and threshold as parameters to the loss function itself.
The loss ( model.compile(…, loss = ) ) expects a function with two parameters, y_true and y_pred, so it is not possible to pass a 3rd parameter (threshold) to the loss function itself. This can be achieved by creating a wrapper function around the original loss function.
Answer:The loss ( model.compile(…, loss = ) ) expects a function with two parameters, y_true and y_pred, so it is not possible to pass a 3rd parameter (threshold) to the loss function itself. This can be achieved by creating a wrapper function around the original loss function.
4.
Question 4
One other way of implementing a custom loss function is by creating a class with two function definitions, init and call.
Which of the following is correct?
We pass y_true and y_pred to the init function, the hyperparameter (threshold) to the call function.
We pass the hyperparameter (threshold) , y_true and y_pred to the call function, and the init function returns the call function.
We pass the hyperparameter (threshold) to the init function, y_true and y_pred to the call function.
We pass the hyperparameter (threshold) , y_true and y_pred to the init function, and the call function returns the init function.
Answer:We pass the hyperparameter (threshold) to the init function, y_true and y_pred to the call function.
5.
Question 5
The formula for the contrastive loss, the function that is used in the siamese network for calculating image similarity, is defined as following:
Check all that are true:
If the euclidean distance between the pair of images is low then it means the images are similar.
Y is the tensor of details about image similarities.
Ds are 1 if images are similar, 0 if they are not.
Margin is a constant that we use to enforce a maximum distance between the two images in order to consider them similar or different from one another.
Answer:
Y is the tensor of details about image similarities.
If the euclidean distance between the pair of images is low then it means the images are similar.
Question 1 Which of these steps are needed for building a model with the Functional API? (Select three from the list below) Explicitly define an input layer to the model. Define the input layer of the model using any Keras layer class (e.g., Flatten(), Dense(), …) Define disconnected intermediate laRead more
Question 1
Which of these steps are needed for building a model with the Functional API? (Select three from the list below)
Explicitly define an input layer to the model.
Define the input layer of the model using any Keras layer class (e.g., Flatten(), Dense(), …)
Define disconnected intermediate layers of the model.
Connect each layer using python functional syntax.
Define the model using the input and output layers.
Define the model using only the output layer(s).
Answer:1, 4, 5(Answer)
Question 2
Is the following code correct for building a model with the Sequential API?
False
True
Answer:False
3.
Question 3
Only a single input layer can be defined for a functional model.
False
True
Answer: False
4.
Question 4
What are Branch Models ?
A model architecture with a single recurring path.
A model architecture where you can split the model into different paths, and cannot merge them later.
A model architecture with non-linear topology, shared layers, and even multiple inputs or outputs.
A model architecture with linear stack of layers.
Answer:A model architecture with non-linear topology, shared layers, and even multiple inputs or outputs.
5.
Question 5
One of the advantages of the Functional API is the option to build branched models with multiple outputs, where different loss functions can be implemented for each output.
True
False
Answer: True
6.
Question 6
A siamese network architecture has:
2 inputs, 2 outputs
1 input, 1 output
2 inputs, 1 output
1 input, 2 outputs
Answer: 2 inputs, 1 output
7.
Question 7
What is the output of each twin network inside a Siamese Network architecture?
A softmax probability
An output vector
Binary value, 1 or 0
A number
Answer:An output vector
8.
Question 8
What is the purpose of using a custom contrastive loss function for a siamese model?
A custom loss function is required for using the RMSprop() optimizer.
As a custom built function, it provides better results and it is faster to run.
A custom built function is required because it is not possible to use a built-in loss function with the Lambda layer.
It is a custom built function that can calculate the loss on similarity comparison between two items.
Answer: It is a custom built function that can calculate the loss on similarity comparison between two items.
TensorFlow Advanced Techniques Specialization
1. Question 1 Lambda layer allows to execute an arbitrary function only within a Sequential API model. False True Answer: False 2. Question 2 Which one of the following is the correct syntax for mapping an increment of 2 to the value of “x” using a Lambda layer? (tf = Tensorflow) tf.keRead more
1.
Question 1
Lambda layer allows to execute an arbitrary function only within a Sequential API model.
False
True
Answer: False
2.
Question 2
Which one of the following is the correct syntax for mapping an increment of 2 to the value of “x” using a Lambda layer? (tf = Tensorflow)
tf.keras.layers.Lambda(x: tf.math.add(x, 2.0))
tf.keras.layers.Lambda(lambda x: tf.math.add(x, 2.0))
tf.keras.Lambda(x: tf.math.add(x, 2.0))
tf.keras.layers(lambda x: tf.math.add(x, 2.0))
Answer: tf.keras.layers.Lambda(lambda x: tf.math.add(x, 2.0))
3.
Question 3
One drawback of Lambda layers is that you cannot call a custom built function from within them.
True
False
Answer: False
4.
Question 4
A Layer is defined by having “States” and “Computation”. Consider the following code and check all that are true:
def call(self, inputs): performs the computation and is called when the Class is instantiated.
You use def build(self, input_shape): to create the state of the layers and specify local input states.
In def __init__(self, units=32): you use the super keyword to initialize all of the custom layer attributes
Answer: You use def build(self, input_shape): to create the state of the layers and specify local input states.
5.
Question 5
Consider the following code snippet.
What are the function modifications that are needed for passing an activation function to this custom layer implementation?
Answer:
def __init__(self, units=32, activation=None):
.
.
self.activation = tf.keras.activations.get(activation)
def call(self, inputs):
return self.activation(tf.matmul(inputs, self.w) + self.b)
See lessTensorFlow-Advanced-Techniques-Specialization Week2
1. Question 1 One of the ways of declaring a loss function is to import its object. Is the following code correct for using a loss object? True False Answer: False 2. Question 2 It is possible to add parameters to the object call when using the loss object. True False Answer: True Read more
1.
Question 1
One of the ways of declaring a loss function is to import its object. Is the following code correct for using a loss object?
True
False
Answer: False
2.
Question 2
It is possible to add parameters to the object call when using the loss object.
True
False
Answer: True
3.
Question 3
You learned that you can do hyperparameter tuning within custom-built loss functions by creating a wrapper function around the loss function with hyperparameters defined as its parameter. What is the purpose of creating a wrapper function around the original loss function?
No particular reason, it just looks neater this way.
The loss ( model.compile(…, loss = ) ) expects a function that is only a wrapper function to the loss function itself.
That’s one way of doing it. We can also do the same by passing y_true, y_pred and threshold as parameters to the loss function itself.
The loss ( model.compile(…, loss = ) ) expects a function with two parameters, y_true and y_pred, so it is not possible to pass a 3rd parameter (threshold) to the loss function itself. This can be achieved by creating a wrapper function around the original loss function.
Answer: The loss ( model.compile(…, loss = ) ) expects a function with two parameters, y_true and y_pred, so it is not possible to pass a 3rd parameter (threshold) to the loss function itself. This can be achieved by creating a wrapper function around the original loss function.
4.
Question 4
One other way of implementing a custom loss function is by creating a class with two function definitions, init and call.
Which of the following is correct?
We pass y_true and y_pred to the init function, the hyperparameter (threshold) to the call function.
We pass the hyperparameter (threshold) , y_true and y_pred to the call function, and the init function returns the call function.
We pass the hyperparameter (threshold) to the init function, y_true and y_pred to the call function.
We pass the hyperparameter (threshold) , y_true and y_pred to the init function, and the call function returns the init function.
Answer:We pass the hyperparameter (threshold) to the init function, y_true and y_pred to the call function.
5.
Question 5
The formula for the contrastive loss, the function that is used in the siamese network for calculating image similarity, is defined as following:
Check all that are true:
If the euclidean distance between the pair of images is low then it means the images are similar.
Y is the tensor of details about image similarities.
Ds are 1 if images are similar, 0 if they are not.
Margin is a constant that we use to enforce a maximum distance between the two images in order to consider them similar or different from one another.
Answer:
TensorFlow Advanced Techniques Specialization Week 1
Question 1 Which of these steps are needed for building a model with the Functional API? (Select three from the list below) Explicitly define an input layer to the model. Define the input layer of the model using any Keras layer class (e.g., Flatten(), Dense(), …) Define disconnected intermediate laRead more
Question 1
Which of these steps are needed for building a model with the Functional API? (Select three from the list below)
Explicitly define an input layer to the model.
Define the input layer of the model using any Keras layer class (e.g., Flatten(), Dense(), …)
Define disconnected intermediate layers of the model.
Connect each layer using python functional syntax.
Define the model using the input and output layers.
Define the model using only the output layer(s).
Answer: 1, 4, 5(Answer)
Question 2
Is the following code correct for building a model with the Sequential API?
False
True
Answer:False
3.
Question 3
Only a single input layer can be defined for a functional model.
False
True
Answer: False
4.
Question 4
What are Branch Models ?
A model architecture with a single recurring path.
A model architecture where you can split the model into different paths, and cannot merge them later.
A model architecture with non-linear topology, shared layers, and even multiple inputs or outputs.
A model architecture with linear stack of layers.
Answer:A model architecture with non-linear topology, shared layers, and even multiple inputs or outputs.
5.
Question 5
One of the advantages of the Functional API is the option to build branched models with multiple outputs, where different loss functions can be implemented for each output.
True
False
Answer: True
6.
Question 6
A siamese network architecture has:
2 inputs, 2 outputs
1 input, 1 output
2 inputs, 1 output
1 input, 2 outputs
Answer: 2 inputs, 1 output
7.
Question 7
What is the output of each twin network inside a Siamese Network architecture?
A softmax probability
An output vector
Binary value, 1 or 0
A number
Answer:An output vector
8.
Question 8
What is the purpose of using a custom contrastive loss function for a siamese model?
A custom loss function is required for using the RMSprop() optimizer.
As a custom built function, it provides better results and it is faster to run.
A custom built function is required because it is not possible to use a built-in loss function with the Lambda layer.
It is a custom built function that can calculate the loss on similarity comparison between two items.
Answer: It is a custom built function that can calculate the loss on similarity comparison between two items.
Select all of the things you can access from the Discover section of the Welcome screen (Select all that apply.)
Answer: 1.Go to a “how-to” video
Answer:
1.Go to a “how-to” video
See lessVersions of Tableau are forwards-compatible, but they are not backwards-compatible
Answer: False
Answer:
False
See lessWhat kinds of things can you do in the Discover section of the Welcome screen?
Answer: 3.Find how-to videos
Answer:
3.Find how-to videos
See less