1. Machine Learning and Linear Regression (with 1 variable)

포도·2021년 9월 26일
0

Introduction to Machine Learning

1. Machine Learning Algorithms

  • supervised learning
  • unsupervised learning
  • others: reinforcement learning, recommendation systems

2. Supervised Learning

  • right answers (labels)
  • Regression: predict continuous output (e.g., housing price)
  • Classification: discrete valued output (e.g., tumor)
  • support vector machine can manage infinite number of features.

3. Unsupervised Learning

  • no labels
  • clustering: automatically find structure of data w/o specific algorithms
  • examples: google news clustering, gene analysis, market segmentation, astronomical data analysis, social network analysis, organize computing clusters
  • cocktail party algorithm: two audio recording separates out two overlapped voices.
    Programing environment: Octave, matlab
    [W, s, v] = svd((repmat(sum(x.*x, 1), size(x, 1), 1). *x)*x')

Linear Regression

1. Model Representation

  • how do we represent h?
  • Given a training set, to learn a function h: x-> y so that h(x) is a good predictor for y value.

2. Cost Function

  • cost function, squared error function
  • goal is to minize the cost function J
  • 3D (height = cost)
  • contour plots(figures)
    same color line has the same cost

3. Gradient Descent

  • start at a random point and move toward the lowest point through calculating the steepest descent.
  • gradient descent algorithm

    calculate all parameters simultaneously for each iteration.
  • alpha(learning rate)
  • Regardless of slope's sign, theta1 converges to the minimum
  • if alpha is too small or too big
  • With a fixed alpha, derivative gets smaller as approaching the minimum as the slope gets smaller, thus, the steps get smaller.

Applying gradient descent to linear algebra

  • Convergence for theta0 and 1 at the same time.

  • The cost function for a linear algebra is always a convex function (bowl-shaped function). Thus, no local minimum. Always converges to a global minimum.

  • batch gardient descent: each step uses all training examples.

profile
문과로 한평생 살다가 현재 펜실베니아 주립대 (University of Pennsylvania) 에서 Computer and Information Technology 공부하고 있습니다.

0개의 댓글