k-Nearest Neighbor

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bryant_meng/article/details/83478386

CS231n课程笔记翻译:图像分类笔记(上)
CS231n课程笔记翻译:图像分类笔记(下)



1 With N examples, how fast are training and prediction?

  • Train O(1)
  • predict O(N)

This is bad: we want classifiers that are fast at prediction; slow for training is ok.

2 hyper-parameters(choices about the algorithm that we set rather than learn)

  • What is the best distance to use?
  • What is the best value of k to use?

3 k-Nearest Neighbor on images never used

  • Very slow at test time

  • Distance metrics on pixels are not informative
    在这里插入图片描述

  • Curse of dimensionality(维数灾难)
    维数越高,需要填充的样本指数级增长
    在这里插入图片描述

4 Difference between L1 and L2

在这里插入图片描述

demo: http://vision.stanford.edu/teaching/cs231n-demos/knn/
在这里插入图片描述

机器学习中的范数规则化之(一)L0、L1与L2范数

5 Algorithm

The kNN classifier consists of two stages:

  • During training, the classifier takes the training data and simply remembers it
  • During testing, kNN classifies every test image by comparing to all training images and transfering the labels of the k most similar training examples
  • The value of k is cross-validated

5.1 下载数据集

apt-get install wget
cd cs231n/datasets/
sh get_datasets.sh

数据集构成

Training data shape:  (50000, 32, 32, 3)
Training labels shape:  (50000,)
Test data shape:  (10000, 32, 32, 3)
Test labels shape:  (10000,)

Database of deep learning(Classification and Object detection )

猜你喜欢

转载自blog.csdn.net/bryant_meng/article/details/83478386