
随机森林
机器学习相关概率与统计知识和代码
飞行codes
资浅程序员,博士
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
生成一维高斯曲线和噪声数据
高斯函数定义为 (1)我们生成高斯数据和曲线:import numpy as npimport matplo...原创 2020-09-30 09:04:36 · 2092 阅读 · 0 评论 -
python划简技巧sort, index, set
有时查找、排序等常用功能,我们习惯for循环,其实有很多python自带的方法可以简洁的实现。排序f=[1,3,4,1,8,5]f.sort()1, 1, 3, 4, 5, 8f2 = np.random.permutation(10)f2 = np.sort(f2)array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])查找/索引knigh...原创 2019-04-12 12:02:13 · 458 阅读 · 0 评论 -
np.where()巨型指导
涉及bool运算其实有点绕,官网太简洁,不好懂。Return elements, either fromxory, depending oncondition.If onlyconditionis given, returncondition.nonzero().1,一维数组情形import numpy as npx=np.random.randn(10)y=...原创 2019-11-25 11:13:22 · 747 阅读 · 0 评论 -
生成随机数语法速查
import tensorflow as tfw1=tf.Variable(tf.random_uniform([2,2],-1,1))with tf.Session() as sess: init = tf.global_variables_initializer() sess.run(init) print(sess.run(w1))输出得[[ 0.9...原创 2018-11-27 15:52:28 · 352 阅读 · 0 评论 -
numpy.random.choice()函数用法与应用场景
函数用法Generates a random sample from a given 1-D arrayimport numpynumpy.random.choice(100, 3)输出:array([83, 80, 65])numpy.random.choice([1,0.2,7,'c'],2)输出:array(['c', '0.2'], dtype='|S32...原创 2019-01-24 17:19:47 · 986 阅读 · 0 评论 -
训练集、验证集和测试集随机划分实现代码
VALIDATION_PERCENTAGE = 10TEST_PERCENTAGE = 10validation_images=[]validation_labels=[]testing_images=[]testing_labels=[]training_images=[]training_labels=[]chance = np.random.randint(100)i...原创 2018-12-29 11:38:51 · 11294 阅读 · 0 评论 -
python随机打乱代码实现
train_data 和 train_label保持对应state = np.random.get_state()np.random.shuffle(train_data)np.random.set_state(state)np.random.shuffle(train_label)原理numpy.random.set_state(state)Set the internal...原创 2018-12-27 14:13:58 · 830 阅读 · 0 评论