- 博客(8)
- 收藏
- 关注
原创 Python多线程
1.函数实现:对于不同任务 import threading loop = 10000 num = 0 def _add(loop): global num name = threading.current_thread().getName() for i in range(1oop): num += i def _sub(loop): name = threading.current_thread().getName() global num for i in range(1oop):
2022-01-21 15:49:51
451
原创 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
165
原创 EP2.numpy实现浅层神经网络
import numpy as np def 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
218
原创 EP1.numpy实现感知机
import numpy as np def 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
497
原创 HIT oj题解1004 - Prime Palindromes
** HIT oj题解1004 - Prime Palindromes ** http://acm.hit.edu.cn/problemset/1004 Problem Description The 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
450
原创 HIT oj题解1003 - Mixing Milk
** hoj题解1003 ** Problem Description Since 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
515
原创 HIT oj题解1002 - A+B+C
** hoj题解1002 ** Problem Description For 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. Input Output Sample Input 1 2 3 3 4 3 Sample O...
2019-03-30 16:08:20
616
原创 HIT oj题解1001 - A+B
** hoj题解1001 ** Problem Description for each pair of integers A and B ( 0 <= A,B <= 10) , Output the result of A+B on a single line. Input Output Sample Input 1 2 3 4 Sample Output 3 7 solution:...
2019-03-30 15:54:06
418
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