Spark UI 觀察日誌
Job, Stage, Task Ref: [看图说话] 基于Spark UI性能优化与调试——初级篇 Ref: 理解spark中的job、stage、task 本篇主要會記錄使用Spark的一些觀察日誌,希望可以了解以下問題: Q: stage, task, job, partition 之間的關係? Q: 何時會需要 Shuffle? Shuffle 是如何運作的? 簡單來說,一個 Spark Application 被提交之後,會根據 Action 的觸發產生 Job,每個 Job 根據 Shuffle 的分界點,又會被分成多個 Stage,而每個 Stage 預設會根據核心大小、資料大小,包含多個 Partition,也就是Task,以加快運算。大概是以下這種感覺: Job 首先,Spark 中的數據都是由 RDD 組成的,而 RDD 是由 partition 組成的,每個 partition 代表一個數據塊。RDD 支援兩種操作分別是 Transformation 和 Action,Transformation 並不會讓程式馬上執行,而是會返回一個新的 RD...
Hexo - Butterfly 版本的語言切換功能設置
前言 因為求職需求,需要把網站轉換成英文,但是也想保留中文,開始尋找方法可以做中英文切換。 剛好看到 Hexo - Butterfly 官方網站,發現他們的網站就有中英文切換的功能,但是找遍了各個網站都沒有人說明。 所以只好看source code來了解是怎麼做的。 奮鬥了 2 天,終於找到方法了,以下是我整理的方法。 Step 1. 開設一個 private en repository 參考:完美的Hexo多语言解决方案 靈感主要參考上述連結,主要運作原理就是透過建立多個 GitHub Pages,基本上會有一個專門運行中文的 repository,另外再開設一個專門運行英文的 repository,透過設定不同的 config.yml 和 _config.butterfly.yml來達到中英文切換的效果。 以下是我建立的兩個 repository 建立特定語言的 GitHub Pages Step 2. 設置 [en/zh] config 先用_config.yml複製出兩個檔案分別是 config-en.yml跟config-zh.yml檔案,並且做以下設定...
Spark and Pyspark Local Mode & Cluster on Mac
Install Java Open a terminal and execute java. It should redirect you to a download site (if you haven’t installed it already) Python 3 如果你透過 homebrew 安裝,或 conda 可以跳過此步驟。 Browse to https://python.org/downloads, get a 3.x version (latest is 3.12.0.). Install the pkg. Spark/Pyspark Go to https://spark.apache.org/downloads.html and download Spark. Use Spark 3.5.0 for Hadoop 3.3 執行以下指令,我們把 spark 移動到 /usr/local 底下,通常 /usr/local 是使用者自己手動下載的非系統預設軟體,這個folder由用戶自己管理。 123# Untar Archive with: tar x...
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...