variety of standard ML models with TF • Cover a few algorithms and frameworks • Spoiler: this is not a general ML survey • First three modules and first steps with TF • Content: videos, docs, Playground and Colab exercises. • Complete list: https://developers.google.com/machine-learning/crash-co urse/exercises 2
alone :) https://developers.google.com/machine-learning/crash-course Bugs found in the course? Great! Send them to: [email protected] May the force be with you! 3
• Python • Browser. Chrome? • Tensorflow https://www.tensorflow.org/install Colaboratory platform. Colaboratory is supported on most major browsers, and is most thoroughly tested on desktop versions of Chrome and Firefox. 4
input to produce useful predictions on never-before-seen data. • We are the teachers and the algorithms are our students. • Typical algorithms: linear regression, logistic regression, multi-class classification, support vector machines... 7
predicting, y. ◦ Variable y in basic linear regression • Feature: input variables describing our data: x i ◦ Variables {x 1 ,x 2 ,x 3 ,...x n } in basic linear regression 8
• Labeled example: {features, label}, (x, y) ◦ To train the model • Unlabeled example: {features, ?}, (x, ?) ◦ To make predictions on the new data (test) • Model: maps examples to predict labels: y’ ◦ Defined by internal parameters (learned) 9
is also called squared error = Square of the difference between prediction and label = (observation - prediction)2 = (y - y’)2 Penalizes large errors more strongly Mean Square Error: average squared loss per example over the whole dataset 17
to the weights and biases tells us how loss changes for a given example ◦ Simple to compute and convex • We can simply repeatedly take small steps in the direction that minimizes loss → Gradient Steps ◦ They are really negative gradient steps • Optimization strategy: Gradient Descent 20
entire dataset on each step, but this turns out to be not necessary • Computing gradient on small data samples works well ◦ On every step, get a new random sample • Stochastic gradient descent. One example at a time • Mini-Batch gradient descent. Batches 10-10000 ◦ Loss and gradients are averaged over the batch 30
object oriented API • tf.layers/tf.losses/tf.metrics provide reusable libraries for common model components • A low-level set of TF Python libraries provides operations, which wrap C++ kernels • Each kernel works on one or more platforms (GPU, CPU,...) 33
tf # Set up a linear classifier. classifier = tf.estimator.LinearClassifier(feature_columns) # Train the model on some example data. classifier.train(input_fn=train_input_fn, steps=2000) # Use it to predict. predictions = classifier.predict(input_fn=predict_input_fn) 34