I - 6 Introduction to TensorFlow

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is the significance of tf.Variable()? 1. A tf.Variable represents a tensor whose value can be changed by running ops on it. Specific ops allow you to read and modify the values of this tensor. Higher level libraries like tf.keras use tf.Variable to store model parameters. 2. It is a general-purpose mathematical operations processing package. 3. It is a function used to define integer data. 4. None of the above

1. A tf.Variable represents a tensor whose value can be changed by running ops on it. Specific ops allow you to read and modify the values of this tensor. Higher level libraries like tf.keras use tf.Variable to store model parameters.

Question 4 How can we solve the problem called internal covariate shift? 1. Batch normalization 2. Weight regularization 3. Both A and B 4. None of the above.

1. Batch normalization

How does regularization help build generalizable models ? 1. By adding dropout layers to our neural networks. 2. By using image processing APIS to find out accuracy. 3. Both A & B 4. None of the above.

1. By adding dropout layers to our neural networks.

A tf.data.Dataset allows you to:

1. Create data pipelines from - in-memory dictionary and lists of tensors -out-of-memory sharded data files 2. Preprocess data in parallel (and cache result of costly operations) dataset = dataset.map(preproc_fun).cache() 3. Configure the way the data is fed into a model with a number of chaining methods dataset = dataset.shuffle(1000).repeat(epochs).batch(batch_size, drop_remainder = True) in an easy and very compact way

What is the significance of the Fit method while training a Keras model ? 1. Defines the number of steps per epochs 2. Defines the number of epochs 3. Define the validation steps 4. Defines the batch size

1. Defines the number of steps per epochs

Which of the following statements is true? 1. L2 regularization will keep the weight values smaller and L1 regularization will make the model sparser by dropping poor features. 2. L1 regularization will keep the weight values smaller and L2 regularization will make the model sparser by dropping poor features. 3. Both A and B 4. None of the above

1. L2 regularization will keep the weight values smaller and L1 regularization will make the model sparser by dropping poor features.

The Keras Functional API can be characterized by having: 1. Multiple inputs and outputs and models with shared layers. 2. Single inputs and outputs and models with shared layers. 3. Multiple inputs and outputs and models with non-shared layers. 4. None of the above.

1. Multiple inputs and outputs and models with shared layers.

The predict function in the tf.keras API returns what? 1. Numpy array(s) of predictions 2. Input_samples of predictions 3. Both A & B 4. None of the above

1. Numpy array(s) of predictions

Which of the following statements is true? 1. SavedModel is a universal serialization format for TensorFlow models. SavedModel provides a "language neutral format" to save your machine learning models that is both recoverable and hermetic. 2. SavedModel is a proprietary serialization format for TensorFlow models. SavedModel provides a "proprietary language protocol" to save your machine learning models that is both recoverable and hermetic. 3. Both A and B 4. None of the above

1. SavedModel is a universal serialization format for TensorFlow models. SavedModel provides a "language neutral format" to save your machine learning models that is both recoverable and hermetic.

Which is an example of a rank 2 tensor? 1. Shape: [3,4] 2. Shape: [3,4,5] 3. Shape: [3] 4. Shape: [ ]

1. Shape: [3,4]

Which dataset is used to instantiate a Dataset object which is comprised of lines from one or more text files? 1. TextLineDataset 2. TFRecordDataset 3. FixedLengthRecordDataset 4. All of the above

1. TextLineDataset

Which of the following is correct regarding the Keras Functional API? 1. The input layer needs to have shape (p,) where p is the number of columns in your training matrix. For example: inputs = Input(shape=(3,)) 2. The input layer needs to have shape (). For example: inputs = Input(shape=()) 3. Both A and B 4. None of the above

1. The input layer needs to have shape (p,) where p is the number of columns in your training matrix. For example: inputs = Input(shape=(3,))

Which statement is true? 1. To serve our model for others to use, we export the model file and deploy the model as a service. 2. To serve our model for others to use, we zip the model file and deploy the model as a JSON request. 3. Both A & B 4. None of the above.

