weight

Day05

独自空忆成欢 提交于 2019-12-01 12:43:26
一、数据类型的划分: python中的数据类型划分为: 可变的数据类型: list , 字典,set(集合) 不可变的数据类型:元组 , int ,bool ,str (字符串是不可变的类型,因为对字符串的修改是创建了一个新的字符串,而不是在原有的字符串的基础上进行改变) 可哈希 二:字典简介 字典有键值对(键和值)组成,和数据库中的主键有些类似,一个键对应的一个值。 键:因为一个键确定值,所以键是不能改变的数据类型 (int ,bool ,str,元组) 都可以作为键的类型 值:字典的值可以是任何类型 优点:字典是无序的,但是字典中的键是有序排列的。而且,字典在查找的时候,在键中优先采用二分法进行查找,所以字典的查找速率很快。 特点:字典的存储是无序的,有点分布式数据库的意思。 三:字典的创建 字典的格式:一般用大括号括起来,键于值之间用冒号连接 1 dic = { 2 键1 :值1, 3 键2 : 值2, 4 } 代码演示: 1 dic = { 2 "name":["huao","zhao"], 3 '计科':[{"name":"胡澳",'age':18}, 4 {"name":"胡澳",'age':19} 5 ], 6 True:1, 7 (1,2,3):"胡澳", 8 2:"二哥" 9 } 10 print(dic) 运行结果: D:\常用软件\Python3.7

成员变量的隐藏和方法重写

淺唱寂寞╮ 提交于 2019-12-01 10:03:59
一:成员变量的隐藏 子类继承的方法只能操作子类继承和隐藏的成员变量。子类新定义的方法可以操作子类继承和子类新声明的成员变量,但无法操作子类隐藏的成员变量(需使用super关键字操作子类隐藏的成员变量(下次更新super关键字))。 Goods.java package chengyuanbianliangdeyincang; public class Goods { public double weight; public void oldSetWeight(double w) { weight=w; System.out.println("double型的weight="+weight); } public double oldGetPrice() { double price=weight*10; return price; } } CheapGoods.java package chengyuanbianliangdeyincang; public class CheapGoods extends Goods{ public int weight; public void newSetWeight(int w) { weight=w; System.out.println("int型的weight="+weight); } public double newGetPrice(

R in action -- chapter 8

筅森魡賤 提交于 2019-12-01 07:46:34
rm(list = ls()) fit <- lm(weight ~ height, women) summary(fit) women$weight fitted(fit) confint(fit) residuals(fit) with(women,plot(height,weight, xlab = "height (in inches)", ylab = "weight (in pounds)")) abline(fit) fit2 <- lm(weight ~ height + I(height^2), women) summary(fit2) with(women,plot(height,weight, xlab = "height (in inches)", ylab = "weight (in pounds)")) lines(women$height,fitted(fit2)) library(car) scatterplot(weight ~ height, data = women, spread = FALSE, smoother.agrs=list(lty=2),pch = 20, main = "women age 30 - 39", xlab = "height (inches)", ylab = "weight (lbs.)") states <-

凸多边形最优三角剖分问题

做~自己de王妃 提交于 2019-11-28 19:50:20
参考书籍《算法设计与分析》 王晓东 动态规划 1.问题描述 (注:是所有的三角形的权值之和,不是只计算边和弦的权值之和) 2.分析 3.编码实现: /** * @Author:胡家威 * @CreateTime:2011-11-10 下午12:31:16 * @Description:凸多边形的最优三角剖分 */ package ex2; public class Triangulation { private int n; // n多边形 private int [][] weight; // 边的权值数组 public Triangulation( int n) { this .n = n; this .weight = new int [n][n]; } public static void main(String[] args) { Triangulation triangulation = new Triangulation( 6 ); initTriangulation(triangulation); int n = triangulation.getN(); // 凸多边形的边数 int [][] t = new int [n][n]; // t[i][j]表示顶点{Vi-1,Vi...Vj}组成的多边形的最优三角形剖分的权值 int [][] s = new int

python图论包networks(持续更新中)

≯℡__Kan透↙ 提交于 2019-11-28 00:59:24
官方文档: https://networkx.github.io/documentation/networkx-1.10/reference/algorithms.html 最短路: import networkx as nx import matplotlib.pyplot as plt G = nx.Graph() #G.add_node(1) #添加一个节点1 #G.add_edge(2,3,10) #添加一条边2-3(隐含着添加了两个节点2、3) #G.add_edge(3,2) #对于无向图,边3-2与边2-3被认为是一条边 #G.add_weighted_edges_from([(1,2,8)]) #G.add_weighted_edges_from([(1,3,10)]) #G.add_weighted_edges_from([(2,3,6)]) G.add_edge('A', 'B', weight=4) G.add_edge('B', 'D', weight=2) G.add_edge('A', 'C', weight=3) G.add_edge('C', 'D', weight=5) G.add_edge('A', 'D', weight=6) G.add_edge('C', 'F', weight=7) G.add_edge('A', 'G', weight

卷积神经网络的可视化(一)

空扰寡人 提交于 2019-11-27 14:04:40
卷积神经网络简单可视化 在本次练习中,我们将可视化卷积层 4 个过滤器的输出(即 feature maps)。 加载图像 import cv2 import matplotlib.pyplot as plt %matplotlib inline img_path = 'images/udacity_sdc.png' bgr_img = cv2.imread(img_path) gray_img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2GRAY) gray_img = gray_img.astype("float32")/255 plt.imshow(gray_img, cmap='gray') plt.show() 定义并可视化过滤器(卷积核) import numpy as np filter_vals = np.array([[-1, -1, 1, 1], [-1, -1, 1, 1], [-1, -1, 1, 1], [-1, -1, 1, 1]]) print('Filter shape: ', filter_vals.shape) Filter shape: (4, 4) filter_1 = filter_vals filter_2 = -filter_1 filter_3 = filter_1.T filter_4 =

nginx反向代理

守給你的承諾、 提交于 2019-11-26 03:34:28
user nginx; worker_processes auto; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; upstream www { server 192.168.1.125:81 weight=1 max_fails=2 fail_timeout=3;