- 博客(29)
- 收藏
- 关注
原创 ModuleNotFoundError: No module named 'ppdet'
环境配置Python版本 python3.7框架版本 PaddlePaddle 1.7.0使用PaddleDetection,出现这个问题ModuleNotFoundError: No module named ‘ppdet’解决方法:去这个报错了的py文件 ppdet/modeling/tests/test_architectures.py在第24行(from ppdet.mode...
2020-03-15 10:05:25 5840 4
原创 机器学习分类算法汇总
使用了机器学习的主要分类算法,包括xgboost,lightgbm,catboost等等。同时实现了stacking方法。from sklearn.model_selection import KFold, cross_val_scorefrom sklearn.model_selection import train_test_splitfrom sklearn.datasets impo...
2020-02-14 11:05:07 422
原创 强化学习基础知识小结
主要是对基础知识的总结,并给出了策略迭代算法和Q-learning算法收敛的证明(我用latex写的pdf文件,只好上传到网盘)。链接:https://pan.baidu.com/s/1meYh2_-3hfa-GVjBU3cp9Q提取码:dd8l...
2019-07-11 15:44:22 469
原创 数值概率算法和蒙特卡罗算法
设计伪随机数发生器并数值近似求解运用python编程,实现了一个伪随机数发生器[1],并计算的近似值以及所给积分的近似值,具体结果如图1。横坐标表示随机投点数,上图纵坐标表示对应的真实值,下图纵坐标表示所需的时间。从图1(左)中分析得到,当随机投点数为pow(10,3)时,使用该伪随机数发生器计算的近似值已经比较接近圆周率pi的真实值,并且从时间消耗图来看,对应的时间消耗并不大;从图1(右)中分...
2019-06-10 20:29:16 1341
原创 蒙特卡洛算法模拟在线雇佣问题
使用蒙特卡洛算法,借助MATLAB编程模拟了在线雇佣问题[1],并得到了雇佣第几位应聘者与雇佣到分数大于98应聘者概率的变化曲线,具体结果见图1。分析可知,当雇佣第1位应聘者到雇佣第34位应聘者时,雇佣到分数大于98应聘者的概率逐渐增加;当雇佣第35位应聘者到雇佣第100位应聘者时,对应概率逐渐减少。故最优策略是雇佣第34位应聘者,这样得到的雇佣到分数大于98应聘者的概率最大,其值为52.26%。...
2019-06-10 20:28:46 778 1
原创 大整数乘法和Strassen矩阵乘法
1.大整数乘法由于python语言可以实现任意精度的乘法,故这里采用python语言实现常规算法与分治算法的时间效率。结果如下图:常规算法与分治算法的时间效率横轴表示相乘两数的位数,纵轴表示常规算法与分治算法分别所用的时间。可以看到,常规算法的时间效率虽然偶尔有些小幅度的波动,但是基本上呈指数增长的趋势。而分治算法的时间效率随着位数的增加,其波动幅度在增大,但是整体趋势却没有出现明显增长的...
2019-05-19 16:52:51 857
原创 使用keras进行迁移学习遇到的问题
这篇博客介绍使用keras加载vgg16等模型权重文件失败的解决办法和模型.h5文件网盘下载地址但是文件里面只有训练好的各种模型,使keras框架进行相关操作时,还需要下载标签文件。示例如下:from keras.applications.resnet50 import ResNet50from keras.preprocessing import imagefrom keras.appl...
2018-12-04 15:51:23 1445
原创 《深度学习之Tensorflow》学习笔记十
从几个方面对该网络模型进行优化:1.首先使用函数封装库tf.contrib.layers重写网络模型,使得代码更加简洁明了,可读性更高。(不过这个函数封装库在Tensorflow即将到来的2.0版本将被取消,所以打算后面运用tf.keras重写一遍。)2.在实际的卷积训练中,为了加快速度,可以考虑把卷积核裁开。比如一个3x3的卷积核,可以裁成3x1和1x3两个卷积核,分别对原有输入做卷积操作,...
2018-11-29 19:49:32 281
转载 《深度学习之Tensorflow》学习笔记八
import cifar10_inputimport tensorflow as tfimport numpy as npbatch_size = 28data_dir = r'D:\anaconda\a_lianxi\cifar_study\tmp\cifar10_data\cifar-10-batches-bin'print('begin')images_train,labels...
2018-11-29 19:23:53 276
转载 《深度学习之Tensorflow》学习笔记九
建立一个简单的卷积神经网络:import cifar10_inputimport tensorflow as tfimport numpy as np#每次导入28张图片进行计算batch_size = 28# 注意数据集存放的路径data_dir = r'D:\anaconda\a_lianxi\cifar_study\tmp\cifar10_data\cifar-10-batc...
2018-11-29 19:21:15 208
原创 《深度学习之Tensorflow》学习笔记七
卷积神经网络# Copyright 2015 The TensorFlow Authors. All Rights Reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the Licen...
2018-11-29 16:52:12 266
转载 《深度学习之Tensorflow》学习笔记六
卷积函数import tensorflow as tfinput = tf.Variable(tf.constant(1.,shape=[1,5,5,1]))input2 = tf.Variable(tf.constant(1.,shape=[1,5,5,2]))input3 = tf.Variable(tf.constant(1.,shape=[1,4,4,1]))filter1 ...
2018-11-29 16:12:34 204
转载 《深度学习之Tensorflow》学习笔记五
线性逻辑回归二分类与多分类import tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltimport randomfrom sklearn.utils import shufflefrom matplotlib.colors import colorConverter, ListedColormap...
2018-11-29 16:11:36 288
转载 《深度学习之Tensorflow》学习笔记四
一些损失函数之间的比较import tensorflow as tfimport numpy as np# labels = [[0,0,1],[0,1,0]]# logits = [[2, 0.5,6],[0.1,0,3]]## logits_scaled = tf.nn.softmax(logits)# logits_scaled2 = tf.nn.softmax(logits...
2018-11-29 16:09:54 227
转载 《深度学习之Tensorflow》学习笔记三
计算图的相关操作import tensorflow as tfimport numpy as np# c = tf.constant(0.)## g = tf.Graph()# with g.as_default():# c1 = tf.constant(0.)# # print(c1.graph)# # print(g)# # print(c...
2018-11-29 16:07:32 176
转载 《深度学习之Tensorflow》学习笔记二
共享变量import tensorflow as tf# var1 = tf.Variable(1.,name='firstvar')# print(var1.name)## var1 = tf.Variable(2.,name='first')# print(var1.name)## var2 = tf.Variable(3.)# print(var2.name)## v...
2018-11-29 16:03:59 182
原创 《深度学习之Tensorflow》学习笔记一
模型的保存与可视化import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plttrain_X = np.float32(np.linspace(-1,1,100))train_Y = 2 * train_X + np.random.randn(*train_X.shape) * 0.3tf.rese...
2018-11-29 15:57:00 439
转载 TensorFlow中张量以及操作矩阵的基础知识
《TensorFlow机器学习实战指南》学习笔记import tensorflow as tfimport numpy as npsess=tf.Session()zero_tsr=tf.zeros([4,5])#4行,5列#print(sess.run(zero_tsr))ones_tsr=tf.ones([2,3])#print(sess.run(ones_tsr))#...
2018-06-02 16:03:16 1586
转载 《TensorFlow机器学习实战指南》学习笔记四
用TensorFlow实现神经网络常见层,代码如下:import tensorflow as tfimport numpy as npsess=tf.Session()#初始化数据data_size=25data_ld=np.random.normal(size=data_size)x_input_ld=tf.placeholder(dtype=tf.float32,shap...
2018-05-11 15:50:47 429
转载 《TensorFlow机器学习实战指南》学习笔记三
用TensorFlow实现单层神经网络,并在Iris数据集上进行模型训练。 代码如下:import matplotlib.pyplot as pltimport numpy as npimport tensorflow as tffrom sklearn import datasetsiris=datasets.load_iris()x_vals=np.array([x[0:...
2018-05-10 16:54:54 303
转载 《TensorFlow机器学习实战指南》学习笔记二
通过两种不同的激励函数(sigmoid激励函数和ReLU激励函数),创建两个相同结构的单层神经网络。代码如下:import tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltsess=tf.Session()tf.set_random_seed(5)np.random.seed(42)batch_...
2018-05-10 15:31:59 219
转载 《TensorFlow机器学习实战指南》学习笔记一
实现一个简单函数 声明a和b为变量,x为占位符。向目标值50优化输出结果。 代码如下:import tensorflow as tfimport numpy as npsess=tf.Session()a=tf.Variable(tf.constant(1.))b=tf.Variable(tf.constant(1.))x_val=10.x_data=tf.placehold...
2018-05-10 14:45:47 557
原创 《数据结构教程》(第5版)李春葆 学习笔记(七)
**图的一些基本运算算法以及DFS,BFS#include <iostream>#include<cstdlib>#include<queue>using namespace std;const int MAXV=5;const int INF=32767;//边结点的类型 typedef struct ANode{ i...
2018-05-08 20:08:40 3148
原创 《数据结构教程》(第5版)李春葆 学习笔记(六)
根据一颗二叉树的先序序列和中序序列来构造二叉树,并后序遍历输出#include <iostream>#include<cstdlib>#include<cstring>using namespace std;typedef char ElemType;typedef struct node{ ElemType data; struct node...
2018-04-27 16:07:16 1678
原创 《数据结构教程》(第5版)李春葆 学习笔记(五)
这是二叉树的层次遍历算法:#include <iostream>#include<queue>#include<algorithm>using namespace std;const int MaxSize=100;typedef char ElemType;typedef struct node{ ElemType data; struct ...
2018-04-27 15:38:35 2776
原创 《数据结构教程》(第5版)李春葆 学习笔记(四)
一些简单的关于二叉树的算法:#include <iostream>#include<cstdlib>using namespace std;typedef char ElemType;const int MaxSize=100;typedef struct node{ ElemType data; struct node *lchild; struct ...
2018-04-26 17:12:56 1202
原创 《数据结构教程》(第5版)李春葆 学习笔记(三)
这是实现二叉树的基本运算算法:#include <iostream>#include<cstdlib>using namespace std;typedef char ElemType;const int MaxSize=100;//二叉树中结点类型BTNode的声明 typedef struct node{ ElemType data; struct n...
2018-04-26 16:00:05 2869
原创 《数据结构教程》(第5版)李春葆 学习笔记(二)
这是实现链栈的各种基本运算的算法:#include <iostream>#include<cstdlib>#include<cstring>using namespace std;typedef char ElemType;//声明链栈的类型 typedef struct linknode{ ElemType data; struct li...
2018-04-25 19:46:23 1531 1
原创 《数据结构教程》(第5版)学习笔记(一)
这是实现顺序栈的各种基本运算的算法:#include <iostream>#include<cstdio>#include<cstdlib>using namespace std;typedef int ElemType;const int MaxSize=100;//声明顺序栈的类型 typedef struct{ ElemType dat...
2018-04-25 19:18:42 2479
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人