- 博客(11)
- 资源 (4)
- 收藏
- 关注
原创 mysqldump命令把数据库中某个表导出为.sql文件
示例数据库名:mydb示例数据表名:mytable示例密码:pwd输入如下命令并回车:mysqldump --databases mydb -uroot -p --tables mytable > mytable.sql然后输入密码pwd并回车:这样就生成了所需要的sql文件...
2020-07-31 12:54:58 692
原创 【解决方案】scrapy报错KeyError: ‘Spider not found‘
检查命令行里的spider名字和class中一致,且spiders目录也有__init__.py,然而还是报错,于是经过一番探究...发现该spider里有个name变量...应该是和内置的name变量冲突了 改个名即可
2020-07-25 16:02:14 5560
原创 【Python刷题Leetcode】哈希表与字符串(最长回文串、词语模式、同字符词、重复的DNA序列、滑动窗口和子串)
class Solution: def longestPalindrome(self, s: str) -> int: counter = {} for each in s: if each not in counter: counter[each]=1 else: counter[each]+=1 res = ...
2020-07-23 21:05:15 177
原创 Scrapy中出现UnicodeDecodeError:检查scrapy.cfg是否含中文
检查了一番 原来是scrapy.cfg写了个中文删掉中文后发现就好了...
2020-07-22 21:57:07 226
原创 【Python刷题Leetcode】二分查找与二叉排序树
class Solution: def searchInsert(self, nums: List[int], target: int) -> int: begin=0 end=len(nums)-1 while begin<=end: mid = (begin+end)//2 if nums[mid]==target: return mid ...
2020-07-19 14:55:47 332
原创 【Python刷题Leetcode】二叉树和图(路径之和、最近公共祖先、二叉树转链表、课程安排)
【二叉树的深度优先遍历(深搜)】class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: paths = [] # 存储结果 cur_path = [] # 栈 暂存路径 cur_sum = 0 # 暂存总和 def pre_order(node, cur_sum): .
2020-07-17 15:23:11 189
原创 【Python刷题Leetcode】递归/回溯/分治(求子集、组合求和、括号生成、逆序数)
非递归解法:class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: n = len(nums) output = [[]] for num in nums: output += [curr + [num] for curr in output] print(output) ...
2020-07-15 23:36:01 859
原创 【Python刷题Leetcode】贪心算法(分糖果、摇摆序列、移除K个数、跳跃游戏、射击气球、加油次数)
排序,遍历糖果(糖果id++),若满足当前孩子,孩子id++。最终孩子id就是满足的孩子数。class Solution: def findContentChildren(self, g: List[int], s: List[int]) -> int: # 每个孩子需求/饼干大小从小到大排序 child = sorted(g) food = sorted(s) child_idx = 0 food_i..
2020-07-14 10:51:54 722
原创 【Python刷题Leetcode】栈/队列/堆(栈队相互实现、min函数的栈、合法出栈序列、计算器、第k大元素、找中位数)
from collections import dequeclass MyStack: def __init__(self): """ Initialize your data structure here. """ self.q = deque() # 队列实现栈:队列允许右进左出:q.append() q.popleft() len(q) # 需要改为栈的 左进左出 def p...
2020-07-12 22:21:57 386
原创 【Python刷题Leetcode】链表(反转、找交点、快慢指针找环、分割列表、深拷贝、合并链表)
# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: # 非递归方法 def reverseList1(self, head: ListNode) -> ListNode: new_head = None # 新链表头节点初始为None 放在老链表最前面 ...
2020-07-11 21:16:18 441
原创 【NLP复习】逻辑回归的原理、推导和常见问题
逻辑回归:假设数据服从伯努利分布(0-1分布),通过极大似然函数的方法,运用梯度下降来求解参数,来达到将数据二分类的目的。(用回归的方式求概率p,根据p和阈值求二分类结果,所以叫他回归但实际是分类)预测函数、损失函数、梯度下降推导:常见问题:为什么用sigmoid函数? 如果选择单位阶跃函数的话,它是不连续的不可微。而如果选择sigmoid函数,它是连续的 sigmoid能够将z转化为一个接近0或1的值。 LR的假设是什么? 一是:假设数据服从伯努利分布 二是:假设模
2020-07-08 13:06:13 544
文本摘要 CNN/DailyMail 原始数据集
2022-04-15
[PDF]Neural Network Methods in Natural Language Processing 基于深度学习的自然语言处理英文原版
2018-11-23
希拉里 克林顿 邮件 自然语言处理 Hillary Clinton's Emails
2018-07-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人