ML_101
  • Introduction
  • ML Fundamentals
    • Basics
    • Optimization
    • How to prevent overfitting
    • Linear Algebra
    • Clustering
    • Calculate Parameters in CNN
    • Normalization
    • Confidence Interval
    • Quantization
  • Classical Machine Learning
    • Basics
    • Unsupervised Learning
  • Neural Networks
    • Basics
    • Activation function
    • Different Types of Convolution
    • Resnet
    • Mobilenet
  • Loss
    • L1 and L2 Loss
    • Hinge Loss
    • Cross-Entropy Loss
    • Binary Cross-Entropy Loss
    • Categorical Cross-Entropy Loss
    • (Optional) Focal Loss
    • (Optional) CORAL Loss
  • Computer Vision
    • Two Stage Object Detection
      • Metrics
      • ROI
      • R-CNN
      • Fast RCNN
      • Faster RCNN
      • Mask RCNN
    • One Stage Object Detection
      • FPN
      • YOLO
      • Single Shot MultiBox Detector(SSD)
    • Segmentation
      • Panoptic Segmentation
      • PSPNet
    • FaceNet
    • GAN
    • Imbalance problem in object detection
  • NLP
    • Embedding
    • RNN
    • LSTM
    • LSTM Ext.
    • RNN for text prediction
    • BLEU
    • Seq2Seq
    • Attention
    • Self Attention
    • Attention without RNN
    • Transformer
    • BERT
  • Parallel Computing
    • Communication
    • MapReduce
    • Parameter Server
    • Decentralized And Ring All Reduce
    • Federated Learning
    • Model Parallelism: GPipe
  • Anomaly Detection
    • DBSCAN
    • Autoencoder
  • Visualization
    • Saliency Maps
    • Fooling images
    • Class Visualization
Powered by GitBook
On this page

Was this helpful?

  1. NLP

RNN for text prediction

PreviousLSTM Ext.NextBLEU

Last updated 3 years ago

Was this helpful?

  • Input text: “the cat sat on the ma”

  • Question: what is the next char?

  • RNN outputs a distribution over the chars.

  • Sample a char from it; we may get ‘t’.

  • Take “the cat sat on the mat” as input.

  • Maybe the next char is period ‘.’.

Training

  • Cut text to segments (with overlap). E.g., seg_len=40 and stride=3.

    • Partition text to (segment, next_char) pairs.

  • A segment is used as input text.

  • Its next char is used as label.

  • One-hot encode the characters.

    • Character -> v×1v \times 1v×1 vector.

    • Segment l×vl \times vl×v matrix.

  • Training data: (segment, next_char) pairs

  • It is a multi-class classification problem. #class = #unique chars.