目录
-
Beginning Python
- 1.matplotlib:example of figures
- 2.font Chinese
- 3.print method
- 4.if-else
- 5.compare two numbers
- 6.Parameters of legend
- 7.Machine Learning
- 8.SVM
- Tool of Deep Learning
- Tool of Reinforcement Learning
- Python3.5 link
- PyCharm
- PiP command
- image augmentation
- Deep Reinforcement Learning
- Attention Matrix Visualization
- beam Search
- path
- jieba library
- numpy list array
- books and links for python
- Python environment conda
- combinations and permutations
- file copy and delete
- Random
Beginning Python
1.matplotlib:example of figures
https://matplotlib.org/gallery/index.html
2.font Chinese
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
plt.title("折线图进阶",fontproperties="simhei")
or
plt.rcParams['font.sans-serif']=['SimHei']
3.print method
print(int(str(i)+str(j)+str(k)),end=' ')
4.if-else
min = x if x<y else y
5.compare two numbers
0.4-0.3 == 0.1 #deviation
math.isclose(0.4-0.3,0.1)
6.Parameters of legend
plt.legend(loc='best')
plt.legend(loc="upper right",fontsize=8,borderaxespad=0.3)
7.Machine Learning
https://scikit-learn.org/stable/index.html
8.SVM
LibSVM: https://www.csie.ntu.edu.tw/~cjlin/libsvm/
SVM-Light: http://svmlight.joachims.org/
Liblinear:https://www.csie.ntu.edu.tw/~cjlin/liblinear/
valid:
http://ntur.lib.ntu.edu.tw/bitstream/246246/20060927122847351581/1/libsvm.pdf
Tool of Deep Learning
-
PaddlePaddle: https://github.com/PaddlePaddle/Paddle
-
Caffe(image): https://github.com/BVLC/caffe
-
Tensorflow(C++): https://github.com/tensorflow/tensorflow
-
keras(Python): https://github.com/fchollet/keras
Tool of Reinforcement Learning
-
PARL: https://github.com/paddlepaddle/parl
DQN, DDPG, PPO, A2C
Python3.5 link
https://pan.baidu.com/s/1t_mBGiwre7eGTio-0MRqmQ
4efy
PyCharm
- link: https://pan.baidu.com/s/1t_mBGiwre7eGTio-0MRqmQ
- code: 4efy
PiP command
upgrade pip : python -m pip install --upgrade pip
image augmentation
https://github.com/aleju/imgaug
Deep Reinforcement Learning
Attention Matrix Visualization
- https://medium.com/datalogue/attention-in-keras-1892773a4f22
- https://github.com/zhaocq-nlp/Attention-Visualization
- https://github.com/Aurelius84/SPWE
beam Search
relation between words --decoder
path
(r’D:\python\image.jpg')
\
recognization
jieba library
install:
-
easy_install jieba
orpip install jieba
orpip3 install jieba
-
https://pypi.python.org/pypi/jieba/
python setup.py install
- put the content of jieba to site-packages
- import jiebe
numpy list array
install: python -m pip intall --user numpy
books and links for python
Python environment conda
1.Create a new environment:
conda create --name <env_name> <package_name>
example:
conda create --name python3 python3.7
2.List all envs
conda info --envs
3.activate/del environment
conda activate python3
conda deactivate
conda remove --name python3 --all
- Tsinghua tuna
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda install numpy
conda remove numpy
conda remove --name <env_name> <package_name>
- version
conda search --full-name pandas
conda list
combinations and permutations
from itertools import *
characters = '1234'
for item in combinations(characters,3):
print(item,end=' ')
print('\n'+'='*20)
for item in permutations(characters,3):
print(item,end=' ')
file copy and delete
shutil
Random
import random
random.choice('a','b','c')
random.sample(range(100),10) # sampling without replacement
random.random() # random float 0-1
random.randrange(6) # random integer chosen from range(6)