1. To serve our model for others to use, we export the model file and deploy the model as a service.

How can we improve the calculation speed in TensorFlow, without losing accuracy? 1. Using GPU 2. By doing random sampling on Tensors 3. By removing few nodes from computational graphs 4. By removing the hidden layers

1. Using GPU

How does TensorFlow represent numeric computations? 1. Using a Directed Acyclic Graph (or DAG) 2. Flow chart 3. Both A and B 4. None of the above

1. Using a Directed Acyclic Graph (or DAG)

How to Input Feature Columns to a Keras Model? 1. We can use a DenseFeatures layer to input them to a Keras model. 2. We can split the required columns into several buckets using a bucketized column. 3. Both A and B. 4. None of the above.

1. We can use a DenseFeatures layer to input them to a Keras model.

Weaknesses of the Keras Functional API

1. doesn't support dynamic architectures 2. sometimes you have to write from scratch and you need to build subclasses. e.g. custom training or inference layers

Strengths of the Keras Functional API

1. less verbose than using keras.Model subclasses 2. validates your model while you're defining it 3. your model is plottable and inspectable 4. your model can be serialized or cloned

Which API is used to build performant, complex input pipelines from simple, re-usable pieces that will feed your model's training or evaluation loops. 1. tf.Tensor 2. tf.data.Dataset 3. tf.device 4. All of the above

1. tf.Tensor

Vector

1D array

The activations in regularization is scaled by which of the following ? 1. 1 / (1 - accuracy) 2. 1 / (1 - dropout probability) 3. 1 / (1 - loss value) 4. None of the above.

2. 1 / (1 - dropout probability)

Choose the correct workflow to serve your model in the cloud. 1. Create the model ---> save your model --> serve your model 2. Create the model ---> train and evaluate your model --> save your model --> serve your model 3. Create the model ---> save your model --> train and evaluate your model --> serve your model 4. None of the above.

2. Create the model ---> train and evaluate your model --> save your model --> serve your model

The dataset object which has fixed-length records from one or more binary files? 1. TextLineDataset 2. FixedLengthRecordDataset 3. All of the above

2. FixedLengthRecordDataset

What is the role of the tf.data API in TensorFlow? 1. It covers training, evaluation, and prediction (inference) models. 2. It enables you to build complex input pipelines from simple, reusable pieces. 3. It distributes training across multiple GPUs, multiple machines or TPUs. 4. It makes graphs out of your programs.

2. It enables you to build complex input pipelines from simple, reusable pieces.

What is TensorFlow Data Validation? 1. It is an algorithm that is used to perform ML operations. 2. It is a tool that can be used to analyze data to find potential problems in data. 3. It is an open-source library used in ML. 4. None of the above.

2. It is a tool that can be used to analyze data to find potential problems in data.

Which model is appropriate for a plain stack of layers ? 1. Keras 2. Sequential 3. Functional 4. None of the above.

2. Sequential

The _____________________ format is a simple format for storing a sequence of binary records. Using _________ can be useful for standardizing input data and optimizing performance. 1. TextLineDataset 2. TFRecordDataset 3. FixedLengthRecordDataset 4. All of the above

2. TFRecordDataset

Select the correct statement regarding the Keras Functional API. 1. Unlike the Keras Sequential API, we do not have to provide the shape of the input to the model. 2. Unlike the Keras Sequential API, we have to provide the shape of the input to the model. 3. The Keras Functional API does not provide a more flexible way for defining models. 4. None of the above.

2. Unlike the Keras Sequential API, we have to provide the shape of the input to the model.

During the training process, each additional layer in your network can successively reduce signal vs. noise. How can we fix this? 1. Use non-saturating, linear activation functions. 2. Use non-saturating, nonlinear activation functions such as ReLUs. 3. Sigmoid or tanh activation functions. 4. None of the above

2. Use non-saturating, nonlinear activation functions such as ReLUs.

