Machine Learning

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

What is a labeled training set?

A labeled training set is a training set that contains the desired solution (a.k.a a label) for each instance.

What is the difference between a model parameter and a learning algorithm's hyperparameter?

A model has one or more model parameters that determine what it will predict given a new instance (e.g. the slope of a linear model). A learning algorithm tries to find optimal values for these parameters such that the model generalizes well to new instances. A hyperparameter is a parameter is a parameter of the learning algorithm itself, not of the model (e.g. the amount of regularization to apply).

What is a test set and why would you want to use it?

A test set is used to estimate the generalization error that a model will make on new instances, before the model is launched in production.

What is the purpose of a validation set?

A validation set is used to compare models. It makes it possible to select the best model and tune the hyperparameters.

What is the difference between a placeholder and a variable?

A variable is an operation that holds a value. If you run the variable, it returns that value. Before you can run it, you need to initialize it. You can change the variable's value. It is stateful: the variable keeps the same value upon successive runs of the graph. It is typically used to hold model parameters but for other purposes (e.g. to count the global training step). A placeholder technically doesn't do much: they just hold information about the type and shape of the tensor they represent, but they have no value. In fact, if you try to evaluate an operation that depends on a placeholder, you must feed TensorFlow the value of the placeholder (using feed_dict) or else you will get an exception. Placeholders are typically used to feed training or test data to TensorFlow during the execution phase. They are also useful to pass a value to an assignment node, to change the value of the variable.

When is a variable initialized? When is it destroyed?

A variable is initialized when you call its initializer, and it is destroyed when the session ends. In distributed TensorFlow, variables live in containers on the cluster, so closing a session will not destroy the variable. To destroy a variable, you need to clear its container.

What type of learning algorithm relies on a similarity measure to make predictions?

An instance-based learning systems learns the training data by heart; then, when given a new instance, it uses a similarity measure to find the most similar learned instances and uses them to make predictions.

What is an online learning system?

An online learning system can learn incrementally, as opposed to a batch learning system. This makes it capable of adapting rapidly to both changing data and autonomous systems, and of training on very large quantities of data.

Can you name four common unsupervised tasks?

Common unsupervised tasks include clustering, visualization, dimensionality reduction, and association rule learning.

What is cross-validation and why would you prefer it to a validation set?

Cross-validation is a technique that makes it possible to compare models (for model selection and hyperparameter tuning) without the need for a separate validation set. This saves precious training data.

If your model performs great on the training data but generalizes poorly to new instances, what is happening? Can you name three possible solutions?

If a model performs great on the training data but generalizes poorly to new instances, the model is likely overfitting the training data (or we got extremely lucky on the training data). Possible solutions to overfitting are getting more data, simplifying the model (selecting a simpler algorithm, reducing the number of parameters or features used, or regularizing the model), or reducing the noise in the training data.

What type of algorithm would you use to segment your customers into multiple groups?

If you don't know how to define the groups, then you can use a clustering algorithm (unsupervised learning) to segment your customers into clusters of similar customers. However, if you know what groups you would like to have, then you can feed many examples of each group to a classification algorithm (supervised learning), and it will classify all your customers into these groups.

What happens when you run the graph to evaluate an operation that depends on a placeholder but you don't feed its value? What happens if the operation doesn't depend on a placeholder.

If you run the graph to evaluate an operation that depends on a placeholder but you don't feed its value, you get an exception. If the operation does not depend on the placeholder, then no exception is raised.

What can go wront if you tune hyperparameters using the test set?

If you tune hyperparameters using the test set, you risk overfitting the test set, and the generalization error you measure will be optimistic (you may launch a model that performs worse than you expect).

How can you set a variable to any value you want (during the execution phase)?

If you want to change the variable to anything during the execution phase, you can use tf.assign() function, passing a variable and placeholder as parameters. import tensorflow as tf x = tf.Variable(tf.random_uniform(shape=(), minval=0.0, maxval=1.0) x_new_val = tf.placeholder(shape=(), dtype=tf.float32) x_assign = tf.assign(x, x_new_val) with tf.Session(): x.initializer.run() print(x.eval()) x_assign.eval(feed_dict={x_new_val: 5.0}) print(x.eval)) # 5.0

