Home avatar

  • 2026
  • 2025
  • 2024
  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2017

7 posts in 2026

2 posts in 2025

3 posts in 2024

5 posts in 2023

4 posts in 2022

5 posts in 2021

8 posts in 2020

11 posts in 2019

7 posts in 2018

6 posts in 2017

Using Chinese Characters in Matplotlib

After searching from Google, here is the easiest solution. This should also works on other languages:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'

import matplotlib.font_manager as fm
f = "/System/Library/Fonts/PingFang.ttc"
prop = fm.FontProperties(fname=f)

plt.title("你好",fontproperties=prop)
plt.show()

Output:

Models and Architectures in Word2vec

Generally, word2vec is a language model to predict the words probability based on the context. When build the model, it create word embedding for each word, and word embedding is widely used in many NLP tasks.

Models

CBOW (Continuous Bag of Words)

Use the context to predict the probability of current word. (In the picture, the word is encoded with one-hot encoding, W_{V*N} is word embedding, and W_{V*N}^{'}, the output weight matrix in hidden layer, is same as \hat{\upsilon} in following equations)

Semi-Supervised Text Classification Using Doc2vec and Label Spreading

Here is a simple way to classify text without much human effort and get a impressive performance.

It can be divided into two steps:

  1. Get train data by using keyword classification
  2. Generate a more accurate classification model by using doc2vec and label spreading

Keyword-based Classification

Keyword based classification is a simple but effective method. Extracting the target keyword is a monotonous work. I use this method to automatic extract keyword candidate.