Apache Hive
IntroductoryHive is a data warehouse infrastructure built on top of Hadoop for providing data summarization, query, and analysis.
Hive Components
Two Main Components
High-level language (HiveQL)
Two execution modes
Local: reads/writes to local file system
Mapreduce: connects to Hadoop cluster and reads/writes to HDFS
Two modes:
Interactive mode: using console
Batch mode: submit a script
Physical Layout:
Warehouse directory in HDFS
E.g., /user/hive/warehouse
Tables stored in subdirecto ...
Apache Pig
IntroductoryPig is a large-scale data processing system, the scripts are written in Pig Latin, a dataflow language
Pig Engine Parses: compiles Pig Latin scripts into MapReduce jobs run on top of Hadoop
Pig Latin: a dataflow language
Pig: the high level language interface for Hadoop
Why not MapReduceCompute the natural join $R(A,B) \Join S(B,C)$
Implementation in MapReduce:
Each input tuple R(a,b) into key-value pair (b,(a,R))
Each input tuple S(b,c) into (b,(c,S))
Map processes send each ke ...
RNN++ (Model Architectures)
Modify RNNNote that text can be long, the early observation may be very important. However, truncation may miss such important information, or it may also decay in the long sequence. Therefore, we can use a memory cell to remember all the important information.Besides, some information is meaningless, such as the HTML tags, we can simply skip such meaningless tokens.Furthermore, text may consists of some logic break, such as a new chapter, to separate those chapters we want to reset the hidden s ...
Recurrent Neural Networks
Recurrent Neural NetworksHidden state modelLong-term Dependency: Natural language contains patterns, it need to learn the relationships or dependencies between tokens in a sequence. A convolutional layer can handle the local patch, if multiple convolutional layers are used, the number of pixels increase. Thus, to handle the long-term dependency with convolutional layers, the deep learning model should increase the filter size and number of layers to make the final outputs link to number of diffe ...
Text Processing
Text Preprocessing
Problem of text dataHow to encode them into numerical values (feature extraction)
Tokenization
Convert a sentence into a sequence of tokens (i.e., words and characters)
Example:
My name is Yu. My first name is Li.
[“My”, “name”, “is”, “Yu”, “My”, “first”, “name”, “is”, “Li”]
Stop words removal
Many words are not informative and have a high frequency. Thus, irrelevant for document representation
Example: the, and, a, an, is, of, that, may, off, be, by, for, from, it, wil ...
Hyper-paramater
Learning Rate Schedular
Factor scheduler
\alpha_{t+1} = \max(\alpha_{\min}, \alpha_{t} \times \tau)
Multi factor scheduler
\alpha_{t+1} = \alpha \times \tau
Cosine scheduler
\alpha_t = \alpha_T+\frac{\alpha_0 - \alpha_T}{2}\big(1+\cos(\frac{\pi t}{T})\big)
$\alpha_0$: Initial rate
$\alpha_T$: Target rate
Warmup
Unstable optimization problem, small learning rate first
Step LR
123456789# Assuming optimizer uses 1r = 0.05 for all groups# 1r = 0.05 if epoch < 30# 1r = 0.005 if 30 &l ...
Optimization
Gradient Descent
Epoch: the time that we iterative through all the training data.
Batch Size: the number of data points that we feed to the algorithm every iteration.
An Iteration: the time that the weights update.
Given the steps of gradient descent algorithm,
Algorithm:
Initialize the weights.
For all the training data: forward pass and calculate the output(s) $Y$.
Update the weights (gradient descent):\Delta w_{ij}^{(k)} = \alpha\frac{\partial Div(Y, d)}{\partial w_{ij}^{(k)}}w_{ij}^{(k)} = ...
Kubernetes Cluster Setup
Pig Installation
Download the latest version of Pig from Apache12wget https://dlcdn.apache.org/pig/pig-0.17.0/pig-0.17.0.tar.gztar xvzf pig-0.17.0.tar.gz
Change the directory of pig-0.17.0 folder
123sudo mkdir -p /usr/local/pigcd pig-0.17.0sudo mv * /usr/local/pig
Create .bashrc file with following environment
12345678910vi .bashrcexport PIG_HOME=/usr/local/pigexport PATH=$PATH:$PIG_HOME/binexport PIG_CLASSPATH=$PIG_HOME/conf:$HADOOP_INSTALL/etc/hadoop/binexport PIG_CONF_DIR=$PIG_HOME/confex ...
CNN++ (Increase Dimension)
Image Super-ResolutionGiven a small size (low resolution) image, we want to predict a super-resolution image by filling the missing values to construct a higher dimension and resolution image.
Benefits:
The server can store smaller size images and increase the resolution when required, which saves the server cost and network requirements
In the biological field, increase resolution for MRI images to observe more details of the tissues
InterpolationInterpolation is a traditional implementatio ...
CNN++ (Model Architectures)
Fully-Connected NN
A general function approximator
Problems:
Storage
Running time
Hard to train
Prior knowledge is ignored
Overfitting
LeNet
Architectures: 2 convolution layers + 2 pooling layers + 2 fully-connected layers = (6+2) different layers
Translation invariance and Locality: It ables to capture the patch information and the local regions information and do the aggregation later
Further Improvement: We can improve the model by making it deeper (more convolution layers, channels, m ...


