自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 收藏
  • 关注

原创 错误 InternalError: Dst tensor is not initialized

错误:InternalError: Dst tensor is not initialized.分析:出现这个错误一般是GPU内存耗尽,挂在后台进程中的IPython内核会这样做解决办法:运行程序之前,先运行export CUDA_VISIBLE_DEVICES=1,仅显卡设备1GPU可见,tensorflow 算是一个比较贪心的工具了就算用device_id指定gpu 也会占用别的GPU的显存资源 必须在执行程序前执行export CUDA_VISIBLE_DEVICES=n(n为可见的..

2020-08-17 14:51:45 514

原创 求AUC,accuracy

import pandas as pdimport lightgbm as lgbfrom sklearn.model_selection import train_test_splitfrom sklearn.preprocessing import label_binarizefrom sklearn.ensemble import RandomForestClassifierfrom sklearn.ensemble import GradientBoostingClassifierfr.

2020-08-13 16:51:52 274

原创 生成式模型和判别式模型的区别

判别模型(discriminative model)通过求解条件概率分布P(y|x)或者直接计算y的值来预测y。 线性回归(Linear Regression),逻辑回归(Logistic Regression),支持向量机(SVM), 传统神经网络(Traditional Neural Networks),线性判别分析(Linear Discriminative Analysis),条件随机场(Conditional Random Field) 生成模型(generative model..

2020-08-10 09:37:56 412

原创 Pandas 删除指定行

定位要删除的行需求:删除指定列中NaN所在行。如下图,’open‘ 列中有一行为NaN,定位到它,然后删除。定位:df[np.isnan(df['open'])].index# 这样即可定位到所在行的index,然后对该index进行drop操作即可删除行df.drop(df[np.isnan(df['open'])].index, inplace=True)# 直接drop对应indx即可删除该行...

2020-07-01 15:02:12 2969

原创 查找某个字符在字符串的位置

str_1='wo shi yi zhi da da niu 'char_1='i'nPos=str_1.index(char_1)print(nPos)运行结果:7========是使用find==========str_1='wo shi yi zhi da da niu 'char_1='i'nPos=str_1.find(char_1)print(nPos)结果:5

2020-06-28 10:49:21 1617 1

原创 string 转list

train_set_['his_list']=list(train_set_['his_list'].map(lambda x: literal_eval(x)))

2020-06-22 13:41:58 315

原创 Hive中yyyymmdd和yyyy-mm-dd日期之间的切换

方法1: 时间戳from_unixtime+ unix_timestamp--20201205转成2020-12-05 select from_unixtime(unix_timestamp('20201205','yyyymmdd'),'yyyy-mm-dd');--2020-12-05转成20201205select from_unixtime(unix_timestamp('2020-12-05','yyyy-mm-dd'),'yyyymmdd');方法2: 拼接法substr +.

2020-06-22 09:15:30 1151

原创 NDCG计算

import numpy as npdef getDCG(scores): return np.sum( np.divide(np.power(2, scores) - 1, np.log(np.arange(scores.shape[0], dtype=np.float32) + 2)), dtype=np.float32)def getNDCG(rank_list, pos_items): relevance = np.ones_like(p.

2020-06-10 17:36:13 959

原创 使用tf.ConfigProto()配置Session运行参数&&GPU设备指定

tf.ConfigProto()函数用在创建session的时候,用来对session进行参数配置:config = tf.ConfigProto(allow_soft_placement=True, allow_soft_placement=True)config.gpu_options.per_process_gpu_memory_fraction = 0.4 #占用40%显存sess = tf.Session(config=config)一动态申请内存config = tf.Con.

2020-06-10 14:02:21 286

原创 list列表删除元素 python

del:根据索引值删除元素del listname[start : end]pop():根据索引值删除元素listname.pop(index)remove():根据元素值进行删除listname.remove(values)clear():删除列表所有元素清空列表:listname.clear()...

2020-06-10 13:57:51 187

原创 tf.reset_default_graph()

Variable W already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at解决方案:加入:tf.reset_default_graph()import tensorflow as tftf.reset_default_graph()json_pritimive = "******.custom.nlp.Text.

2020-06-10 10:46:23 347

原创 解决编码问题

TypeError: a bytes-like object is required, not 'str'问题出在python3.5和Python2.7在套接字返回值解码上有区别:python bytes和str两种类型可以通过函数encode()和decode()相互转换,str→bytes:encode()方法。str通过encode()方法可以转换为bytes。bytes→str:decode()方法。如果我们从网络或磁盘上读取了字节流,那么读到的数据就是bytes。要把bytes变...

2020-06-08 19:18:58 172

原创 转换位串到utf-8字符串

使用str(string[, encoding])对数组进行转换如:\xe8\xa3\x85\xe5\xa4\x87\xe4\xba\xa4\xe6\x98\x93>>> str(req.readall(),'utf-8')

2020-03-31 18:21:26 281

原创 Windows下更换pip源

1.在资源管理器的地址栏输入%appdata%后回车:2.新建一个pip文件夹,在pip文件夹里面新建一个配置文件pip.ini。3.在配置文件中输入如下内容后保存即可:[global]timeout = 6000index-url = https://pypi.tuna.tsinghua.edu.cn/simpletrusted-host = pypi.tuna.tsi...

2020-03-24 11:25:30 380

原创 ModuleNotFoundError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is no

ModuleNotFoundError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package更新pandas解决方案: python3 -m pip install --upgrade pandas

2020-02-19 16:56:26 3031

转载 TensorFlow四种Cross Entropy算法实现和应用

来的就是confidence也就是概率,算法实现如下。 图片描述 ​softmax_cross_entropy_with_logits和sigmoid_cross_entropy_with_logits很不一样,输入是类似的logits和lables的shape一样,但这里要求分类的结果是互斥的,保证只有一个字段有值,例如CIFAR-10中图片只能分一类而不像前面判断是否包含多...

2019-02-23 12:38:50 261

转载 caffe+报错︱深度学习参数调优

点击打开链接

2018-05-10 16:41:28 163

转载 深度学习性能提升

点击打开链接

2018-05-10 16:35:24 140

转载 c++

点击打开链接

2018-05-10 16:34:14 114

转载 R-FCN、SSD、YOLO2、faster-rcnn和labelImg

点击打开链接

2018-05-10 16:30:59 124

转载 Detection物体检测及分类

https://blog.csdn.net/yimingsilence/article/details/53995721

2018-05-10 16:29:31 304

转载 SSD: Single Shot MultiBox Detector

SSD是对Faster RCNN RPN这一独特步骤的延伸与整合。总而言之,在思考于RPN进行2-class分类的时候,能否借鉴YOLO并简化faster rcnn在21分类同时整合faster rcnn中anchor boxes实现multi-scale的思想而设计出了SSD,这篇blog关于SSD的细节方面整理的很好,以供参考。https://blog.csdn.net/u010167269/...

2018-05-09 10:37:44 77

原创 内存对齐

一个成员变量需要多个机器周期去读的现象,称为内存不对齐。内存对齐,本质上是牺牲空间,换取时间的方法。

2018-05-08 16:53:17 75

原创 C语言---修饰符

autoregisterexternstatic

2018-05-04 21:43:51 262

原创 C语言---作用域

2018-05-04 19:51:34 151

原创 C语言----function

C语言包括:c语法和标准库自定义函数格式:

2018-05-03 16:01:43 3147

原创 C语言的格式符

格式说明由“%”和格式字符组成,如%d%f等。它的作用是将输出的数据转换为指定的格式输出。格式说明总是由“%”字符开始的。不同类型的数据用不同的格式字符。 格式字符有d,o,x,u,c,s,f,e,g,p等。 如对于指针来说,%p的打印的为所指向的数据地址。指针自己的实际地址为 &p,用%p来打印%d整型输出,%ld长整型输出,%o以八进制数形式输出整数,%x以十六进制数形式输出整数,%u...

2018-05-02 23:06:09 2722

原创 conda info -e 命令

查看anconda安装的所有虚拟环境conda info -e 命令

2018-04-29 16:13:39 7442

原创 pip install pypiwin32

windows系统上出现这个问题的解决需要安装Py32Win模块,做法是:pip install pypiwin32

2018-04-29 15:55:24 7547

原创 查看cpu的相关参数的指令

1>查看物理cpu个数grep 'physical id' /proc/cpuinfo | sort -u2>查看核心数量grep 'core id' /proc/cpuinfo | sort -u | wc -l3>查看线程数grep 'processor' /proc/cpuinfo | sort -u | wc -l...

2018-04-29 15:19:59 449

原创 解决UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range

字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。              Decode的作用是将其他编码的字符串转换成unicode编码,如str1.decode('gb2312'),表示将gb2312编码的字符串str1...

2018-03-12 12:49:18 39665 7

原创 pooling

poolin个的作用主要有两个方面:1:不变性(invariance),这种不变性包括translation(平移),rotation(旋转),scale(尺度)可通过一次或者多次max pooling达到要求,具有相同的特性2:保留主要的特性同时减少参数(降维,效果类似PCA)和计算量,防止过拟合,提高模型的泛化性能尺度不变性,也就是增大了感受野,即这个特征原来被16*16的表示,经过pooli...

2018-03-05 15:03:41 1689

原创 python文件转化exe文件

1.安装相关模块pip install Pyinstaller2.安装成功后cmd窗口cd到要转化的py文件所在目录pyinstaller -F xxx.py3.成功后当前文件夹下会多出来dist文件夹,生成的exe文件就在dist文件夹内

2018-01-15 19:49:37 222

原创 用pyplot显示cv2读入图片

点击打开链接

2018-01-12 13:52:39 453

原创 python 编程的常用命令

1.Python split()通过指定分隔符对字符串进行切片,如果参数num 有指定值,则仅分隔 num 个子字符串str.split(str="", num=string.count(str));- - -num 表示分割的次数2.random.random()用于生成一个指定范围内的随机符点数,两个参数其中一个是上限,一个是下限。如果a > b,则生成随机数n: a <= n <= b。如果

2018-01-12 10:10:36 354

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除