zzm99


  • Home

  • Tags

  • Categories

  • Archives

  • Search

http协议基础知识

Posted on 2019-05-04 | In python , 学习爬虫 , 爬虫专题 |
Words count in article: 2.8k | Reading time ≈ 10

HTTP 简介

HTTP 简介

HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于从万维网(WWW:World Wide Web )服务器传输超文本到本地浏览器的传送协议。。

HTTP是一个基于TCP/IP通信协议来传递数据(HTML 文件, 图片文件, 查询结果等)。

Read more »

leetcode-79-Word Search

Posted on 2019-05-04 | In leetcode , top-100-liked-questions |
Words count in article: 330 | Reading time ≈ 2

Given a 2D board and a word, find if the word exists in the grid.

Read more »

leetcode-55-Jump Game

Posted on 2019-05-04 | In leetcode , top-100-liked-questions |
Words count in article: 492 | Reading time ≈ 2

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Read more »

leetcode-142-Linked List Cycle II

Posted on 2019-05-04 | In leetcode , top-100-liked-questions |
Words count in article: 923 | Reading time ≈ 4

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.

Read more »

leetcode-739-Daily Temperatures

Posted on 2019-05-04 | In leetcode , top-100-liked-questions |
Words count in article: 523 | Reading time ≈ 2

Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.

For example, given the list of temperatures T = [73, 74, 75, 71, 69, 72, 76, 73], your output should be [1, 1, 4, 2, 1, 1, 0, 0].

Note: The length of temperatures will be in the range [1, 30000]. Each temperature will be an integer in the range [30, 100].

Read more »

leetcode-221-Maximal Square

Posted on 2019-05-04 | In leetcode , top-100-liked-questions |
Words count in article: 640 | Reading time ≈ 3

Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.

Read more »

leetcode-236-Lowest Common Ancestor of a Binary Tree

Posted on 2019-05-03 | In leetcode , top-100-liked-questions |
Words count in article: 755 | Reading time ≈ 3

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

Read more »

使用Pytorch库实现动图线性回归

Posted on 2019-05-03 | In python , 库的学习 , PyTorch库 |
Words count in article: 164 | Reading time ≈ 1

python代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import imageio

torch.manual_seed(0)

num_samples = 100

x_train = torch.linspace(0, 1, num_samples)
y_train = 0.1 * x_train + 0.2 + torch.randn(num_samples)*0.03

w = torch.randn(1, requires_grad=True)
b = torch.randn(1, requires_grad=True)

criterion = nn.MSELoss()
optimizer = torch.optim.SGD([w,b], lr=0.01)

images = []
num_epochs = 4000
for epoch in range(num_epochs):
y_pred = w * x_train + b
loss = criterion(y_pred, y_train)
optimizer.zero_grad()
loss.backward()
if epoch % 100 == 99:
plt.figure()
plt.ylim(torch.min(y_train).item(), torch.max(y_train).item())
plt.scatter(x_train.tolist(), y_train.tolist(), marker='.')
plt.plot(x_train.tolist(), y_pred.tolist(), color='r', linewidth=2)
plt.title('Epoch [{}/{}], Loss: {:.6f}, \n Weight: {:.6f}, Bias: {:.6f}'
.format(epoch+1, num_epochs, loss.item(), w.item(), b.item()))
plt.savefig('a.png')
plt.close()
images.append(imageio.imread('a.png'))
optimizer.step()

imageio.mimsave('gen.gif', images, duration=0.5)
Read more »

PIL库里的基本知识概念

Posted on 2019-04-29 | In python , 库的学习 , PIL库 |
Words count in article: 12.5k | Reading time ≈ 55

首先,介绍一下PIL中的基本概念。

PIL中所涉及的基本概念有如下几个:通道(bands)、模式(mode)、尺寸(size)、坐标系统(coordinate system)、调色板(palette)、信息(info)和滤波器(filters)。

Read more »

使用PIL库进行gif图的解析或合成

Posted on 2019-04-29 | In python , 库的学习 , PIL库 |
Words count in article: 664 | Reading time ≈ 3

那个星夜越过千年
而我绕过半个地球
重新来寻那个你
那个亮尽我的眼的你
一颗流星划过
坠入无边黑暗
你等我一千年
我找你十万里
——《星空》湮夫

Read more »

1…363738
zzm99

zzm99

372 posts
40 categories
3 tags
GitHub
0%
© 2020 zzm99 | Site words total count: 409.1k
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4