Shell

Quick notes

System information

  • neofetch, system info
  • du -sh <file>/<directory>, check the size of file or directory
  • df -h, display free disk space
    • -h, 1k = 1024 byte
    • -H, 1k = 1000 byte
  • uname -s, print kernel name
    • Linux
    • Darwin
  • uname -r, linux release number
  • last -n 50, check last logged in users
  • lastb -n 50,
  • pstree -p, process tree
  • w, show who is logged on and what they are doing


Vim

This notes contains useful tips for using Vim or editing and I use spf13-vim.

  • spf13-vim is a distribution of vim plugins and resources for Vim.
  • Install spf13-vim: curl http://j.mp/spf13-vim3 -L -o - | sh

Plugins

Surround

Managing all the ‘”[{}]“’ etc.

  • Characters meaning
    • operations
      • d delete
      • c change
      • y add?
    • s represents surrounding
    • S for visual mode surroundings
    • text object (vim editing)
      • w word
      • iw in word
      • aw all word, including space(s)
    • surroundings
      • ( left bracket will give a space between it and content
      • ) right won’t
      • b = )
  • Examples
    • yss) surround a line of content with ()
    • ysiw<div> surround a word like this <div>nice</div>
    • VS<div> surround a line with <div></div>


Forward Learning

Papers read during research forward deep learning algorithm.

Quick notes

  • 正推,逆推
    • 底层精度高=> 高层精度高
    • 相同结构网络,精度高的网络,从中间截取进行分类是否精度也高?
  • 不同粒度特征提取的结合
    • 粒度,卷积层数? 层数不同的实质是什么不同?
  • 在调整了一些Hyper-paramenter后,大致上可以发现影响更大的参数,比如卷积核数
    • 调整优先级:欠拟合 > 过拟合
  • 用CIFAR-10训练时,测试集上的loss会在某次迭代中突然丢失,然后又恢复,形成一个尖刺?
  • 将问题分割成子问题,但试图用深度学习解决的问题,都不太好分割成子问题

Orthogonal Bipolar Target Vectors1

Can OBV construct a middle target for CNN?

A kind of target representation.

  • conventional
    • BNV - binary: \((0, 0, 1, 0, 0)\)
    • BPV - bipolar?: \((-1, -1, 1, -1, -1)\)
  • OBV - orthogonal bipolar vectors
  • NOV - Non-Orthogonal Vecotrs
    • For fail comparision
    • \(V_i=(\overbrace{-1 , \cdots , -1}^{i-1}, 1, \overbrace{-1 , \cdots , -1}^{n-i})\)
    • \(cos \theta = \frac{n-2}{n}\)
  • degraded characters?
    • They use degraded license plate images as expirement data. (车牌号)

How to generate OBV from conventional target?


Hinton Course

Learning notes of Hinton’s Neural Networks for Machine Learning in Coursera.

1. Introduction

1a. Why do we need machine learning

What, Why

  • We don’t know how to program to solve some problems or the program might be very complicated.
  • Rules may need to change frequently, like recognizing fraud.
  • Cheap computation

How

  • Collect lots of cases with inputs and correct outputs.
  • ML algorithms takes examples and produces a program to do the job.

Good at

  • Recognizing patterns
    • Objects
    • Face
    • Spoken words
  • Recognizing anomalies (unusual)
    • Transactions
    • Sensor readings in a nuclear power plant
  • Prediction
    • Stock prices, exchange rates
    • Movie recommendations


Git

Some git notes.

基本配置

git config

# List configuration
git config -l
git config --global -l

# Config user's info
git config --global user.name "Mr.Blue"
git config --global user.email "silverhugh.77@gmail.com"

# Delete config
git config --global --unset user.username

# Config editor for git, use vim, nano or so on
git config --global core.editor "vim"
# True way to Commit
#   `git commit` will open an vim editor (set by command before)
#   write the commit message in it and `:x` to commit


Python

Some python notes.

Package notes

Jupyter Notebook

Jupyter kernels

# List kernels
jupyter kernelspec list

# Add python kernel to jupyter
# Name is like an id. This command can also be use to change dispaly name of an existed kernel.
/path/to/kernel/env/bin/python -m ipykernel install --prefix=/path/to/jupyter/env --name 'python-my-env' --display-name 'Python x - Display name'

# Remove kernels (Or just remove the whole directory listed with the command above)
jupyter kernelspec remove <jupyter-kernel-name>

Tricks

  • !pwd, 执行
  • np.dot??

Auto reload external python modules

IPython extension to reload modules before executing user code.

%load_ext autoreload
%autoreload 2


Math

Math notes.

Greek alphabet

Name Lowercase Uppercase
alpha \(\alpha\) \(A\)
beta \(\beta\) \(B\)
gamma \(\gamma\) \(\Gamma\)
delta \(\delta\) \(\Delta\)
epsilon \(\epsilon\) \(E\)
zeta \(\zeta\) \(Z\)
eta \(\eta\) \(H\)
theta \(\theta\) \(\Theta\)
iota \(\iota\) \(I\)
kappa \(\kappa\) \(K\)
lambda \(\lambda\) \(\Lambda\)
mu \(\mu\) \(M\)
nu \(\nu\) \(N\)
xi \(\xi\) \(\Xi\)
omicron \(\omicron\) \(O\)
pi \(\pi\) \(\Pi\)
rho \(\rho\) \(P\)
sigma \(\sigma\) \(\Sigma\)
tau \(\tau\) \(T\)
upsilon \(\upsilon\) \(\Upsilon\)
phi \(\phi\) \(\Phi\)
chi \(\chi\) \(X\)
psi \(\psi\) \(\Psi\)
omega \(\omega\) \(\Omega\)


Hugo

Hugo releated notes. Current take some notes when reading official docuemts

Reading documents

目录结构

.
├── archetypes
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes

archetypes: 用于hugo new,Lookup Order for Archetypes:

  • archetypes/posts.md
  • archetypes/default.md
  • themes//archetypes/posts.md
  • themes//archetypes/default.md (Auto-generated with hugo new site)


Keras

Notes about Keras.


Frequently used snippets


Problems encountered

2017-12-04 · Get variable’s value in middle layer

Problem description: I want to get the value of a variable in the model.

Reference: How can I get hidden layer representation of the given data? #41

The simplest way is using the same code of the original model, and

# replace the output with the variable you want
# code ...

new_model.set_weights(trained_model.get_weights())
new_model.predict(input_data, batch_size=32)

Note the batch_size is import for large amount of samples. The K.function() mentioned in the issue #41 raised OOM exception. Of course you can split data into batches by yourself and use the K.function() method, but the method showed above is more convinient for me in my case.