cs231n-2

In practice, people prefer to avoid cross-validation in favor of having a single validation split, since cross-validation can be computationally expensive. The splits people tend to use is between 50%-90% of the training data for training and rest for validation. However, this depends on multiple factors: For example if the number of hyperparameters is large you may prefer to use bigger validation splits.If the number of examples in the validation set is small (perhaps only a few hundred or so), it is safer to use cross-validation. Typical number of folds you can see in practice would be 3-fold, 5-fold or 10-fold cross-validation.

We discussed a procedure called cross-validation, which can help reduce noise in estimating which hyperparameters work best.

We will cover this in more detail in later sections, and chose not to cover data normalization in this section because pixels in images are usually homogeneous and do not exhibit widely different distributions, alleviating the need for data normalization.

Take note of the hyperparameters that gave the best results. There is a question of whether you should use the full training set with the best hyperparameters, since the optimal hyperparameters might change if you were to fold the validation data into your training set (since the size of the data would be larger). In practice it is cleaner to not use the validation data in the final classifier and consider it to be burned on estimating the hyperparameters.

#

As an aside, the computational complexity of the Nearest Neighbor classifier is an active area of research, and several Approximate Nearest Neighbor (ANN) algorithms and libraries exist that can accelerate the nearest neighbor lookup in a dataset (e.g. FLANN). These algorithms allow one to trade off the correctness of the nearest neighbor retrieval with its space/time complexity during retrieval, and usually rely on a pre-processing/indexing stage that involves building a kdtree, or running the k-means algorithm.

Here is one more visualization to convince you that using pixel differences to compare images is inadequate. We can use a visualization technique called t-SNE to take the CIFAR-10 images and embed them in two dimensions so that their (local) pairwise distances are best preserved. In this visualization, images that are shown nearby are considered to be very near according to the L2 pixelwise distance we developed above:

时间: 2024-11-09 01:45:02

cs231n-2的相关文章

『cs231n』Faster_RCNN(待续)

前言 研究了好一阵子深度学习在计算机视觉方面的实际应用意义不大的奇技淫巧,感觉基本对研究生生涯的工作没啥直接的借鉴意义,硬说收获的话倒是加深了对tensorflow的理解,是时候回归最初的兴趣点--物体检测了,实际上对cs231n的Faster RCNN讲解理解的不是很好,当然这和课上讲的比较简略也是有关系的,所以特地重新学习一下,参考文章链接在这,另: Faster RCNN github : https://github.com/rbgirshick/py-faster-rcnn Faste

cnn.py cs231n

n import numpy as np from cs231n.layers import * from cs231n.fast_layers import * from cs231n.layer_utils import * class ThreeLayerConvNet(object): """ A three-layer convolutional network with the following architecture: conv - relu - 2x2 m

CS231n(一):基础知识

给自己新挖个坑:开始刷cs231n深度学习. 看了一下导言的pdf,差缺补漏. s = "hello" print s.capitalize() # 首字母大写; prints "Hello" print s.upper() # 全部大写; prints "HELLO" print s.rjust(7) #空格; prints " hello" print s.center(7) # 居中; prints " hel

cs231n笔记:线性分类器

cs231n线性分类器学习笔记,非翻译,根据自己的学习情况总结出的内容: 线性分类 本节介绍线性分类器,该方法可以自然延伸到神经网络和卷积神经网络中,这类方法主要有两部分组成,一个是评分函数(score function):是原始数据和类别分值的映射,另一个是损失函数:它是用来衡量预测标签和真是标签的一致性程度.我们将这类问题转化为优化问题,通过修改参数来最小化损失函数. 首先定义一个评分函数,这个函数将输入样本映射为各个分类类别的得分,得分的高低代表该样本属于该类别可能性的高低.现在假设有一个

笔记:CS231n+assignment1(作业一)

CS231n的课后作业非常的好,这里记录一下自己对作业一些笔记. 一.第一个是KNN的代码,这里的trick是计算距离的三种方法,核心的话还是python和machine learning中非常实用的向量化操作,可以大大的提高计算速度. import numpy as np class KNearestNeighbor(object):#首先是定义一个处理KNN的类 """ a kNN classifier with L2 distance """

CS231n - CNN for Visual Recognition Assignment1 ---- KNN

CS231n - CNN for Visual Recognition Assignment1 -- KNN 这作业怎么这么难,特别是对于我这种刚接触Python的- 反正能做出来的就做,做不出来的我就先抄别人的-.就当加深下对课程理解吧-. k_nearest_neighbor.py中主要有: compute_distances_two_loops compute_distances_one_loop compute_distances_no_loops predict_labels # -*

『cs231n』卷积神经网络的可视化与进一步理解

cs231n的第18课理解起来很吃力,听后又查了一些资料才算是勉强弄懂,所以这里贴一篇博文(根据自己理解有所修改)和原论文的翻译加深加深理解. 可视化理解卷积神经网络 原文地址 一.相关理论 本篇博文主要讲解2014年ECCV上的一篇经典文献:<Visualizing and Understanding Convolutional Networks>,可以说是CNN领域可视化理解的开山之作,这篇文献告诉我们CNN的每一层到底学习到了什么特征,然后作者通过可视化进行调整网络,提高了精度.最近两年

『cs231n』计算机视觉基础

线性分类器损失函数明细: 『cs231n』线性分类器损失函数 最优化Optimiz部分代码: 1.差劲的方案,随机搜索 bestloss = float('inf') # 无穷大 for num in range(1000): W = np.random.randn(10, 3073) * 0.0001 loss = L(X_train, Y_train, W) if loss < bestloss: bestloss = loss bestW = W scores = bsetW.dot(Xt

深度学习斯坦福cs231n 课程笔记

前言 对于深度学习,新手我推荐先看UFLDL,不做assignment的话,一两个晚上就可以看完.毕竟卷积.池化啥的并不是什么特别玄的东西.课程简明扼要,一针见血,把最基础.最重要的点都点出来 了. cs231n这个是一个完整的课程,内容就多了点,虽然说课程是computer vision的,但80%还是深度学习的内容.图像的工作暂时用不上,我就先略过了. 突然发现这两个课程都是斯坦福的,牛校就是牛. 课程主页 http://vision.stanford.edu/teaching/cs231n

【CS231n Winter 2016】

lecture 1 cs131,计算机视觉本科课程,导论. cs231a,计算机视觉研究生课程,涵盖CV更加广的知识(cs231n主要是vision recognition/image classification) 有志CV者建议学习 cs231n,主要讲CNN用于image classification 历史就不多扯了..说是几百万年前生物视觉的诞生大幅促进了进化过程,因为捕食者有了眼睛会追,被捕食者有了眼睛会跑blablabla... 哈佛大学两个人对猫做的实验(nobel prize),