Question 4 Which of the following produces tensors that can be modified? 1. tf.constant 2. tf.Variable 3. Both A and B 4. None of the above

2. tf.Variable

Which statement is true? 1. Export model to a TensorFlow ZippedModel format to serve your model. 2. tf.saved_model.save --> zips a model file object to a SavedModel format. 3. (EXPORT_PATH) is the directory in which to write the SavedModel. 4. None of the above.

3. (EXPORT_PATH) is the directory in which to write the SavedModel.

How does Adam (optimization algorithm) help in compiling the Keras model? 1. By updating network weights iteratively based on training data. 2. By diagonal rescaling of the gradients. 3. Both A & B 4. None of the above.

3. Both A & B

What are the weaknesses of the Keras Functional API? 1. It doesn't support dynamic architectures. The Functional API treats models as DAGs of layers. This is true for most deep learning architectures, but not all: for instance, recursive networks or Tree RNNs do not follow this assumption and cannot be implemented in the Functional API. 2. Sometimes we have to write from scratch and need to build subclasses. When writing advanced achitectures, you may want to do things that are outside the scope of "defining a DAG of layers": for instance, you may want to expose multiple custom training and inference methods on your model instance. This requires subclassing. 3. Both A & B 4. None of the above

3. Both A & B

What are distinct ways to create a dataset? 1. A data source constructs a Dataset from data stored in memory or in one or more files. 2. A data transformation constructs a dataset from one or more tf.data.Dataset objects. 3. Both A and B 4. None of the above.

3. Both A and B

What operations can be performed on tensors? 1. They can be reshaped 2. They can be sliced 3. Both A and B 4. None of the above.

3. Both A and B

Which is an approximate equivalent of L2 regularization? 1. Training Data Set 2. Validation Data sets 3. Early Stopping 4. None of the above

3. Early Stopping

Which is true regarding feature columns? 1. Feature columns describe how the model should use raw output data from your features dictionary. 2. Feature columns describe how the model should use raw output data from your TPU's. 3. Feature columns describe how the model should use raw input data from your features dictionary. 4. Feature columns describe how the model should use a graph to plot a line. Trained Model

3. Feature columns describe how the model should use raw input data from your features dictionary.

The L2 regularization provides which of the following? 1. It subtracts a sum of the squared parameter weights term to the loss function. 2. It multiplies a sum of the squared parameter weights term to the loss function. 3. It adds a sum of the squared parameter weights term to the loss function. 4. None of the above

3. It adds a sum of the squared parameter weights term to the loss function.

The activation function which is linear in the positive domain and the function is 0 in the negative domain? 1. A: Sigmoid 2. Tan-h 3. ReLU 4. None of the above.

3. ReLU

In the training phase of ML, which component is not a part of the training phase? 1. Labeled Data 2. ML Algorithm 3. Served Model 4. Trained Model

3. Served Model

Select the correct statement regarding the Keras Sequential and Functional API's. 1. The core data structure of Keras is a model, which let us organize and design layers. Sequential and Functional are two ways to build Keras models. The Sequential model is the most complex type of model (a linear stock of layers). If we need to build arbitrary graphs of layers, the Keras Sequential API can do that for us. 2. If we need to build arbitrary graphs of layers, both the Keras Sequential and Functional API can do that for us. 3. The core data structure of Keras is a model, which let us organize and design layers. Sequential and Functional are two ways to build Keras models. The Sequential model is the simplest type of model (a linear stock of layers). If we need to build arbitrary graphs of layers, the Keras Functional API can do that for us. 4. If we need to build arbitrary graphs of layers, only the Keras Sequential API can do that for us.

3. The core data structure of Keras is a model, which let us organize and design layers. Sequential and Functional are two ways to build Keras models. The Sequential model is the simplest type of model (a linear stock of layers). If we need to build arbitrary graphs of layers, the Keras Functional API can do that for us.

Tensor

3D tensor

