- 博客(13)
- 收藏
- 关注
原创 python一些好例子来快速获得技能
Unpacking Elementsfirst, *others = (1,2,3,4)first, *middle, last = (1,2,3,4)name, email, *phone_numbers = ('Jack', 'jack@gmail.com', '1234567', '122333')Keeping the last N itemscollections.deque(maxlen=5)Finding the largest or smallest N items.
2021-03-28 21:53:57
92
原创 python中的descriptor
what is a descriptor?Three behaviors for an attribute of an object:readsetdeleteDesctiptor is a hook when accessing an attributeDemoclass Book(object): def __init__(self): self._page = 0 @property def page(self): return
2021-03-07 22:46:23
107
原创 python的闭包和装饰器
closurehttps://www.programiz.com/python-programming/closuredef get_config_table(): cfg = {'a':1, 'b':2} return cfgdef get_config_index(): config_table = get_config_table() def wrapper(cfg_name): return config_table.get(cfg_name,
2021-03-07 22:44:40
118
1
原创 python的profiling和如何运行更快初探
ProfileSolutionUse time tool[willchen@dn121201 cProfile]$ /usr/bin/time -v python test.py Command being timed: "python test.py" User time (seconds): 1.17 System time (seconds): 0.14 Percent of CPU this job got: 56% Elapsed (wall clock) time (h:
2021-03-07 22:41:57
119
原创 python中的meta初探
Table of Contents1 About Meta1.1 type & object & class & instance1.1.0.1 instance's class1.1.0.2 class's class and parents1.1.0.3 type's parent1.2 __call__'s role in class and t
2021-03-07 22:39:22
1159
1
原创 python中的反射和自省
Introspectionexamine something, typically an object, at runtime.dir()dir(object)['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__',
2021-03-07 22:36:42
103
原创 python解释器初探
Usagesrun python filepython test.pyrun a module-m: modulepython -m pdb test.pypython -m pydoc -p 9000input from stdin(base) PS C:\> pythonPython 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win
2021-03-07 22:34:37
197
原创 python中的help
built-in help()import tensorflow as tfhelp(tf)Help on package tensorflow:NAME tensorflow - TensorFlow root packagePACKAGE CONTENTSDATA __compiler_version__ = 'MSVC 191627035' __cxx11_abi_flag__ = 0 __git_version__ = 'unknown'
2021-03-07 22:30:23
87
原创 python中的并发
Table of Contents1 Concurrency2 When is concurrency usefule2.1 Summary3 How to improve3.1 Synchronous Version3.2 Threading Version3.2.1 What it looks like3.2.2 downsid
2021-03-07 22:21:49
166
原创 一些python3比较有用的特性
What’s new in pythonThere are so many new things in Python3.8.2(can be several books), only go through and pick something interesting to introduce here.Summary from Python3.8.2 documentationWhat’s New In Python 3.0compared to 2.6Print Is A Function
2021-03-07 22:19:52
164
原创 深入理解Python的class
Table of Contents1 Definition1.1 1.MRO1.1.1 A Demo1.2 2.Determining the appropriate metaclass1.3 3.Preparing the class namespace1.4 4.Executing the class body1.5 5.Creating the c
2021-03-07 22:15:41
238
1
原创 Active Learning的简介
解决什么问题数据标记有时候是个大问题,几百,几千,几万,十万,百万,千万的数据要一一标注的成本非常高。引入active learning,是希望能减少数据标注的量。是什么?训练的数据不是一开始全部给,而是选择比较有用的数据,慢慢动态地增加,如上图。原理一句话,就是训练数据对模型的贡献程度不同,尽量挑选那些关键的数据。比如上图平面的点分类问题,只需要在中间间隔的数据就够了,而明显在2边的数据则对我们的分割线没啥帮助。如何做重点在数据的选择方法,常用的有如下方法:Least Conf
2020-10-19 09:15:52
657
原创 几种python debugger简介
PDBRefer to: https://docs.python.org/3/library/pdb.htmla python moduleso can be executed by python -m pdb <source_file>Usagepython -m pdb <source_file>actually call Pdb()._runscript(source_file)insert by code:import pdbpdb.set_tra
2020-10-15 10:51:15
674
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人