首页 > 编程语言 > 详细

python tutorial

时间:2020-05-27 14:24:19      阅读:44      评论:0      收藏:0      [点我收藏+]

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

  1. PaddlePaddle: https://github.com/PaddlePaddle/Paddle

    https://paddlepaddle.org

  2. Caffe(image): https://github.com/BVLC/caffe

  3. Tensorflow(C++): https://github.com/tensorflow/tensorflow

  4. keras(Python): https://github.com/fchollet/keras

Tool of Reinforcement Learning

  1. PARL: https://github.com/paddlepaddle/parl

    DQN, DDPG, PPO, A2C

https://pan.baidu.com/s/1t_mBGiwre7eGTio-0MRqmQ

4efy

PyCharm

  1. link: https://pan.baidu.com/s/1t_mBGiwre7eGTio-0MRqmQ
  2. 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

  1. https://medium.com/datalogue/attention-in-keras-1892773a4f22
  2. https://github.com/zhaocq-nlp/Attention-Visualization
  3. https://github.com/Aurelius84/SPWE

relation between words --decoder

path

(r’D:\python\image.jpg‘) \ recognization

jieba library

install:

  • easy_install jieba or pip install jieba or pip3 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

技术分享图片

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

  1. 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)

python tutorial

原文:https://www.cnblogs.com/nan0121/p/12972470.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!