Please select all TRUE statements. Note that an answer may be deemed "partially correct" but true. 1. A bucketized column helps with discretizing continuous feature values. 2. Feature columns describes how the model should use raw input data from your features dictionary. 3. A feature column provides methods for the input data to be properly transformed before sending it to a model for training. 4. All of the above

4. All of the above

The Keras Functional API provides which of the following? 1. It allows you to define multiple input or output models. 2. It allows you to define ad hoc acyclic network graphs. 3. It allows you to define a model that shares layers. 4. All of the above

4. All of the above

What are the multiple ways to feed TensorFlow models with data? 1. TextLineDataset 2. TFrecordDataset 3. FixedLengthRecordDataset 4. All of the above

4. All of the above

When is the Keras Sequential model not appropriate? 1. Your model has multiple inputs or multiple outputs. 2. Any of your layers has multiple inputs or multiple outputs. 3. You need to do layer sharing or non-linear topology. 4. All of the above

4. All of the above

Which components are part of the ML pipeline? 1. Data Extraction 2. Data Analysis 3. Data Exploration 4. All of the above

4. All of the above

Which high level APIs are used for distributed training? 1. tf.estimator 2. tf.keras 3. tf.data 4. All of the above

4. All of the above

Which of the following are primary purposes of Neural Network embeddings? 1. Finding nearest neighbors in the embedding space. These can be used to make recommendations based on user interests or cluster categories. 2. As input to a machine learning model for a supervised task. 3. For visualization of concepts and relations between categories. 4. All of the above

4. All of the above

Which of the following is a type of feature column? 1. Categorical feature column 2. Bucketized feature column 3. Crossed feature column 4. All of the above

4. All of the above

Which of the following is true when we compute a loss gradient? 1. TensorFlow records all operations executed inside the context of a tf.GradientTape onto a tape. 2. It uses tape and the gradients associated with each recorded operation to compute the gradients. 3. The computed gradient of a recorded computation will be used in reverse mode differentiation. 4. All of the above

4. All of the above

Which processing units can you run TensorFlow? 1. CPU 2. GPU 3. TPU 4. All of the above

4. All of the above

What are the parameters involved while compiling the Keras model? 1. Optimizer 2. Loss function 3. Evaluation metrics 4. All of the above.

4. All of the above.

Which are useful components when building custom Neural Network models? 1. tf.losses 2. tf.metrics 3. tf.optimizers 4. All of the above.

4. All of the above.

You need to build a custom machine learning model. What are your options? 1. We will write the low-level session loop. 2. We can use an estimator. 3. We can use a high-level API such as Keras. 4. Both B and C

4. Both B and C

How can we stop ReLU layers from dying? 1. Smaller batch sizes 2. Batch normalization 3. Weight regularization 4. Lower your learning rates

4. Lower your learning rates

. Which of the following statements is true of TensorFlow? 1. TensorFlow is a scalable and single-platform programming interface for implementing and running machine learning algorithms, including convenience wrappers for deep learning. 2. Although able to run on other processing platforms, TensorFlow 2.0 is not yet able to run on Tensor Processing Units (or TPU's). 3. Although able to run on other processing platforms, TensorFlow 2.0 is not yet able to run on Graphical Processing Units (or GPU's). 4. TensorFlow is a scalable and multi platform programming interface for implementing and running machine learning algorithms, including convenience wrappers for deep learning.

4. TensorFlow is a scalable and multi platform programming interface for implementing and running machine learning algorithms, including convenience wrappers for deep learning.

Which method is invoked on the dataset - which triggers creation and execution of two operations? 1.batch 2. shuffle 3. map 4. iter

4. iter

Which of the following API's are not used in the TensorFlow abstraction layers? 1. C++ API 2. Python API 3. tf.keras 4. tf.image

4. tf.image

Rank 4 tensor

A 4D tensor

Tensor

An N-dimensional array of data

Definition of regularization

Any process that generalizes a model

DAG:

Directed acyclic graph

What is a Dropout layer

