自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 pyspark之DataFrame写hive表方式

文章目录spark 语句静态分区动态分区spark SQL 处理方法例子最近用spark写hive的过程中,遇到了一些问题,故此把这一块整理整理,供使用参考spark 语句hive中静态分区和动态分区的区别在于,静态分区是指定分区值,动态区分是根据值进行自动添加到对应的分区。后者在效率上会比较低,需要启动与分区数相同的数量的reducer静态分区df.write.mode('overwr...

2020-01-03 15:30:59 9460 1

原创 Linux安装fbprophet

直接执行pip3 install fbprophet 在升级matplotlib的时候会报错,错误信息如下在升级matplotlib的时候有问题正确姿势先升级\安装matplotlib,而且不能用pip3 install matplotlib ,参考网上无数的解决方案,都无效,正确的安装指令如下python -mpip install matplotlib安装fbprophe...

2019-08-26 16:22:53 1776

原创 jupyter插件和主题

插件配置关闭正在运行的jupyter安装插件包pip install jupyter_contrib_nbextensions配置nbextensionjupyter contrib nbextension install --user --skip-running-check启动jupyter风格设置安装jupyterthemespip install --upgrad...

2019-08-15 16:59:55 884

原创 Jupyter常驻之密码登录

安装jupyterpip3 install jupyter notebook生成配置文件jupyter-notebook --generate-config生成密钥jupyter notebook password输入要设置的密码启动服务 nohup jupyter notebook --allow-root > jupyter.log 2>&am...

2019-08-14 15:03:41 217

原创 月结——Transformer之上的一些故事

文章目录Transformer模型解释BertERNIEStyle TransformerTransformer传统seq2seq的问题一般用CNN或者RNN的方式来处理,将seq编码为一个固定长度的向量然后再进行解码。因为固定长度向量所能表征的信息有限,因此对于长序列来说,前面的信息容易被埋没,即具有长程依赖问题,同时这种方式是顺序执行,使得没有办法进行并行计算。于是,google的大神们,...

2019-06-30 20:17:46 180

原创 概率图系列之隐马尔可夫模型(HMM)

概率图模型概率图模型是一类用图来表达变量相关关系的概率模型。常见的是用一个节点表示一个或一组随机变量,节点之间的边表示变量之间的概率相关关系,如下图:概率图根据边的性质,可以划分为两种:有向图无环图——有向图模型或贝叶斯网无向图——无向图图或马尔可夫网隐马尔可夫模型(HMM)性质:结构最简单的动态贝叶斯网——有向无环图描述:由一个隐藏的马尔可夫链生成不可观测的状态随机序列,再由...

2019-06-21 21:46:42 1409

原创 《Style Transformer: Unpaired Text Style Transfer without Disentangled Latent Representation》浅析

文章目录摘要发展模型问题描述步骤模型训练机制代码解析效果摘要传统的文本样式转换通常是通过分解隐空间中的内容和风格的方式。这种方式存在如下两种问题:很难从句子的语义中完全剥离样式信息基于编解码器模式的RNN难以保持长程依赖,导致内容保真度有损本文提出一种不用隐空间假设,基于注意力机制的模型——Style Transformer,能够较好的保持文本内容,同时很好的转化文本风格发展文本...

2019-06-19 14:01:19 2333

原创 557. Reverse Words in a String III

题目链接:https://leetcode.com/problems/reverse-words-in-a-string-iii/代码class Solution: def reverseWords(self, s: str) -> str: n=len(s) start=0 res='' i=0 w...

2019-06-17 10:48:38 117

原创 344. Reverse String

题目链接:https://leetcode.com/problems/reverse-string/代码class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. ...

2019-06-17 10:45:52 197

原创 292. Nim Game

题目链接:https://leetcode.com/problems/nim-game/代码class Solution: def canWinNim(self, n: int) -> bool: return n%4!=0

2019-06-17 10:19:11 116

原创 238. Product of Array Except Self

题目链接:https://leetcode.com/problems/product-of-array-except-self/代码class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: n=len(nums) dp1,dp2=[1]*n,[1]*n ...

2019-06-17 10:02:24 129

原创 237. Delete Node in a Linked List

题目链接:https://leetcode.com/problems/delete-node-in-a-linked-list/代码# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Non...

2019-06-17 09:30:51 87

原创 236. Lowest Common Ancestor of a Binary Tree

题目链接:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/代码# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self...

2019-06-17 09:23:50 116

原创 235. Lowest Common Ancestor of a Binary Search Tree

题目链接:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/代码# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# ...

2019-06-17 09:21:15 92

原创 231. Power of Two

题目链接:https://leetcode.com/problems/power-of-two/代码class Solution: def isPowerOfTwo(self, n: int) -> bool: if n==0:return False return not n&(n-1)解题思路2n2^n2n在二进制上只有一位是1,...

2019-06-16 23:14:28 115

原创 230. Kth Smallest Element in a BST

题目链接:https://leetcode.com/problems/kth-smallest-element-in-a-bst/代码# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = No...

2019-06-16 22:57:34 79

原创 217. Contains Duplicate

题目链接:https://leetcode.com/problems/contains-duplicate/submissions/代码class Solution: def containsDuplicate(self, nums: List[int]) -> bool: if not nums:return False frequen=set(...

2019-06-16 00:54:13 149

原创 215. Kth Largest Element in an Array

题目链接:https://leetcode.com/problems/kth-largest-element-in-an-array/submissions/代码class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: """ :type nums: List...

2019-06-16 00:47:23 138

原创 206. Reverse Linked List

题目链接:https://leetcode.com/problems/reverse-linked-list/代码# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = None...

2019-06-15 22:31:40 81

原创 169. Majority Element

题目链接:https://leetcode.com/problems/majority-element/代码class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ f...

2019-06-15 22:21:42 91

原创 160. Intersection of Two Linked Lists

题目链接:https://leetcode.com/problems/intersection-of-two-linked-lists/submissions/代码# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x#...

2019-06-15 22:12:45 111

原创 155. Min Stack

题目链接:https://leetcode.com/problems/min-stack/submissions/代码class MinStack: def __init__(self): """ initialize your data structure here. """ self.stack_list=[] ...

2019-06-15 21:48:16 86

原创 148. Sort List

题目链接:https://leetcode.com/problems/sort-list/归并排序法代码# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solu...

2019-06-14 10:54:05 204

原创 146. LRU Cache

题目链接:https://leetcode.com/problems/lru-cache/代码class LRUCache(object): def __init__(self, capacity): """ :type capacity: int """ self.capacity=capacity s...

2019-06-14 09:59:30 98

原创 《BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding》浅析

开头强推一篇,写得很赞:https://cloud.tencent.com/developer/article/1389555

2019-06-12 18:04:16 177

原创 136. Single Number

题目链接:https://leetcode.com/problems/single-number/代码class Solution: def singleNumber(self, nums: List[int]) -> int: for i in range(1,len(nums)): nums[0]^=nums[i] re...

2019-06-11 11:26:25 76

原创 124. Binary Tree Maximum Path Sum

题目链接:https://leetcode.com/problems/binary-tree-maximum-path-sum/代码# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = Non...

2019-06-11 11:15:14 116

原创 122. Best Time to Buy and Sell Stock II

题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/代码class Solution: def maxProfit(self, prices) -> int: if len(prices)<1: return 0 profit=0 min_...

2019-06-10 00:12:54 82

原创 121. Best Time to Buy and Sell Stock

题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/代码class Solution: def maxProfit(self, prices: List[int]) -> int: n,res = len(prices),0 dp=[0]*n for ...

2019-06-09 23:44:02 92

原创 104. Maximum Depth of Binary Tree

题目链接:https://leetcode.com/problems/maximum-depth-of-binary-tree/代码# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = Non...

2019-06-09 23:37:52 96

原创 89. Gray Code

题目链接:https://leetcode.com/problems/gray-code/submissions/代码class Solution: def grayCode(self, n: int) -> List[int]: return [ i^i>>1 for i in range(1<<n)]思路详解格雷编码:在一组数的编...

2019-06-09 23:29:15 93

原创 《ERNIE: Enhanced Language Representation with Informative Entities》浅析

文章目录摘要发展模型解析微调应用效果(待复现)展望GELU摘要现有的大规模预料训练的语言表征模型(如BERT)能够很好的从文本中获取丰富的语义模型,进行微调后能够提升各种NLP任务。然而这些模型几乎不考虑知识图谱,知识图谱能够为语言理解提供丰富的结构化信息。本文通过外部知识增强语言表达,同时利用大规模语料库和知识图谱,充分利用词汇、句法和知识信息。发展预训练语言表征模型包括基于特征的和基于...

2019-06-06 16:18:06 1783 1

原创 88. Merge Sorted Array

题目链接:https://leetcode.com/problems/merge-sorted-array/代码class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything...

2019-06-05 16:37:44 80

原创 78. Subsets

题目链接:https://leetcode.com/problems/subsets/此题思路盗用别人的深度优先遍历代码class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: res=[] self.dfs(nums,0,[],res) ret...

2019-06-05 16:12:37 89

原创 70. Climbing Stairs

题目链接:https://leetcode.com/problems/climbing-stairs/submissions/动态规划法代码class Solution: def climbStairs(self, n: int) -> int: #入参判断 if not n or n ==1 : return 1 #初始赋值 ...

2019-06-03 09:49:34 114

原创 62. Unique Paths

题目链接:https://leetcode.com/problems/unique-paths/自己的思路代码class Solution: def uniquePaths(self, m, n) -> int: while not m or not n : return 0 dp = [[0 for col in range(n)] for r...

2019-06-03 00:30:37 88

原创 61. Rotate List

题目链接:https://leetcode.com/problems/rotate-list/自己的思路代码# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass So...

2019-06-02 11:23:22 87

原创 59. Spiral Matrix II

题目链接:https://leetcode.com/problems/spiral-matrix-ii/代码class Solution: def generateMatrix(self, n): res, lo = [[n*n]], n*n while lo > 1: lo, hi = lo - len(res), l...

2019-06-01 10:45:59 102

原创 54. Spiral Matrix

题目链接:https://leetcode.com/problems/spiral-matrix/代码class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: return matrix and [*matrix.pop(0)] + self.spiralOrder([...

2019-05-29 23:25:15 159

原创 53. Maximum Subarray

题目链接:https://leetcode.com/problems/maximum-subarray/代码class Solution: def maxSubArray(self, nums: List[int]) -> int: # 为空的时候,不懂得为啥这么设置 if not nums: return -2147483648 ...

2019-05-29 22:57:12 93

空空如也

空空如也

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

TA关注的人

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