freeCodeCamp - Machine Learning
What is a good way to increase the accuracy of a convolutional neural network?
- Augmenting the data you already have. - Using a pre-trained model.
Types of Tensors
- Variable - Placeholder - SparseTensor - Constant
What is a Vector?
- a tuple of one or more values called scalars - a quantity that has both magnitude and direction -Vectors are built from components, which are ordinary numbers. You can think of a vector as a list of numbers, and vector algebra as operations performed on the numbers in the list. -Vectors represent inputs like text and images as numbers, so that we can train and deploy our models.
When are Convolutional Neural Networks useful?
-If your data is made up of different 2D or 3D images. -If your data is text or sound based.
What is true about Recurrent Neural Networks?
-They maintain an internal memory/state of the input that was already processed. -RNN's contain a loop and process one piece of input at a time.
What are the main neural network components that make up a Long Short Term Memory network?
Prediction, ignoring, forgetting, and selection.
Why is it better to calculate the gradient (slope) directly rather than numerically?
It is computationally expensive to go back through the entire neural network and adjust the weights for each layer of the neural network.
What makes a Hidden Markov model different than linear regression or classification?
It uses probability distributions to predict future events or states.
Which type of analysis would be best suited for the following problem?: You have the average temperature in the month of March for the last 100 years. Using this data, you want to predict the average temperature in the month of March 5 years from now.
Linear Regression
What can happen if the agent does not have a good balance of taking random actions and using learned actions?
The agent will always try to maximize its reward for the current state/action, leading to local maxima.
A densely connected neural network is one in which...:
All the neurons in the current layer are connected to every neuron in the previous layer
Flowing
not a type of tensor
What is an optimizer function?
A function that implements the gradient descent and backpropagation algorithms for you.
Fill in the blanks below to save your model's checkpoints in the ./checkpoints directory and call the latest checkpoint for training: checkpoint_dir = __A__ checkpoint_prefix = os.path.join(checkpoint_dir, 'ckpt_{epoch}') checkpoint_callback = tf.keras.callbacks.__B__( filepath=checkpoint_prefix, save_weights_only=True ) history = model.fit(data, epochs=2, callbacks=[__C__])
A: './checkpoints' B: ModelCheckpoint C: checkpoint_callback
Fill in the blanks below to create the training examples for the RNN: char_dataset = tf.data.__A__.__B__(text_as_int)
A: Dataset B: from_tensor_slices
Fill in the blanks below to complete the build_model function: def build_mode(vocab_size, embedding_dim, rnn_units, batch_size): model = tf.keras.Sequential([ tf.keras.layers.Embedding(vocab_size, embedding_dim, batch_input_shape=[batch_size, None]), tf.keras.layers.__A__(rnn_units, return_sequences=__B__, recurrent_initializer='glorot_uniform), tf.keras.layers.Dense(__C__) ]) __D__
A: LSTM B: True C: vocab_size D: return model
Fill in the blanks below to complete the architecture for a convolutional neural network: model = models.__A__() model.add(layers.__B__(32, (3, 3), activation='relu', input_shape=(32, 32, 3))) model.add(layers.__C__(2, 2)) model.add(layers.__B__(64, (3, 3), activation='relu')) model.add(layers.__C__(2, 2)) model.add(layers.__B__(32, (3, 3), activation='relu')) model.add(layers.__C__(2, 2))
A: Sequential B: Conv2D C: MaxPooling2D
Fill in the blanks below to use Google's pre-trained MobileNet V2 model as a base for a convolutional neural network: base_model=tf.__A__.applications.__B__(input_shape=(160, 160, 3), include_top=__C__, weights='imagenet' )
A: keras B: MobileNetV2 C: False
Fill in the blanks below to build a sequential model of dense layers: model = __A__.__B__([ __A__.layers.Flatten(input_shape=(28, 28)), __A__.layers.__C__(128, activation='relu'), __A__.layers.__C__(10, activation='softmax') ])
A: keras B: Sequential C: Dense
Fill in the blanks to complete the following Q-Learning equation: Q[__A__, __B__] = Q[__A__, __B__] + LEARNING_RATE * (reward + GAMMA * np.max(Q[__C__, :]) - Q[__A__, __B__])
A: state B: action C: next_state
Fill in the blanks below to create the model for the RNN: model = __A__.keras.Sequential([ __A__.keras.layers.__B__(88584, 32), __A__.keras.layers.__C__(32), __A__.keras.layers.Dense(1, activation='sigmoid') ])
A: tf B: Embedding C: LSTM
What is categorical data?
Any data that is not numeric.
What does the pandas .head() function do?
By default, shows the first five rows or entries in a data frame.
How should you assign weights to input neurons before training your network for the first time?
Completely randomly not from smallest to largest, or alphabetically
What kind of estimator/model does TensorFlow recommend using for classification?
DNNClassifier
(T or F) Neural networks are modeled after the way the human brain works.
False
When are Convolutional Neural Networks not useful?
If your data can't be made to look like an image, or if you can rearrange elements of your data and it's still just as useful.
What are the three main properties of each convolutional layer?
Input size, the number of filters, and the sample size of the filters.
K-Means algorithm parts
Step 1: Randomly pick K points to place K centroids Step 2: Assign all the data points to the centroids by distance. The closest centroid to a point is the one it is assigned to. Step 3: Average all the points belonging to each centroid to find the middle of those clusters (center of mass). Place the corresponding centroids into that position. Step 4: Reassign every point once again to the closest centroid. Step 5: Repeat steps 3-4 until no point changes which centroid it belongs to.
Which activation function squishes values between -1 and 1?
Tanh (Hyperbolic Tangent)
Tensor
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.
What are epochs?
The number of times the model will see the same data.
What is classification?
The process of separating data points into different classes.
(T or F) Computer programs that play tic-tac-toe or chess against human players are examples of simple artificial intelligence.
True
(T or F) Machine learning is a subset of artificial intelligence.
True
What is not a good way to increase the accuracy of a convolutional neural network?
What is not a good way to increase the accuracy of a convolutional neural network?
Word embeddings are...
a vectorized representation of words in a given document that places words with similar meanings near each other
Dense neural networks....
analyze input on a global scale and recognize patterns in specific areas
Natural Language Processing is a branch of artificial intelligence that...
deals with how computers understand and process natural/human languages
The key components of reinforcement learning are...
environment, agent, state, action, and reward
Most people that are experts in AI or machine learning usually...:
have one specialization.
Convolutional neural networks...
scan through the entire input a little at a time and learn local patterns
What TensorFlow module should you import to implement .HiddenMarkovModel()?
tensorflow_probability
Before you make a prediction with your own review, you should...
use the encodings from the training dataset to encode your review.
