- 博客(8)
- 收藏
- 关注
原创 Python多线程
1.函数实现:对于不同任务import threadingloop = 10000num = 0def _add(loop): global num name = threading.current_thread().getName() for i in range(1oop): num += idef _sub(loop): name = threading.current_thread().getName() global num for i in range(1oop):
2022-01-21 15:49:51 383
原创 Python装饰器
1.类作为装饰器class TimeDecorator(object): def __init__(self, f): self.f = f def __call__(self, *args): start_time = time.time() result = self.f(*args) end_time = time.time() print('Time elapsed for {}'.format(end_time - start_time)) return result
2021-07-13 16:30:23 87
原创 EP2.numpy实现浅层神经网络
import numpy as npdef sigmoid(x): return 1/(1+np.exp(-x)) def train(): hidden_units=4 learning_rate=0.01 m=train_x.shape[1] iteration_nums=10000 input_dim=train_x.shape[0] ...
2019-05-31 23:00:17 153
原创 EP1.numpy实现感知机
import numpy as npdef sigmoid(x): return 1/(1+np.exp(-x)) def train():#设定参数值 m=train_x.shape[1] learning_rate=0.01 iteration_nums=10000 input_dim=train_x.shape[0]#初始化参数 ...
2019-05-30 14:43:29 392
原创 HIT oj题解1004 - Prime Palindromes
**HIT oj题解1004 - Prime Palindromes**http://acm.hit.edu.cn/problemset/1004Problem DescriptionThe number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same...
2019-03-31 16:46:36 352
原创 HIT oj题解1003 - Mixing Milk
**hoj题解1003**Problem DescriptionSince milk packaging is such a low margin business, it is important to keep the price of the raw product (milk) as low as possible. Help Merry Milk Makers get the m...
2019-03-30 16:13:16 387
原创 HIT oj题解1002 - A+B+C
**hoj题解1002**Problem DescriptionFor each pair of integers A B and C ( -2^31 <= A, B, C<= 2^31-1 ), Output the result of A+B+C on a single line.InputOutputSample Input1 2 33 4 3Sample O...
2019-03-30 16:08:20 485
原创 HIT oj题解1001 - A+B
**hoj题解1001**Problem Descriptionfor each pair of integers A and B ( 0 <= A,B <= 10) , Output the result of A+B on a single line.InputOutputSample Input1 23 4Sample Output37solution:...
2019-03-30 15:54:06 316
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人