



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Capacity: How many different shapes a model family can draw Generalization error: expected error on new data from the same source (cannot measure on trainsing rows, and is the only error that matters) Hyperparameter: a setting chosen before fitting that the fit cannot learn by itself. THe number of clusters k, the penalty λ Bias: Error that comes from the model family. ( a meter that always reads 2degrees): the error of average fit, High bias makes similar mistakes for every training set. TO cut bias, add capacity (a curve of more features) Variance: error that comes form the training set you happen to get: refit on fresh data and the model changes a lot. Variance changes from one set to the next. More data shrinks variance Regularization: any change to the fitting rule that trades little bias for less variance. (a penalty on the size of the weights)
High bias: Not enough degrees to fit the truth. (cannot bend enough) High variance: too many degrees: the fit starts to chase the noise (bends too much) E=Bias^2+variance+o^2 ← add these together (E is expected) the one with smallest sum is the best (not what fits the training set the best)
60/20/20 split: Training, validation, test k-fold cross-validation splits the training data into k folds (ussually 5-10). Each fold takes one turn as the validation set while the model is fit on the other (k − 1). The CV error is the average of the k validation errors. Ridge regression: minimiszing the squared errors+ a prce on the squared size of the weights
underfitting. Choose on validation data (or by cv) and only open the test set once Ridge vs lasso: (make sure to always stadnarize for both ridge and lasso)
CV error: metric that measure how well a ML model generalises on unseen data Steps:
Split off the test set first and put it away Build a grid of λ on a log scale: 10−3, 10−2, …, 10^3. The effect of λ is multiplicative For each λ: k-fold CV, with the scaler fit inside each fold Pick the λ with the lowest CV error, or the largest λ within one standard error of it (a simpler model, about as good) Refit on all training rows with that λ; open the test envelope once Decision trees and random forests Descion tree: a model that predicts by asking a sequence of yes/no questions about the features Split: one question of the form Feature<= threshold. Rows that answer yes go left and rest go right Root: frist question asked of every row. Most Useful split the search could find Leaf: node with no question (stores the answer) The majority class or the mean of its rows Depth: the number of questions on the longest path from root to leaf.
Each question cuts along one axis, so each leaf owns a rectangle. Draws a staircase of boxes as fine as its depth allows it No need to standarize or scale Gini: the chance that two rows drawn at random from the node have different labels. Two classes: at most 0.5, 0 at pure nodes (every row has the same label) Entropy: the average number of bits needed to send the label of a row from the node. Two classes: at most 1 bit (Shannon, ECEN 314 and 455) Recusurve partitioning: Start with training rows in one node, try each feature and every threshold and keep the split with teh largest impurity decrease. Stop when a node is pure or when a stopping node says to Without a stopping rule (depth limit) , there the model will keep splitting until 100% training accuracy. DEpth is the complexity knob: High depth: every leaf is pure, includes noise, can be overfitting
Low depth is opposite.past best depth: test accuracy falls while training accuracy keeps rising. Regression tree products mean of y to and choose split to reduce squared error A tree is a high variance model soa hange in the first question ripples throug tree : bias low, variance high Cost-complexity pruning grows a full tree, then cuts back branches whose improvement does not pay for the leaves they add. Preduvtions must stay inside the training range. Cannot predict a value higher than the largest y found in training because each leaf predicts a mean of training targets Split search: tries every midpoint between sorted values and keeps the lowest weighted impurity (not only the mean)
Chatbot, llm+one lookuip, workflow, agent and multi agent Cost increases, use the lowest level that solves problem
Gradient descent: after every sample, nudge each weight a little in the direction that shrinks the squared error Loss function L(w) turns the weights w into one number: how wrong is the model on the training data
Lost (cost) function: one number that measures how badly a model with weights (w) fits the training data: mse for regression, log loss for classification Graidatn deltaL points where L is increases fastest: its length say show steep Learning rate: a. A positive number that sets the step size too small: slow, too large overshoots (chosen by u (hyperparam)) Update:(iteration): one step: training repeats it hundreds to millions of time convergence: the weights stop changin in a meaningful way: gradient is near 0 or loss stops dropping Local minim is lower than every points near it, global is lowest point of all. Gradient finds local
3 stopping rules: flat ground (gradient close to 0) Note a gradient finds flat ground not a global
This is converge A zero gradient means flat not the lowest,
. Standardizing gives the same line and the same MSE. It only changes how fast gradient descent gets there.
A loss is convex when the straight segment between any two points of its graph never passes below the graph: one bowl, no other valleys. For a convex loss, every local minimum is global.
Several valleys, ridges and saddle points (flat in the middle, uphill one way, downhill the other). Where you start decides where you end.
If the gradient at a weight is −3 and the learning rate is 0.05, one step increases the weight by 0.15. w − 0.05·(−3) = w + 0. A larger learning rate reaches the minimum in fewer steps UP TO A POINT At any point, the gradient is perpendicular to the contour line of the loss through that point.
Lecture 8- Perception: one neyron with a step output yhat=1 if w.x+b>0 after each example A single perception cannot compute xor The perception rule changes its weights only when the prediction is wrong The perception rule dopesnt converge if no line separates the 2 classes Newuron: computes a weighted sum plus a bias: z=w.x+b then an activation a=f(z) Mcculloh Puts Neuron Had Its Weights And Tresholds Set By Hand, Not By ExamPLE. Learning from examples arrived with rosblatt Weights and biases: the numbers the network learns. A weight says how much an input matters Activation function f: the nonlienart7y after the sum. Without it stacked layers collapse into one Layer : neurons that read the same inputs in parallel Input layter (the features) Multilayer perceptiorn (ML)P: layers in a chain each fully connected ot the nextt. Signals only flow forward Forward pass: computing the output from an input, layer by layer: h=f(W1x+b1) then the next layer reads h Hidden layer fixes the xor problem Universale approximation theromL: there are enoug units that exists but does nto say how manyt or how to find the weiughts Gradienbt decent cannot train a network of step function neurons because step has zero slope almost everywhere A neuron is a weighted sum plus a bias, then a nonlinearity: a = f(w·x + b)