- Hands-On Meta Learning with Python
- Sudharsan Ravichandiran
- 219字
- 2021-07-02 14:29:21
Algorithm
The algorithm of the prototypical networks is shown here:
- Let's say we have the dataset, D, comprising {(x1, y1), (x2, y2), ... (xn, yn)} where x is the feature and y is the class label.
- Since we perform episodic training, we randomly sample n number of data points per each class from our dataset, D, and prepare our support set, S.
- Similarly, we select n number of data points and prepare our query set, Q.
- We learn the embeddings of the data points in our support set using our embedding function, f? (). The embedding function can be any feature extractor—say, a convolutional network for images and an LSTM network for text.
- Once we have the embeddings for each data point, we compute the prototype of each class by taking the mean embeddings of the data points under each class:

- Similarly, we learn the query set embeddings.
- We calculate the Euclidean distance, d, between query set embeddings and the class prototype.
- We predict the probability, p?(y = k|x), of the class of a query set by applying softmax over the distance d:

- We compute the loss function, J(?), as a negative log probability, J(?) = -logp?(y=k|x), and we try to minimize the loss using stochastic gradient descent.
推薦閱讀
- PyTorch深度學習實戰:從新手小白到數據科學家
- 數據產品經理高效學習手冊:產品設計、技術常識與機器學習
- Access 2007數據庫應用上機指導與練習
- iOS and OS X Network Programming Cookbook
- 基于Apache CXF構建SOA應用
- 數據庫程序員面試筆試真題庫
- Hands-On Mathematics for Deep Learning
- 云數據中心網絡與SDN:技術架構與實現
- SAS金融數據挖掘與建模:系統方法與案例解析
- 云計算寶典:技術與實踐
- 掌中寶:電腦綜合應用技巧
- 數字化轉型方法論:落地路徑與數據中臺
- 數據庫原理及應用實驗:基于GaussDB的實現方法
- Tableau商業分析從新手到高手(視頻版)
- Creating Mobile Apps with Appcelerator Titanium