TinaCristal's Blog


  • Home

  • Tags

  • Categories

  • Archives

  • Search

numpy的concatenate函数

Posted on 2018-09-22

concatenate((a1, a2, …), axis=0)

Read more »

遗传算法中的交叉配对

Posted on 2018-09-22 | In 遗传算法

选择DNA的部分进行交叉配对

Read more »

numpy中的dtype和astype

Posted on 2018-09-22 | In python

1、查看数据类型

1
2
3
4
5
6
7
8
9
10
11
12
13
14
In [11]: arr = np.array([1,2,3,4,5])

In [12]: arr
Out[12]: array([1, 2, 3, 4, 5])

// 该命令查看数据类型
In [13]: arr.dtype
Out[13]: dtype('int64')

In [14]: float_arr = arr.astype(np.float64)

// 该命令查看数据类型
In [15]: float_arr.dtype
Out[15]: dtype('float64')

Read more »

python matplotlib画图

Posted on 2018-09-22 | In python
1
2
3
4
5
6
7
8
9
10
11
12
13
import numpy as np
import matplotlib.pyplot as plt

h0 = [0.4,.6,.8] # h0取值
lambda0 = [0.03,0.05,0.07] # λ取值
plt.figure(figsize=(6,4)) # 设置图片大小
x = np.linspace(0, 50, 50) # 在[0,50)中取50个点

for i in lambda0:
for h in h0:
plt.plot(x, 11+(20*np.exp(-i*x)-h*x)/2,label='lambda='+str(i)+' h='+str(h))
# plt.plot(x,y,图例内容)
plt.legend() # 显示图例
Read more »

python numpy arrange 函数

Posted on 2018-09-22 | In python

python自带的range函数

函数说明: range(start, stop[, step]) -> range object,根据start与stop指定的范围以及step设定的步长,生成一个序列。

参数含义:start:计数从start开始。默认是从0开始。例如range(5)等价于range(0, 5);

end:技术到end结束,但不包括end.例如:range(0, 5) 是[0, 1, 2, 3, 4]没有5

scan:每次跳跃的间距,默认为1。例如:range(0, 5) 等价于 range(0, 5, 1)

函数返回的是一个range object

1
2
3
4
5
6
7
8
>>> range(0,5) 			 	#生成一个range object,而不是[0,1,2,3,4] 
range(0, 5)
>>> c = [i for i in range(0,5)] #从0 开始到4,不包括5,默认的间隔为1
>>> c
[0, 1, 2, 3, 4]
>>> c = [i for i in range(0,5,2)] #间隔设为2
>>> c
[0, 2, 4]
Read more »

周总结(10)

Posted on 2018-09-16 | In 周总结

学习

  • 高数看完了1,2章

  • 继续看了php书 20 30 页

Read more »

Python numpy中np_r和np_c

Posted on 2018-09-10 | In python

np.r_是按行连接两个矩阵,就是把两矩阵上下相加,要求行数相等,类似于pandas中的concat()

np.c_是按列连接两个矩阵,就是把两矩阵左右相加,要求列数相等,类似于pandas中的merge()

Read more »

eclipse 快捷键总结

Posted on 2018-09-09 | In 软件和工具
  1. Ctrl+左键 和F3
    这个是大多数人经常用到的,用来查看变量、方法、类的定义
    跳到光标所在标识符的定义代码。当按执行流程阅读时,F3实现了大部分导航动作。

    Read more »

周总结(9)

Posted on 2018-09-09 | In 周总结

生活

这学期课选的很少

前几天真的是很闲… 突然一时不知道做什么

Read more »

python numpy的shape和reshape用法

Posted on 2018-09-07 | In python

导入numpy模块

from numpy import *
或者
import numpy as np

Read more »

1…323334…45

TinaCristal

443 posts
57 categories
55 tags
GitHub E-Mail
© 2020 TinaCristal
Powered by Hexo
|
Theme — NexT.Mist v5.1.4