自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(279)
  • 资源 (2)
  • 收藏
  • 关注

原创 最小覆盖子串例子解释

记录一个题:leetcode: 76. Minimum Window SubstringGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Input: S = “ADOBECODEBANC”, ...

2019-08-31 07:23:02 441

原创 DGL中的GAT

DGL自带的很多函数看GAT之前,先看看DGL库自带的一些函数,遵循消息传播范式,DGL自带了很多消息函数和传播函数,都在Builtin message passing functions中,总的来说,DGL由两个api组成消息传播:send(edges, message_func) :for computing the messages along the given edgesrecv(...

2019-07-25 16:58:00 2629 3

原创 RGCN:record:

这里的每一个实体的嵌入XiX_iXi​更新公式是把每一个关系rrr下的所有邻居节点的嵌入XjX_jXj​乘以该关系矩阵Θr\Theta_rΘr​的正则化拿出来全部求和,然后与该实体本身的嵌入XiX_iXi​相加:文章公式:变换公式:基分解:class RGCNConv(MessagePassing): in_channels (int): Size of eac...

2019-07-19 16:52:18 2153

转载 转发:ubuntu18.04安装GPU驱动

https://blog.csdn.net/qq_32408773/article/details/84112166https://medium.com/@zhanwenchen/install-cuda-10-1-and-cudnn-7-5-0-for-pytorch-on-ubuntu-18-04-lts-9b6124c44cc

2019-07-09 15:44:10 813

原创 Batch Training

gradient descentStochastic Gradient Descent, or SGD for short, is an optimization algorithm used to train machine learning algorithms;The job of the algorithm is to find a set of internal model para...

2019-05-08 16:26:14 461

原创 训练NN技巧

神经网络的训练依赖于问题和数据。Designing and training a network using backprop requires making many seemingly arbitrary choices such as the number and types of nodes, layers, learning rates, training and test sets...

2019-05-04 12:46:48 405

原创 重看《node2vec》

唠叨前提:俗话说欲速则不达,算了是我这脑力不行;不写出来总觉得记忆不是很有条理,啊,没办法。前几天电话面了阿里,问道一些玄学问题,都是训练神经网络相关的,感觉自己没回答好,追更到底,还是自己的思路不清晰造成的。然后回顾研究生这2年,对于培养自己的科研素养真的极少,因为几个原因:独自干自己的,不与外界接触;对于大脑好使的人自然不在话下,但是我这样的结果,看样子并不好,没人指路,自己兜圈;没...

2019-04-26 20:17:20 1029 1

原创 Alias sampling

参考:1.http://www.keithschwarz.com/darts-dice-coins/2.https://lips.cs.princeton.edu/the-alias-method-efficient-sampling-with-many-discrete-outcomes# Author:ZCclass Alias: def __init__(self, prol...

2019-04-23 22:11:30 581

原创 Transduction and Induction

Defination of Transduction and Inductiontransductive learning:In logic, statistical inference, and supervised learning, transduction or transductive inference is reasoning from observed, specific (t...

2019-04-21 20:26:25 516

原创 pytorch_geometric:Planetoid数据集合

torch.utils.data.DatasetDataset是数据集的抽象类,需要实现__getitem__ 和__len__:class Dataset(object): """An abstract class representing a Dataset. All other datasets should subclass it. All subclasses sh...

2019-04-20 16:17:32 5510

原创 DEEP GRAPH INFOMAX

ABSTRACT从摘要得出本文特点:Deep Graph Infomax (DGI)是无监督学习;用已有的GCNs来做:最大化邻近表示(patch representation)与对应的高阶图摘要(high-level summaries of graphs)之间的互信息(MI);与之前的GCNs的不同之处是:DGI目标函数与之前的随机游走目标函数不一样。到底怎么不一样继续。。。...

2019-04-17 10:30:05 5731 1

翻译 整流线型函数

Rectified Linear Unit (PReLU)ReLU:正的值会通过ReLU,所有的负值都设置为零。优点:ReLU的训练速度比Tanh快得多,因为它在1的时候没有饱和。LReLU :设置了一个参数,它用一个较低的斜率替换了[−∞,0][-∞,0][−∞,0]域中的零部分。优势:为什么使用LReLU :恒定的零梯度也会导致缓慢的学习,此外,其中一些神经元甚至可能不被...

2019-04-16 14:41:10 567

原创 pytorch_geometric:message passing networks网络

基类 message passing layers描述:分层聚合每一个节点与周围节点及关联边信息的通用函数。xi′=γΘ(xi,□j∈N(i) ϕΘ(xi,xj,ei,j)), \mathbf{x}_i^{\prime} = \gamma_{\mathbf{\Theta}} \left( \mathbf{x}_i, \square_{j \in \mathc...

2019-04-02 19:12:21 4918 8

原创 scipy.optimize.curve_fit 与 matplotlib.pyplot.hist 直方图和密度图

matplotlib.pyplot.hist( x, bins=10, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype=u'bar', align=u'mid', orientation=u'vertical', rwidth...

2019-03-25 19:23:00 838

原创 torch: Invalid index in scatter at c:\a\w\1\s\windows\pytorch\aten\src\th\gene 解决

文档了解:https://pytorch.org/docs/stable/tensors.html?highlight=scatter_#torch.Tensor.scatter_scatter_(dim, index, src) → TensorWrites all values from the tensor src into self at the indices specifi...

2019-03-23 10:34:36 4000 1

原创 《MolGAN: An implicit generative model for small molecular graphs》了解

MolGAN论文的代码

2019-03-23 09:27:57 2920 7

原创 Semi-Supervised 图卷积

简单的例子:https://towardsdatascience.com/how-to-do-deep-learning-on-graphs-with-graph-convolutional-networks-7d2250723780https://towardsdatascience.com/how-to-do-deep-learning-on-graphs-with-graph-conv...

2019-03-18 13:58:10 2487 20

原创 pytorch的一个快速介绍

参考来源于:Pytorch Tutorial – Chongruo Wu写的真的不错,在这里分享下:首先是torch的三个主要模块:Tensor、 Variable 、Module。Tensor 可以视为ndarray , 但是可以在GPU上做计算,比如下图中的cuda设置; Variable 是计算图上的一个节点,存储数据和梯度;Module含有神经网络的层,可用于存储可训练的网络参...

2019-03-14 16:43:14 248

原创 LeetCode:Recursion

1. diameterOfBinaryTreeclass TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = Noneclass Solution: def diameterOfBinaryTree(self, ...

2019-03-14 13:43:44 308

转载 defaultdict

defaultdict 接受不带参数的可调用函数:from collections import defaultdictwords = ['hello', 'world', 'nice', 'world']#使用lambda来定义简单的函数counter = defaultdict(lambda: 0) for kw in words: counter[kw] += 1def...

2019-03-07 17:45:02 214

转载 python对象都用一个字典来保存其命名空间 : __dict__

class C: def __init__(self): self.x = 1 self.y = 2 def regist(self, key, val): self.__dict__[key] = valc = C()print c.__dict__c.regist("z", 3)c.regist("func", lam...

2019-03-07 12:16:29 588

转载 转:使用rz上传压缩文件遇到的一些坑

注意:单独用rz会有两个问题:上传中断、上传文件变化(md5不同),解决办法是上传是用rz -be,并且去掉弹出的对话框中“Upload files as ASCII”前的勾选。-a, –ascii-b, –binary 用binary的方式上传下载,不解释字符为ascii-e, –escape强制escape 所有控制字符,比如Ctrl+x,DEL等rar,gif等文件文件采用-b 用bi...

2019-02-12 14:54:08 1860

原创 visio内部错误 3400

保存为svg然后去转成pdf:https://convertio.co/zh/svg-pdf/

2019-01-18 16:10:26 6618

原创 稀疏矩阵的cos相似度

每行是一个向量,计算之后对角线为1,其余为与其他向量的相似度:def csr_cosine_similarity(input_csr_matrix): similarity = input_csr_matrix * input_csr_matrix.T square_mag = similarity.diagonal() inv_square_mag = 1 / squa...

2019-01-10 12:04:34 2707 7

转载 Updating known_hosts is not supported in Windows yet 解决方案

使用ssh时,如果目标机器重装导致其ssh指纹发生了变化,在确认没有中间人攻击的情况下,可以使用【sshkey-gen -R 发生错误的IP】这条命令来重置对应IP的ssh指纹. 但是这一条命令在Windows的cmd或者powershell下没有作用并且会提示Updating known_hosts is not supported in Windows yet。这时只需要前往【系统盘:\用户\...

2019-01-04 13:11:33 755 1

原创 networkx:add_edge会把节点同时加入图

原始图没有节点1:现在添加边1-5:final_H.add_edge(1,5)再次输出final_H.nodes()查看:原来节点加入在最后面了,一开始我还奇怪。。。以后会继续记录类似情况...

2018-12-21 20:40:09 2639

转载 linux下python程序后台运行,并将打印信息保存文件

在跑比较时间比较长的程序,或者是打印信息比较多的程序时,一般都会后台运行程序,然后把打印信息保存在文件中,等程序运行结束后再检查输出日志。完成该功能可以用如下命令:nuhup python -u test.py > test.log 2>&1 &其中,最后一个“&”表示后台运行程序“nohup” 表示程序不被挂起“python”表示执行python代...

2018-12-09 09:51:16 400

原创 字典建立反字典的时候values()不能重复

te = {x:y for x,y in zip(range(4),[1,2,1,3])}te{0: 1, 1: 2, 2: 1, 3: 3}{v:x for v,x in zip(te.values(),te.keys())}{1: 2, 2: 1, 3: 3}

2018-12-08 09:56:57 260

转载 Ubuntu创建新用户并增加管理员权限

$是普通管员,#是系统管理员,在Ubuntu下,root用户默认是没有密码的,因此也就无法使用(据说是为了安全)。想用root的话,得给root用户设置一个密码:sudo passwd root然后登录时用户名输入root,再输入密码就行了。ubuntu建用户最好用adduser,虽然adduser和useradd是一样的在别的linux糸统下,但是我在ubuntu下用useradd时,并...

2018-12-08 08:55:58 1430

原创 多元高斯分布的KL散度

kl散度意义:In the context of machine learning, is often called the information gain achieved if Q is used instead of P.This reflects the asymmetry in Bayesian inference, which starts from a prior Q...

2018-12-05 16:03:49 2868

原创 tf.gather拼接

mu = np.random.rand(5,5)sigma = np.random.rand(5,5)index = [[0, 1],[1,2]]smu = sess.run(tf.gather(mu,index))ssigma = sess.run(tf.gather(sigma,index))print(smu)print(ssigma)print(ssigma.shape)...

2018-12-04 18:32:47 187

原创 scipy: eliminate_zeros()的

例子:import numpy as npfrom scipy.sparse import csr_matrixM = csr_matrix(np.ones([2, 2],dtype=np.int32))print(M)print(M.data.shape)for i in range(np.shape(M)[0]): for j in range(np.shape(M)[1]...

2018-11-03 10:46:33 3418

原创 scipy: 稀疏矩阵 indptr

例子:from scipy import sparsedata = np.array([1, 4, 5, 2, 3, 6])indices = np.array([0, 2, 2, 0, 1, 2])indptr = np.array([0, 2, 3, 6])mtx = sparse.csr_matrix((data, indices, indptr), shape=(3, 3))...

2018-11-03 10:26:22 825

原创 numpy:interp插值

numpy.interp作用:给定1维数据点上做插入。Parameters:x : 要估计坐标点的x坐标值。xp : x坐标值,must be increasing if argument period is not specified. Otherwise, xp is internally sorted after normalizing the periodic boundari...

2018-10-25 20:20:13 10844

原创 sklearn:auc、roc_curve、roc_auc_score

sklearn.metrics.auc作用:计算AUC(Area Under the Curve)metrics.roc_curve作用:计算 ROC(Receiver operating characteristic)注意: this implementation is restricted to the binary classification tasksklearn.metric...

2018-10-25 19:23:04 20473 1

原创 VAE|VGAN

https://juejin.im/post/598972735188256de4693951https://cloud.tencent.com/developer/article/1096650我们想要的是构建一个生成式模型,而非仅仅是“记忆”图像数据的模糊结构。除了像前面那样从已有图像中编码出潜在向量,我们还不知道如何创造这些向量,也就无法凭空生成任何图像。给编码网络增加一个约束,迫使它...

2018-10-24 17:44:11 1117

转载 python2和python3中的urllib

在Python3中包urllib2归入了urllib中,所以要导入urllib.request,并且要把urllib2替换成urllib.request# python2import urllib2url = 'http://www.jianshu.com/trending/weekly?page={}'headers = {'User-Agent': 'Mozilla/5.0 (Win...

2018-10-23 09:59:44 162

转载 tensorflow API:tf.map_fn

tf.map_fn( fn, elems, dtype=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)作用:map on the list of tensors unpacked from ...

2018-10-22 21:02:28 908

转载 转:为什么不去读顶级会议上的论文?适应于机器学习、计算机视觉和人工智能

看了版上很多贴子,发现很多版友都在问“热门研究方向”、“最新方法”等。有同学建议国内某教授的教材、或者CNKI、或者某些SCI期刊。每当看到这种问题,我都有点纳闷,为什么不去读顶级会议上的论文?我无意否认以上文献的价值,但是在机器学习、计算机视觉和人工智能领域,顶级会议才是王道。国内教材和CNKI上的基本是N年前老掉牙的东西。有人会质疑这些会议都只是EI。是的,这的确非常特殊:在许多其它领域...

2018-10-22 20:33:26 238

原创 tensorflow: session开始对前tensor做一些处理

tf.boolean_mask这个操作可以用于留下指定的元素,类似于numpy的操作。import numpy as nptensor = tf.range(4)mask = np.array([True, False, True, False])bool_mask = tf.boolean_mask(tensor, mask)print sess.run(bool_mask)[0 ...

2018-10-22 09:26:56 197

信息检索试卷

信息检索试题信息检索试题信息检索试题信息检索试题信息检索试题

2018-06-23

Learning NumPy Array

学习numpy的基础必看的书籍,比较好理解。学习numpy的基础必看的书籍,比较好理解。学习numpy的基础必看的书籍,比较好理解。

2018-05-16

空空如也

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

TA关注的人

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