Search Ranking

Problem Statement

Ask for questions: Scale, Scope, Personalization.

  • Scope: general search or specialized search?
  • Scale: number of websites? QPS (queries per second)?
  • Personalization: logged-in user or not
Read more

Intro to Grad-CAM - CNN的可视化

The Grad-CAM (Gradient-weighted Class Activation Mapping) is a generalization of CAM and is applicable to a significantly broader range of CNN model families.
The intuition is to expect the last convolutional layers to have the best compromise between high-level semantics and detailed spatial information which is lost in fully-connected layers. The neurons in these layers look for semantic class-specific information in the image.

$$L_{Grad-CAM}^c = ReLU(\sum_k\alpha_k^cA^k)$$

where $$\alpha_k^c = \frac{1}{Z}\sum_i\sum_j\frac{\partial{y_c}}{\partial{A_{ij}^k}}$$

Read more

Image preprocessing in Xception model

The image preprocessing process for the Xception model typically includes the following steps:

  1. Size Adjustment:
    • The Xception model expects the input image size to usually be 299x299 pixels.
  2. Color Channel Processing:
    • The Xception model expects the input to be a color image, i.e., having 3 color channels (Red, Green, Blue). If your image is grayscale (single-channel), you need to convert it into a three-channel format.
Read more

Intro to GAN

Supervised or unsupervised?

  • Unsupervised task: generative modeling is an unsupervised task where the model is not told what kind of patterns to look for in the data and there is no error metric to improve the model.
  • Supervised classifier/loss func: the training process of the GAN is posed as a supervised learning problem with the help of a discriminator.
Read more

K-Fold Cross Validation

The K-fold cross validation is to divide the training data into K parts, using K-1 of them for training and the remaining part for testing. Finally, take the average of the testing errors as the generalization error. This allows for better utilization of the training data.
However, I encountered some problems when I was trying two kinds of k-fold cross validation methods. Firstly, we need to understand the significance of data division.

  • The training set is used to train the model and obtain its parameters.
  • The validation set is used for tuning the model’s hyperparameters.
  • The test set is used to evaluate the model’s performance.
Read more

Layer Norm | Batch Norm | Instance Norm | Group Norm

LB | BN | IN | GN in NLP

  • Batch Norm: Normalizes each feature across the entire batch. Rarely used in NLP, because it relies on consistent sequence lengths and large batch sizes, and is sensitive to padding.
  • Layer Norm: Normalizes across the feature dimension for each token independently, making it suitable for variable-length sequences
  • Instance Norm: Originally used in computer vision to normalize each channel within each sample. It is not commonly applied in NLP tasks.
  • Group Norm: Splits the feature (embedding) dimension into groups and performs normalization within each group. It’s occasionally used in NLP when LayerNorm is replaced for better generalization under small-batch or resource-constrained settings.
Read more

Depthwise Separable Convolutions

Inception Modules

In a convolutional layer, a single convolution kernel is tasked simultaneously mapping cross-channel correlations and spatial correlations. The inception module is to make this process easier and reduce computational expense by decoupling the depthwise convolution (i.e. spatial convolution over each channel) and pointwise convolution (i.e. 1x1 kernel for cross-channel operations).

Read more