动手学深度学习 v2.0记事本”选项下载后解压代码, 或者可以按照如下方式进行下载: mkdir d2l-zh && cd d2l-zh curl https://zh-v2.d2l.ai/d2l-zh-2.0.0.zip -o d2l-zh.zip unzip d2l-zh.zip && rm d2l-zh.zip cd pytorch 注意:如果没有安装unzip,则可以通过运行sudo apt install unzip进行安装。 exp(·): 指数函数 • 1X : 指示函数 • (·)⊤: 向量或矩阵的转置 • X−1: 矩阵的逆 • ⊙: 按元素相乘 • [·, ·]:连结 • |X|:集合的基数 • ∥ · ∥p: :Lp 正则 • ∥ · ∥: L2 正则 • ⟨x, y⟩:向量x和y的点积 • �: 连加 • �: 连乘 • def =:定义 微积分 • dy dx:y关于x的导数 • ∂y a f(x) dx: f在a到b区间上关于x的定积分 • � f(x) dx: f关于x的不定积分 14 目录 概率与信息论 • P(·):概率分布 • z ∼ P: 随机变量z具有概率分布P • P(X | Y ):X | Y 的条件概率 • p(x): 概率密度函数 • Ex[f(x)]: 函数f对x的数学期望 • X ⊥ Y : 随机变量X和Y 是独立的 • X ⊥ Y |0 码力 | 797 页 | 29.45 MB | 1 年前3
Experiment 2: Logistic Regression and Newton's Methodnegative class using the find command: % find returns the i n d i c e s of the % rows meeting the s p e c i f i e d condition pos = find (y == 1 ) ; neg = find ( y == 0 ) ; % Assume the f e a t u r e of x plot ( x ( pos , 2) , x ( pos , 3 ) , ’+’ ) ; hold on plot ( x ( neg , 2) , x ( neg , 3) , ’ o ’ ) Your plot should look like the following: 1 10 20 30 40 50 60 70 Exam 1 score 40 45 50 55 Recall that in logistic regression, the hypothesis function is hθ(x) = g(θT x) = 1 1 + e−θT x = P(y = 1 | x; θ) (1) Matlab/Octave does not have a library function for the sigmoid, so you will have0 码力 | 4 页 | 196.41 KB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版2021127407&courseId=1209092816&_trace_c _p_k2_=9e74eb6f891d47cfaa6f00b5cb 5f617c https://study.163.com/course/courseMain.h tm?share=2&shareId=480000001847407& courseId=1208894818&_trace_c_p_k2_=8 d1b10e04bd34d69855bb71da65b0549 10 from torch.distributions import Bernoulli dist = Bernoulli(torch.tensor([0.3])) # 创建 p=0.3 的 Bernoulli 分布 dist.sample(torch.Size([10])) # 采样 10 次 Out[37]: tensor([[1.], [0 向量?可以直接实现一个网络层,代码如下: In [44]: w = torch.ones(4, 3) # 定义 W 张量 b = torch.zeros(3) # 定义 b 张量 o = x@w+b # X@W+b 运算 Out[44]: tensor([[ 3.0048, 3.0048, 3.0048], [-3.2164, -3.2164, -30 码力 | 439 页 | 29.91 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning Techniquesnlpaug import flow as naf [nltk_download(item) for item in ['punkt', 'wordnet']] aug_args = dict(aug_p=0.3, aug_max=40) chain = [ nas.random.RandomSentAug(**aug_args), naw.RandomWordAug(action='delete' RandomWordAug(action='substitute', **aug_args), nac.KeyboardAug() ] flow = naf.Sometimes(chain, pipeline_p=0.3) The nlpaug_fn() function just wraps up the augmentation calls in a tf.py_function, a tensorflow Joy Holland. The bottom-center is a tortoise (resized) from Open Images Dataset V6 and authored by J. P. Both the images are licensed under CC BY 2.0. For example, the top-right image is an average mix0 码力 | 56 页 | 18.93 MB | 1 年前3
Lecture 3: Logistic Regressionhθ(x) and Pr(Y = 0 | X = x; θ) = 1 − hθ(x), then we have the following probability mass function p(y | x; θ) = Pr(Y = y | X = x; θ) = (hθ(x))y(1 − hθ(x))1−y where y ∈ {0, 1} Feng Li (SDU) Logistic of y ∈ {0, 1}, then p(y | x; θ) = 1 1 + exp(−yθTx) Assuming the training examples were generated independently, we de- fine the likelihood of the parameters as L(θ) = m � i=1 p(y(i) | x(i); θ) = · · , K} y(i) ∈ {1, 2, · · · , K} for ∀i Hypothesis function hθ(x) = � ���� p(y = 1 | x, θ) p(y = 2 | x, θ) ... p(y = K | x, θ) � ���� = 1 �K k=1 exp � θ(k)Tx � � ������� exp � θ(1)Tx � exp0 码力 | 29 页 | 660.51 KB | 1 年前3
Lecture 7: K-Meansassignment (i.e., probability of being assigned to each cluster: say K = 3 and for some point xi, p1 = 0.7; p2 = 0.2; p3 = 0.1) Works well only is the clusters are roughly of equal sizes Probabilistic clustering 2021 33 / 46 Divisive Clustering Bisecting K-means: Repeating 2-means algorithm until we have a de- sired number of clusters MST-based method: Build a minimum spanning tree from the dissim- ilarity0 码力 | 46 页 | 9.78 MB | 1 年前3
PyTorch Brand Guidelinesas copy, illustrations or photography. This spacing is determined by the measurements of the “P” within the PyTorch wordmark. Dos and Don'ts Leverage the color palettes and keep things simple (Digital) Orange Light 1 (Digital) Orange (Digital) Orange (Print) #B92B0F #F05F42 #F2765D #DE3412 Orange (Print) C00, M61, Y72, K00 Pantone 171 C Secondary Colors When designing content0 码力 | 12 页 | 34.16 MB | 1 年前3
《TensorFlow 快速入门与实战》7-实战TensorFlow人脸识别�e������������� �������� ������������D��� ���� ���������������� �������� ���������������� �������� ��������P���e��� ������� �������������� ���� ������ ������������t��� ������� ������������t��� �g����� ���g�����������t ���������������� ��e� ������ ������������� ���� �������� ���������������� ��e� �������� e�P�������� ��e� ��� e�P���� ��e� �������� ���������������� ��e� �����n ��������������� ���� ����������� LFW.Labeled in the Wild/ LFW �t������i 6000 �����h�����vh�i 300 �u��300 ���� ���ha��c��d����t���LFW���s�d�����p� 2013�:�����������f�������l��+�c��� 2014�:����������c��� 2014��s��c��+���.����tw����/e�������������0 码力 | 81 页 | 12.64 MB | 1 年前3
Experiment 1: Linear Regressionplot your training set (and label the axes): figure % open a new f i g u r e window plot (x , y , ’ o ’ ) ; ylabel ( ’ Height in meters ’ ) xlabel ( ’Age in years ’ ) You should see a series of data plotting commands will look something like this: hold on % Plot new data without c l e a r i n g old p l o t plot ( x ( : , 2 ) , x∗ theta , ’− ’ ) % remember that x i s now a matrix % with 2 columnsand the second % column contains the time info legend ( ’ Training data ’ , ’ Linear r e g r e s s i o n ’ ) Note that for most machine learning problems, x is very high dimensional, so we don’t be able0 码力 | 7 页 | 428.11 KB | 1 年前3
全连接神经网络实战. pytorch 版transform=ToTensor () , target_transform=Lambda( lambda y : torch . zeros (10 , dtype=torch . f l o a t ) . scatter_ (0 , torch . tensor (y) , value=1)) ) transf orm 是对数据的转换,ToTensor() 函数将 PIL 图像或者 10) , ) def forward ( s e l f , x) : x = s e l f . f l a t t e n (x) l o g i t s = s e l f . linear_relu_stack (x) return l o g i t s model = NeuralNetwork () print ( model ) 11 12 2.1. 基本网络结构 这里使用 dataloader ) : # Compute prediction and l o s s pred = model (X) l o s s = loss_function ( pred , y) # Backpropagation optimizer . zero_grad () #梯 度 归0w l o s s . backward () optimizer . step () i0 码力 | 29 页 | 1.40 MB | 1 年前3
共 71 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8













