Pyspark 的基本概念
前言 本篇文章主要的目的是在整理 Spark: The Definitive Guide 這本書的內容,並且加上自己的理解,讓自己更加熟悉 Spark 的基本概念。 Spark Application 取自:Spark: The Definitive Guide Spark Application mainly consist of two processes: Driver process: executing main() function, sits on a node in the cluster maintaining information about the Spark Application responding to a user’s program or input analyzing, distributing, and scheduling work across the executors Executor process: executing code assigned to it by the driver reporting the s...
Twitter Dataset - 使用 LSTM 預測文章的情緒
前言 最近選了一堂AI課程,這是第六個作業,主要教授內容為以下主題: 學會使用 LSTM 使用SpaCy 作業要求 Train a text classification on the TweetEval emotion recognition dataset using LSTMs and GRUs. 建立LSTM模型:Follow the example described here. Use the same architecture, but: only use the last output of the LSTM in the loss function use an embedding dim of 128 use a hidden dim of 256. 使用SpaCy切割字:Use spaCy to split the tweets into words. 挑選Top5000的字:Limit your vocabulary (i.e. the words that you converted to an index) to the most freq...
COCO Dataset - 使用 Faster RCNN + MobileNet 進行 Object Detection
前言 最近選了一堂AI課程,這是第四個作業,主要教授內容為以下主題: Download Coco dataset User pre-trained version of Faster R-CNN to predict the bounding box Calculate IoU 作業要求 下載coco資料集:Download the file „2017 Val images [5/1GB]“ and „ 2017 Train/Val annotations [241MB]“ from the Coco page. You can use the library pycocotools to load them into your notebook. 隨機從dataset選擇十張:Randomly select 10 images from this dataset. 使用pre-trained模型FasterR-CNN預測bbox:Use a pre-trained version of Faster R-CNN (Resnet50 backbone) to predic...
Flower102 Dataset - 使用 Transfer Learning 訓練 + 使用 Batch Normalization 於 CNN
前言 最近選了一堂AI課程,這是第四個作業,主要教授內容為以下主題: Pick a dataset and train a model on it. Transfer Learning - Fine Tuning. Batch Normalization in CNN. 主要參考以下網站: Flower102 Dataset Transfer Learning DataSet of Pytorch Models for transfer learning Shannon’s Blog of Transfer Learning Resnet18 作業要求 Task: 選擇一個DataSet: Check out the torchvision DataSet of Pytorch and decide one dataset that you want to use (no CIFAR, no ImageNet, no FashionMNIST). 印出圖片和資料大小:Show some example images of the dataset in the noteb...
CIFAR10 Dataset - 使用 Pytorch 搭建 CNN + 啟用 GPU + 結果展示至 TensorBoard
前言 最近選了一堂AI課程,這是第三個作業,主要參考以下網站: 教授如何使用 Pytorch 搭建 CNN:Pytorch Tutorial 教授如何使用 TensorBoard:Pytorch TensorBoard Tutorial 在 CoLabe 使用 TensorBoard 教學:TensorBoard in CoLabe Tutorial 本篇的主要目的是理解 CNN,並試圖搭建更深層的 Network,並使用GPU加快效率,最後將結果 Loss 與 猜錯的結果 顯示在 TensorBoard 上。 環境設置與作業要求 環境設置: Python 3.10.9 Pytorch 2.0.1 作業要求 Task: 先建立一個CNN:Train the same network as in the PyTorch CNN tutorial. 建立出CNN滿足以下要求:Change now the network architecture as follows and train the network: Conv layer with 3x3 kernel a...
DLP - Data Leakage Protection 的論文 Survey
前言 因為在做資料庫的零信任相關研究,在這篇適用於應用程式AP與資料庫DB之間的零信任架構(ZTA)原則 - 總整理篇有提到幾點跟資料保護重要的技術,也就是DLP跟DRM。為此,本篇主要就是總結目前Survey與DLP相關的文獻。 主要目的是可以找出以下議題的相關論文,並擁有一定的了解: DLP 在做什麼? DLP 的相關技術? DLP 跟 Data Risk Labeling 的結合? DLP 跟 Access Control 的結合? DLP 關於 Machine Learning 的應用? DLP 在做什麼?
Titanic Dataset - 使用 Pytorch 搭建神經網路 + 測試 overfitting
Reference Ref:很詳細說明Titanic資料裡面的結構狀態 前言 最近選了一堂AI課程,有一個作業是我們寫出一個Nerual Network,並且使用Titanic Dataset來訓練,並且透過增加 hidden layer 跟 neurons 的方式實現overfitting,並透過 dropout 或其他方法來消除 overfitting 的影響。 在此紀錄ㄧ下作業撰寫的過程。 環境設置與作業要求 環境設置: Python 3.10.9 Pytorch 2.0.1 作業要求 Write a custom dataset class for the titanic data (see the data folder on GitHub). Use only the features: “Pclass”, “Age”, “SibSp”, “Parch”, „Fare“, „Sex“, „Embarked“. Preprocess the features accordingly in that class (scaling, one-hot-encod...
MAC OS - PyTorch 上如何啟用 GPU
參考資料 mac m1,m2 安装 提供GPU支持的pytorch和tensorflow Accelerated PyTorch training on Mac Mac OS 在 PyTorch 啟用 GPU 因為我本身使用我重新基于Anaconda安装了一下GPU支持的Pytorch,你不確定是否有安裝Conda可以使用指令conda --version查看是否有安裝。如果成供輸出帶有本身有安裝,如果沒有請至Anaconda官網下載。 (可選)如果想要分開環境,特別建立一個支援GPU的python env,可以使用以下指令 12345678# 建立一個 torch-gpu 的環境 使用 python 3.10.9conda create -n torch-gpu python=3.10.9# 啟用該環境conda activate torch-gpu# 查看 所有環境 conda env list # 查看目前的 python 版本與啟用的 env python 版本是否相同python --version 根據 Pytorch 官網選擇對應的版本,複製安裝指令 ...
All basic concept of Mechine Learning - ML 的重點知識整理
參考資料 Epoch, Batch size, Iteration, Learning Rate ML Lecture 6: Brief Introduction of Deep Learning ML Lecture 7: Backporpagation 聊一聊深度学习的activation function 台大李鴻毅老師的所有影片 超詳細的activation function推導公式 卷積神經網路(Convolutional neural network, CNN):卷積計算中的步伐(stride)和填充(padding) 史丹佛nerual-networks-3 Nerual Network 主要參考:- ML Lecture 6: Brief Introduction of Deep Learning 每個 neuron 都有一組 weight 跟 bias,下一個neuron = 上一個 neuron 連到的線中,進行運算以上圖為例 11+(-1)(-2) 再加上 bias 1 進行 sigmoid function 得到數值。 就是把 input * w...
Design Pattern - Day1: Introd to Design Pattern
Introduction I am going to complete something I have always want to do, which is finishing the Design Patterns book written by Eric Freeman. I have read this book for several times, but I never managed to finish it. I believe it’s time to finaly complete it. And for not forgeting the knowledge I have learned, I will write down the notes here. Agenda The following are the agenda of this hands-on. I will try to base on my understanding to explain the design pattern. [ ] Day1: Introd to Design ...