Dropout works by randomly "dropping out" unit activations in a network for a single gradient step. Helps learn "multiple paths" -- think: ensemble models, random forests.

Examples of regularization

Early Stopping Parameter Norm Penalties - L1 regularization - L2 regularization - Max-norm regularization Dataset Augmentation Noise Robustness Sparse Representations Dropout layers

Scalar

Ex: 1. A single value

True or False: From_tensors() combines the input and returns a dataset with a separate element while from_tensor_slices() creates a dataset with a single element for each row of the input tensor?

False

Which statement is correct? 1. In the Keras Functional API, models are created by specifying their inputs and outputs in a graph of layers. That means that a single graph of layers can be used to generate multiple models. 2. In the Keras Sequential API, models are created by specifying their inputs and outputs in a graph of layers. That means that a single graph of layers can be used to generate multiple models. 3. In the Keras Sequential and Functional API's, models are created by specifying their inputs and outputs in a graph of layers. That means that a single graph of layers can be used to generate multiple models. 4. None of the above

I. In the Keras Functional API, models are created by specifying their inputs and outputs in a graph of layers. That means that a single graph of layers can be used to generate multiple models.

L1 vs L2 regularization: names and characteristics

L1 - Lasso - sends weights on less important features to zero - penalizes sum of absolute value of weights - has a sparse solution - has multiple solutions - has built-in feature selection - robust to outliers - generates models that are simple and interpretable but cannot learn complex patterns L2 - Ridge - minimizes weights on less important features but does not send them to zero. - penalizes sum of square weights. - has a non sparse solution - has one solution - has no feature selection - is not robust to outliers - gives better prediction when output variable is a function of all input features - able to learn complex data patterns NOTE: elastic net regularization is a combination of L1 and L2.

Matrix

Rank 2 tensor, a 2D array

What does fc.embedding_column do?

Takes sparse columns (often categorical) and represents them as lower-diminsional, dense vectors. Similar to eigenvectors in linear algebra.

What is the difference between batch and epoch in a neural network.

The batch size is the number of samples processed before the model is updated. The number of epochs is the number of complete passes through the training dataset. The size of a batch must be more than or equal to one and less than or equal to the number of samples in the training dataset. The number of epochs can be set to an integer value between one and infinity. You can run the algorithm for as long as you like and even stop it using other criteria besides a fixed number of epochs, such as a change (or lack of change) in model error over time. They are both integer values and they are both hyperparameters for the learning algorithm, e.g. parameters for the learning process, not internal model parameters found by the learning process. You must specify the batch size and number of epochs for a learning algorithm. There are no magic rules for how to configure these parameters. You must try different values and see what works best for your problem.

True or False: Non-linearity helps in training your model at a much faster rate and with more accuracy without the loss of your important information?

True

True or False: In TensorFlow, tensors are multi-dimensional arrays with a uniform type (called a dtype). All tensors are immutable like Python numbers and strings: you can never update the contents of a tensor, only create a new one.

True


Set pelajaran terkait

Macroeconomics Final Exam Ch. 13

View Set

Equilibrium, shortages, and surpluses

View Set

CPIM - SMR 1, SMR II, SMR III, SMR IV - Global Environment and Sustainability, SMR V - Infrastructure and Financial Measurement, SMR V - Operations Strategy, SMR Final Review, SMR Final Review, APICS - SMR Vocabulary, SMR - Strategic Management of Re...

View Set

The Cardiovascular System: The Heart

View Set

Chapter 22: Management of Patients With Upper Respiratory Tract Disorders

View Set

HESI PN Obstetrics/Maternity Practice Exam, Pediatrics HESI PN Review, Hesi Peds, PN HESI Peds, Peds & Maternity HESI, HESI Maternity/Pediatric Remediation

View Set

Physical Fitness Health Assignment

View Set

Chapter 19 and the Splendid Shield

View Set

joints/bone type/spinal quiz (visible body)

View Set

computer science tests + quizzes

View Set