- 《Learning to Reweight Examples for Robust Deep Learning》笔记
HackerTom
数学机器学习meta-learning元学习噪声noisy
[1]用meta-learning学样本权重,可用于classimbalance、noisylabel场景。之前对其(7)式中ϵi,t=0\epsilon_{i,t}=0ϵi,t=0(对应Algorithm1第5句、代码ex_wts_a=tf.zeros([bsize_a],dtype=tf.float32))不理解:如果ϵ\epsilonϵ已知是0,那(4)式的加权loss不是恒为零吗?(5)式
- 深度学习笔记(四)——使用TF2构建基础网络的常用函数+简单ML分类实现
絮沫
深度学习深度学习笔记分类
文中程序以Tensorflow-2.6.0为例部分概念包含笔者个人理解,如有遗漏或错误,欢迎评论或私信指正。截图和程序部分引用自北京大学机器学习公开课TF2基础常用函数1、张量处理类强制数据类型转换:a1=tf.constant([1,2,3],dtype=tf.float64)print(a1)a2=tf.cast(a1,tf.int64)#强制数据类型转换print(a2)查找数据中的最小值和
- tensorflow学习笔记----2.常用函数1
qq_35821503
tensorflow深度学习
1.强制tensor转换为该数据类型tf.cast(张量名,dtype=数据类型)x1=tf.constant([1,2,3],dtype=tf.float64)print(x1)x2=tf.cast(x1,dtype=tf.int32)print("x2=",x2)运行结果:2.计算张量维度上元素的最小值tf.reduce_min(张量名)print("min=",tf.reduce_min(x
- TensorFlow学习笔记--(1)张量的随机生成
Postlude
TensorFlowtensorflow学习笔记
张量的生成如何判断一个张量的维数:看张量的中括号有几层012:零维数列[246]:一维向量[[123][456]]:二维数组两行三列第一行数据为123第二行数据为456以此类推n维张量有n层中括号tf.zeros(%指定一个张量的维数%)生成一个全0的张量tf.ones(%指定一个张量的维数%)生成一个全1的张量tf.fill(%指定一个张量的维数%,%Value%)生成一个全为Value的张量随
- TypeError: Input 'b' of 'MatMul' Op has type float32 that does not match type float64 of argument 'a
闪闪发亮的小星星
python机器学习
显示,TypeError:Input‘b’of‘MatMul’Ophastypefloat32thatdoesnotmatchtypefloat64ofargument'a,这是由于两个相乘矩阵类型不匹配,调试一下发现x矩阵为tf.float64,W矩阵为tf.float32,改类型用tf.cast()函数修改前:a=tf.nn.sigmoid(tf.matmul(XX,w1)+b1)y=tf.n
- TensorFlow常见方法
bbbbiu
pythontensorflow深度学习
TensorFlow文章目录TensorFlow一、tf.keras.layers.Dense()二、tf.keras.layers.BatchNormalization()三、tf.keras.layers.ReLU()四、tf.zeros()五、tf.Variable()六、tf.keras.Sequential()七、tf.keras.layers.Dropout()八、tf.matmul(
- PyTorch:torch.clamp()用法详解
地球被支点撬走啦
Pytorchpytorch
函数定义:torch.clamp(input,min,max,out=None)作用:限幅。将input的值限制在[min,max]之间,并返回结果。out(Tensor,optional)–输出张量,一般用不到该参数。对out参数的理解:很多torch函数有out参数,这主要是因为torch没有tf.cast()这类的类型转换函数,也少有dtype参数指定输出类型,所以需要事先建立一个输出Ten
- 张量-类型转换函数
艺术就是CtrlC
常见知识点tensorflow
代码示例如下:importtensorflow.compat.v1astftf.disable_v2_behavior()a=tf.constant(6)b=tf.constant([1,2,3])a1=tf.to_float(a,name='ToFloat')b1=tf.cast(b,dtype=tf.float32)withtf.Session()assession:print(session
- Python学习
MS0619
Python
Python学习tf.placeholder()class与def的区别类的实例RNN的输入reshape()与shape()tf.cast()python中坐标轴科学计数法自定义RNN中的loss函数tf.placeholder()1.为输入数据分配必要的内存,神经网络构建graph时在模型中的占位。如:X=tf.placeholder(“float”,[None,n_input])2.预分配内
- tensorflow-chp06
rongyongfeikai2
机器学习tensorflow
#coding:utf-8importtensorflowastfdefpre_process(x,y):x=tf.cast(x,tf.float32)/255.x=tf.reshape(x,[-1,28*28])y=tf.cast(y,tf.int32)y=tf.one_hot(y,depth=10)returnx,ydefload_dataset():(x_train,y_train),(x_
- 【tensorflow 大马哈鱼】tf.get_variable()和tf.Variable()的区别
飞翔的大马哈鱼
tensorflow语法
1.tf.Variable()W=tf.Variable(,name=)''''''W=tf.Variable(tf.zeros([2,1]))W=tf.Variable(tf.random_uniform([1,2],-1.0,1.0))W=tf.Variable([2,3],name='count')#常量[2,3],不是形状用于生成一个初始值为initial-value的变量。必须指定初始化
- tensorflow2 基础知识及练习搭建网络
李涛AT北京
创建tensortf.constant()tf.Variable()tf.zeros()/tf.zeros_like()tf.ones()/tf.fill()查看tensor位置tensor.device查看维度数目tensor.ndim查看形状tensor.shape查看数据类型tensor.dtype查看形状和类型tf.rank(tensor)判断是否为tensortf.is_tensor(t
- tensorflow学习笔记(一):基础知识
张沐之_
张量张量是tensorflow中的基本数据结构#全零张量zero_tsr=tf.zeros([row_dim,col_dim])#全1张量ones_tsr=tf.ones([row_dim,col_dim])#填充张量filled_tsr=tf.fill([row_dim,col_dim],42)#常量constant_tsr1=tf.constant([1,2,3])constant_tsr2=
- 笔记-tensorflow计算accuracy等
科技瞭望台
importtensorflowastfdeftf_confusion_metrics(predict,real):predictions=tf.argmax(predict,1)actuals=tf.argmax(real,1)ones_like_actuals=tf.ones_like(actuals)#维度和actuals一样的全1的张量zeros_like_actuals=tf.zeros
- python常用函数详解
和风细动帘帷暖
pythonnumpy深度学习
1、tf.cast()或者K.cast()是执行tensorflow中的张量数据类型转换,比如读入的图片是int8类型的,一定要在训练的时候把图片的数据格式转换为float32.cast(x,dtype,name=None)第一个参数x:待转换的数据(张量)第二个参数dtype:目标数据类型第三个参数name:可选参数,定义操作的名称2、np.arange()函数返回一个有终点和起点的固定步长的排
- 学习Tensorflow之基本操作
_DiMinisH
Pythontensorflow学习python
学习Tensorflow之基本操作Tensorflow基本操作1.创建张量(1)创建标量(2)创建向量(3)创建矩阵(4)shape属性(5)判别张量类型(6)列表和ndarray转张量2.创建特殊张量(1)tf.ones与tf.ones_like(2)tf.zeros与tf.zeros_like(3)tf.fill(3)tf.random.normal(4)tf.random.uniform3.
- 关于expand_dims()那点事
进击的小绵羊
机器学习深度学习pythontensorflow
常规用途:向单个元素添加外部“批处理”维度。对齐轴以进行广播。向标量张量添加内部向量长度轴。实例:如果您有一个形状为“[height,width,channels]”的图像:(注:channels为通道个数)image=tf.zeros([10,10,3])(注:在深度学习中,轴,指的就是张量的层级,一般通过参数axis/dim来设定。)>>>tf.expand_dims(image,axis=1
- ResNet18代码实现
Reacher2019
tensorflow深度学习python
importtensorflowastffromtensorflowimportkerasfromtensorflow.kerasimportlayers,Sequential,Model,datasets,optimizers#自定义的预处理函数defpreprocess(x,y):#调用此函数时会自动传入x,y对象,shape为[b,28,28],[b]#标准化到0-1x=2*tf.cast(
- Tensorflow ValueError: No variables to optimize.
深度探寻者
报错分析及解决人工智能python深度学习
一、环境:Tensorflow==1.14二、报错描述:ValueError:Novariablestooptimize.三、原因分析:tensorflow是以计算图的形式的机器学习框架,没有可优化的参数,代表您没有定义相关的学习参数。四、解决问题:比如:w=tf.zeros([748,10])b=tf.zeros([10])应该改为:w=tf.Variable(tf.zeros([748,10]
- Transformer中self-attention实现
&永恒的星河&
深度学习transformer深度学习tensorflow
"""tf版的多头注意力实现仅用来理解下Transformer的实现,不实际生产使用下面代码"""importtensorflowastfdefscaled_dot_product_attention(q,k,v):"""缩放点积注意力"""#QK点积matmul_qk=tf.matmul(q,k,transpose_b=True)#缩放dk=tf.cast(tf.shape(k)[-1],tf.
- 【动手学深度学习】线性回归从零实现
往阳光走
深度学习线性回归python
动手学深度学习线性回归从零实现生成数据集tf.zeros()tf.random.normaltf.reshape()tf.matmul()读取数据range()random.shuffle()tf.constantyield()初始化模型参数定义模型定义损失函数定义优化算法训练tf.GradientTape()训练结果和误差线性回归从零实现生成数据集生成数据集(带有噪声的线性模型)w=[2,-3.
- 【keras bug】Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ref(
ninetyfour
bug修复大数据
/media/cfs/wangxin436/TCN/future-guide-model/dissales.py:161call*loss=tf.add(tf.cast(tf.multiply(tf.cast(weights,l1.dtype),loss_st),'float64'),/usr/local/anaconda3/lib/python3.6/site-packages/tensorfl
- Tensorflow中的fft与rfft(一维数据为例)
Ben出没冇注意
纯记录tensorflow深度学习机器学习
tf.signal.ffttf.signal.fft(input,name=None)根据最里面的维度计算一维离散傅里叶变换(DFT)参数Input:complex64和complex128类型的张量(Tensor)name:操作的名字(可选)返回与Input相同类型的一个Tensor.使用方法:a=tf.ones([4])a_complex=tf.complex(a,tf.zeros(a.sha
- tensorflow2 保存模型
Ranbo桑
人工智能的日常pythontensorflow
__author__='LXY'importnumpyasnpimporttensorflowastffromtensorflow.kerasimportdatasets,layers,optimizers,Sequential,metricstf.random.set_seed(1)#数据预处理defpreprocess(x,y):#转换x,y的数据类型为张量x=tf.cast(x,dtype=
- 动手学深度学习学习笔记tf2.0版(第三课:深度学习基础之线性回归)
Zero_to_zero1234
start=time.time()c=tf.Variable(tf.zeros(1000,))foriinrange(1000):c[i].assign(a[i]+b[i])time()-start#输出0.31618547439575195向量相加的另一种方法是,将这两个向量直接做矢量加法。start=time()c.assign(a+b)time()-start#输出0.0小结:和大多数深度学
- 《动手学深度学习》-E2-2
m0_37773168
tensor学习笔记tensorflow深度学习python
1.创建TensorFlow一、x1=tf.constant(range(12))x2=tf.constant([1,2,3],[1,2,3])x3=tf.reshape(x1,(3,4))x4=tf.zeros((2,3,4))x5=tf.ones((2,3,4))二、有些情况下,我们需要随机生成tensor中每个元素的值。下面我们创建一个形状为(3,4)的tensor。它的每个元素都随机采样于
- 深度学习(6)TensorFlow基础操作二: 创建Tensor
炎武丶航
深度学习深度学习tensorflow
深度学习(6)TensorFlow基础操作二:创建Tensor一.创建方式1.FromNumpy,List2.zeros,ones(1)tf.zeros()(2)tf.zeros_like()(3)tf.ones()与tf.ones_like()3.Fill4.Normal(正态分布)6.RandomPermutation(随机打散)二.典型应用1.Scalar标量在神经网络中的呈现方式([])2
- 《动手学深度学习》tensorflow2.0版 第三章笔记
「已注销」
神经网络与深度学习tensorflow深度学习机器学习python神经网络
《动手学深度学习》tensorflow2.0版第三章笔记线性回归训练图像分类数据集(Fashion-MNIST)训练误差(trainingerror)和泛化误差(generalizationerror)。Tensorflow2函数接口说明GradientTapereduce_sum()tf.cast()tf.concat()tf.Variable()广播机制tf.gather(params,ind
- 深度学习理论向应用的过渡课程【北京大学_TensorFlow2.0笔记】学习笔记(二)——常用函数,加载鸢尾花数据集Iris
m0_58586235
北京大学TensorFlow学习机器学习深度学习
1.4、1.5常用函数tf.cast(张量名,dtype=数据类型)——强制tensor转换为该数据类型tf.reduce_min(张量名)——计算张量维度上元素的最小值tf.reduce_max(张量名)——计算张量维度上元素的最大值axis:在二维张量或数组中,控制操作轴(操作方向)axis=0跨行操作,沿经度方向,同一列↓axis=1跨列操作,沿纬度方向,同一行→不指定则所有元素参与运算tf
- Tensorflow:张量(Tensor)的创建及其基础操作
Sun_Sherry
Tensorflowtensorflow深度学习
Tensorflow版本:V2.8.0 Tensorflow中所有的运算操作都是基于张量进行的。Tensorflow中的张量Tensor是具有统一类型的多维数组。这篇博文主要介绍张量的创建及基础操作。1.张量的创建1.1tf.constant()方法 tf.constant()是一种常用的张量创建方法。具体代码如下:这里有一点要注意,不同数值精度的张量不能直接进行计算,强制转化(tf.cast
- Dom
周华华
JavaScripthtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml&q
- 【Spark九十六】RDD API之combineByKey
bit1129
spark
1. combineByKey函数的运行机制
RDD提供了很多针对元素类型为(K,V)的API,这些API封装在PairRDDFunctions类中,通过Scala隐式转换使用。这些API实现上是借助于combineByKey实现的。combineByKey函数本身也是RDD开放给Spark开发人员使用的API之一
首先看一下combineByKey的方法说明:
- msyql设置密码报错:ERROR 1372 (HY000): 解决方法详解
daizj
mysql设置密码
MySql给用户设置权限同时指定访问密码时,会提示如下错误:
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number;
问题原因:你输入的密码是明文。不允许这么输入。
解决办法:用select password('你想输入的密码');查询出你的密码对应的字符串,
然后
- 路漫漫其修远兮 吾将上下而求索
周凡杨
学习 思索
王国维在他的《人间词话》中曾经概括了为学的三种境界古今之成大事业、大学问者,罔不经过三种之境界。“昨夜西风凋碧树。独上高楼,望尽天涯路。”此第一境界也。“衣带渐宽终不悔,为伊消得人憔悴。”此第二境界也。“众里寻他千百度,蓦然回首,那人却在灯火阑珊处。”此第三境界也。学习技术,这也是你必须经历的三种境界。第一层境界是说,学习的路是漫漫的,你必须做好充分的思想准备,如果半途而废还不如不要开始。这里,注
- Hadoop(二)对话单的操作
朱辉辉33
hadoop
Debug:
1、
A = LOAD '/user/hue/task.txt' USING PigStorage(' ')
AS (col1,col2,col3);
DUMP A;
//输出结果前几行示例:
(>ggsnPDPRecord(21),,)
(-->recordType(0),,)
(-->networkInitiation(1),,)
- web报表工具FineReport常用函数的用法总结(日期和时间函数)
老A不折腾
finereport报表工具web开发
web报表工具FineReport常用函数的用法总结(日期和时间函数)
说明:凡函数中以日期作为参数因子的,其中日期的形式都必须是yy/mm/dd。而且必须用英文环境下双引号(" ")引用。
DATE
DATE(year,month,day):返回一个表示某一特定日期的系列数。
Year:代表年,可为一到四位数。
Month:代表月份。
- c++ 宏定义中的##操作符
墙头上一根草
C++
#与##在宏定义中的--宏展开 #include <stdio.h> #define f(a,b) a##b #define g(a) #a #define h(a) g(a) int main() { &nbs
- 分析Spring源代码之,DI的实现
aijuans
springDI现源代码
(转)
分析Spring源代码之,DI的实现
2012/1/3 by tony
接着上次的讲,以下这个sample
[java]
view plain
copy
print
- for循环的进化
alxw4616
JavaScript
// for循环的进化
// 菜鸟
for (var i = 0; i < Things.length ; i++) {
// Things[i]
}
// 老鸟
for (var i = 0, len = Things.length; i < len; i++) {
// Things[i]
}
// 大师
for (var i = Things.le
- 网络编程Socket和ServerSocket简单的使用
百合不是茶
网络编程基础IP地址端口
网络编程;TCP/IP协议
网络:实现计算机之间的信息共享,数据资源的交换
协议:数据交换需要遵守的一种协议,按照约定的数据格式等写出去
端口:用于计算机之间的通信
每运行一个程序,系统会分配一个编号给该程序,作为和外界交换数据的唯一标识
0~65535
查看被使用的
- JDK1.5 生产消费者
bijian1013
javathread生产消费者java多线程
ArrayBlockingQueue:
一个由数组支持的有界阻塞队列。此队列按 FIFO(先进先出)原则对元素进行排序。队列的头部 是在队列中存在时间最长的元素。队列的尾部 是在队列中存在时间最短的元素。新元素插入到队列的尾部,队列检索操作则是从队列头部开始获得元素。
ArrayBlockingQueue的常用方法:
- JAVA版身份证获取性别、出生日期及年龄
bijian1013
java性别出生日期年龄
工作中需要根据身份证获取性别、出生日期及年龄,且要还要支持15位长度的身份证号码,网上搜索了一下,经过测试好像多少存在点问题,干脆自已写一个。
CertificateNo.java
package com.bijian.study;
import java.util.Calendar;
import
- 【Java范型六】范型与枚举
bit1129
java
首先,枚举类型的定义不能带有类型参数,所以,不能把枚举类型定义为范型枚举类,例如下面的枚举类定义是有编译错的
public enum EnumGenerics<T> { //编译错,提示枚举不能带有范型参数
OK, ERROR;
public <T> T get(T type) {
return null;
- 【Nginx五】Nginx常用日志格式含义
bit1129
nginx
1. log_format
1.1 log_format指令用于指定日志的格式,格式:
log_format name(格式名称) type(格式样式)
1.2 如下是一个常用的Nginx日志格式:
log_format main '[$time_local]|$request_time|$status|$body_bytes
- Lua 语言 15 分钟快速入门
ronin47
lua 基础
-
-
单行注释
-
-
[[
[多行注释]
-
-
]]
-
-
-
-
-
-
-
-
-
-
-
1.
变量 & 控制流
-
-
-
-
-
-
-
-
-
-
num
=
23
-
-
数字都是双精度
str
=
'aspythonstring'
- java-35.求一个矩阵中最大的二维矩阵 ( 元素和最大 )
bylijinnan
java
the idea is from:
http://blog.csdn.net/zhanxinhang/article/details/6731134
public class MaxSubMatrix {
/**see http://blog.csdn.net/zhanxinhang/article/details/6731134
* Q35
求一个矩阵中最大的二维
- mongoDB文档型数据库特点
开窍的石头
mongoDB文档型数据库特点
MongoDD: 文档型数据库存储的是Bson文档-->json的二进制
特点:内部是执行引擎是js解释器,把文档转成Bson结构,在查询时转换成js对象。
mongoDB传统型数据库对比
传统类型数据库:结构化数据,定好了表结构后每一个内容符合表结构的。也就是说每一行每一列的数据都是一样的
文档型数据库:不用定好数据结构,
- [毕业季节]欢迎广大毕业生加入JAVA程序员的行列
comsci
java
一年一度的毕业季来临了。。。。。。。。
正在投简历的学弟学妹们。。。如果觉得学校推荐的单位和公司不适合自己的兴趣和专业,可以考虑来我们软件行业,做一名职业程序员。。。
软件行业的开发工具中,对初学者最友好的就是JAVA语言了,网络上不仅仅有大量的
- PHP操作Excel – PHPExcel 基本用法详解
cuiyadll
PHPExcel
导出excel属性设置//Include classrequire_once('Classes/PHPExcel.php');require_once('Classes/PHPExcel/Writer/Excel2007.php');$objPHPExcel = new PHPExcel();//Set properties 设置文件属性$objPHPExcel->getProperties
- IBM Webshpere MQ Client User Issue (MCAUSER)
darrenzhu
IBMjmsuserMQMCAUSER
IBM MQ JMS Client去连接远端MQ Server的时候,需要提供User和Password吗?
答案是根据情况而定,取决于所定义的Channel里面的属性Message channel agent user identifier (MCAUSER)的设置。
http://stackoverflow.com/questions/20209429/how-mca-user-i
- 网线的接法
dcj3sjt126com
一、PC连HUB (直连线)A端:(标准568B):白橙,橙,白绿,蓝,白蓝,绿,白棕,棕。 B端:(标准568B):白橙,橙,白绿,蓝,白蓝,绿,白棕,棕。 二、PC连PC (交叉线)A端:(568A): 白绿,绿,白橙,蓝,白蓝,橙,白棕,棕; B端:(标准568B):白橙,橙,白绿,蓝,白蓝,绿,白棕,棕。 三、HUB连HUB&nb
- Vimium插件让键盘党像操作Vim一样操作Chrome
dcj3sjt126com
chromevim
什么是键盘党?
键盘党是指尽可能将所有电脑操作用键盘来完成,而不去动鼠标的人。鼠标应该说是新手们的最爱,很直观,指哪点哪,很听话!不过常常使用电脑的人,如果一直使用鼠标的话,手会发酸,因为操作鼠标的时候,手臂不是在一个自然的状态,臂肌会处于绷紧状态。而使用键盘则双手是放松状态,只有手指在动。而且尽量少的从鼠标移动到键盘来回操作,也省不少事。
在chrome里安装 vimium 插件
- MongoDB查询(2)——数组查询[六]
eksliang
mongodbMongoDB查询数组
MongoDB查询数组
转载请出自出处:http://eksliang.iteye.com/blog/2177292 一、概述
MongoDB查询数组与查询标量值是一样的,例如,有一个水果列表,如下所示:
> db.food.find()
{ "_id" : "001", "fruits" : [ "苹
- cordova读写文件(1)
gundumw100
JavaScriptCordova
使用cordova可以很方便的在手机sdcard中读写文件。
首先需要安装cordova插件:file
命令为:
cordova plugin add org.apache.cordova.file
然后就可以读写文件了,这里我先是写入一个文件,具体的JS代码为:
var datas=null;//datas need write
var directory=&
- HTML5 FormData 进行文件jquery ajax 上传 到又拍云
ileson
jqueryAjaxhtml5FormData
html5 新东西:FormData 可以提交二进制数据。
页面test.html
<!DOCTYPE>
<html>
<head>
<title> formdata file jquery ajax upload</title>
</head>
<body>
<
- swift appearanceWhenContainedIn:(version1.2 xcode6.4)
啸笑天
version
swift1.2中没有oc中对应的方法:
+ (instancetype)appearanceWhenContainedIn:(Class <UIAppearanceContainer>)ContainerClass, ... NS_REQUIRES_NIL_TERMINATION;
解决方法:
在swift项目中新建oc类如下:
#import &
- java实现SMTP邮件服务器
macroli
java编程
电子邮件传递可以由多种协议来实现。目前,在Internet 网上最流行的三种电子邮件协议是SMTP、POP3 和 IMAP,下面分别简单介绍。
◆ SMTP 协议
简单邮件传输协议(Simple Mail Transfer Protocol,SMTP)是一个运行在TCP/IP之上的协议,用它发送和接收电子邮件。SMTP 服务器在默认端口25上监听。SMTP客户使用一组简单的、基于文本的
- mongodb group by having where 查询sql
qiaolevip
每天进步一点点学习永无止境mongo纵观千象
SELECT cust_id,
SUM(price) as total
FROM orders
WHERE status = 'A'
GROUP BY cust_id
HAVING total > 250
db.orders.aggregate( [
{ $match: { status: 'A' } },
{
$group: {
- Struts2 Pojo(六)
Luob.
POJOstrust2
注意:附件中有完整案例
1.采用POJO对象的方法进行赋值和传值
2.web配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee&q
- struts2步骤
wuai
struts
1、添加jar包
2、在web.xml中配置过滤器
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.st