If you create a graph g containing a variable w, then start two threads and open a session in each thread, both using the same graph g, will each session have its own copy of the variable w or will it be shared?

In local TensorFlow, sessions manage variable values, so if you create a graph g containing a variable w, then start threads and open a local session in each thread, both using the same graph g, then each session will have its own copy of the variable w. However, in distributed TensorFlow, variable values are stored in containers managed by the cluster, so if both sessions connect to the same cluster and use the same container, they will share the same variable value for w.

How would you define machine learning?

Machine learning is about building systems that can learn from data. Learning means getting better at some task, given some performance measure.

Can you name four types of problems where it shines?

Machine learning is great for complex problems for which we have no algorithmic solution, to replace long lists of hand-tuned rules, to build systems that adapt to fluctuating environments, and finally to help humans learn (e.g. data mining).

What are the main benefits of creating a computation graph rather than directly executing the computations? What are the main drawbacks?

Main benefits: - TensorFlow can automatically compute the gradients for you (using reverse-mode autodiff) - Tensorflow can take care of running the operations in parallel in different threads - It makes it easier to run the same model across different devices - It simplifies introspection- for example, to view the model in TensorBoard Main drawbacks: -It makes the learning curve steeper -It makes step-by-step debugging harder

What do model-based learning algorithms search for? What is the most common strategy they use to succeed? How do they make predictions?

Model-based learning algorithms search for an optimal value for the model parameters such that the model will generalize well to new instances. We usually train such systems by minimizing a cost function that measures how bad the system is at making predictions on the training data, plus a penalty for model complexity if the model is regularlized. To make predictions, we feed the new instance's features into the model's prediction function, using the parameter values found by the learning algorithm.

Can you run two graphs in the same session?

No, only one graph per session.

What is out-of-core learning?

Out-of-core algorithms can handle vast quantities of data that cannot fit in a computer's main memory. An out-of-core learning algorithm chops the data into mini-batches and uses online learning techniques to learn from these mini-batches.

What type of Machine Learning algorithm would you use to allow a robot to walk in various unknown terrains?

Reinforcement Learning is likely to perform best if we want a robot to learn to walk in various unknown terrains since this is typically the type of problem that Reinforcement Learning tackles. It might be possible to express the problem as a supervised or semisupervised learning problem, but it would be less natural.

Can you name four of the main challenges in Machine Learning?

Some of the main challenges in Machine Learning are the lack of data, poor data quality, non-representative data, uninformative features, excessively simple models that under-fit the training data, and excessively complex models that overfit the data.

Would you frame the problem of spam detection as a supervised learning problem or an unsupervised learning problem?

Spam detection is a typical supervised learning problem: the algorithm is fed many emails along with their label (spam or not spam).

Is the statement a_val, b_val = a.eval(session=sess), b.eval(session=sess) equivalent to a_val, b_val = sess.run([a,b])

The first statement runs two separate graphs, whereas the second runs only one. If any of the operations are modified, then the effects will be different. If they don't have side effects, both statements will return the same result, but the second statement will be faster than the first.

What are the two most common supervised tasks?

The two most common supervised task are regression and classification.

When you run a graph, can you feed the output value of any operation, or just the value of the placeholders?

When you run a graph, you can feed the output value of any operation, not just the value of placeholders. In practice, however, this is rather rare (it can be useful, for example, when you are caching the output of frozen layers)

Is the statement a_val = a.eval(session=sess) equivalent to a_val = sess.run(a)?

Yes, they are equivalent


Set pelajaran terkait

ASVAB - Arithmetic Reasoning/Mathematics Knowledge

View Set

Chapter 14-15 Worksheet: True & False

View Set

Nutrition in Adolescence, the Adult Years and Aging

View Set

PFLAG National Glossary of Terms

View Set

Microeconomics Chap 19 (self-test)

View Set