自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 剑指offer-用两个栈实现队列以及用两个队列实现一个栈

两个栈实现队列class Solution: def __init__(self): self.stack1 = [] self.stack2 = [] def push(self, node): self.stack1.append(node) def pop(self): if self.stack2:...

2019-10-10 22:08:00 129

原创 Leetcode215. 数组中的第K个最大元素

执行用时 : 76 ms内存消耗 : 12.1 MBclass Solution(object): def findKthLargest(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ nums =...

2019-05-07 10:13:54 144

原创 169.众数

class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ ret, cnt = 0, 0 for num in nums: if c...

2019-05-06 22:34:02 156

原创 LeetCode1035. 不相交的线

class Solution(object):def maxUncrossedLines(self, A, B):“”":type A: List[int]:type B: List[int]:rtype: int“”"# lenA, lenB = len(A), len(B)# dp = [[0 for i in range(lenB + 1)] for j in range(l...

2019-05-03 22:59:30 854

原创 LeetCode-weekly-contest-134. Moving Stones Until Consecutive

题目内容原题链接:https://leetcode-cn.com/contest/weekly-contest-134/problems/moving-stones-until-consecutive/题目内容三枚石子放置在数轴上,位置分别为 a,b,c。每一回合,我们假设这三枚石子当前分别位于位置 x, y, z 且 x < y < z。从位置 x 或者是位置 z 拿起一...

2019-05-02 22:41:42 120

原创 Leetcode第133周赛1030. 距离顺序排列矩阵单元格

题目内容给出 R 行 C 列的矩阵,其中的单元格的整数坐标为 (r, c),满足 0 <= r < R 且 0 <= c < C。另外,我们在该矩阵中给出了一个坐标为 (r0, c0) 的单元格。返回矩阵中的所有单元格的坐标,并按到 (r0, c0) 的距离从最小到最大的顺序排,其中,两单元格(r1, c1) 和 (r2, c2) 之间的距离是曼哈顿距离,|r1 ...

2019-04-24 10:59:36 164

原创 Leetcode第133周赛1031. 两个非重叠子数组的最大和

题目内容给出非负整数数组 A ,返回两个非重叠(连续)子数组中元素的最大和,子数组的长度分别为 L 和 M。(这里需要澄清的是,长为 L 的子数组可以出现在长为 M 的子数组之前或之后。)从形式上看,返回最大的 V,而 V = (A[i] + A[i+1] + ... + A[i+L-1]) + (A[j] + A[j+1] + ... + A[j+M-1]) 并满足下列条件之一: ...

2019-04-24 10:53:01 348

原创 Leetcode第133周赛1029. 两地调度

1029. 两地调度题目内容用户通过次数 299用户尝试次数 494通过次数 305提交次数 985题目难度 Easy公司计划面试 2N 人。第 i 人飞往 A 市的费用为 costs[i][0],飞往 B 市的费用为 costs[i][1]。返回将每个人都飞到某座城市的最低费用,要求每个城市都有 N 人抵达。 示例:输入:[[10,20],[30,200],[400...

2019-04-21 21:58:09 277

原创 Leetcode42.接雨水

class Solution {public:int trap(vector& heights) {vector left, right;int length = heights.size();// left[0]=heights[0];// right[length-1]=heights[length-1];int water=0;for(int i=1; i<le...

2019-04-19 14:11:06 125

原创 Leetcode27.Remove Element

27.Remove Element题目原题链接:https://leetcode.com/problems/remove-element/题目内容: Given an array nums and a value val, remove all instances of that value in-place and return the new length. ...

2019-04-17 14:11:06 106

原创 Leetcode015. 3sum

class Solution {public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> ret; sort(nums.begin(), nums.end()); for(in...

2019-04-16 21:03:53 110

原创 LeetCode2. Add Two Numbers

题目介绍原题链接:https://leetcode-cn.com/problems/add-two-numbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nod...

2019-04-12 21:57:24 114

原创 111. Minimum Depth of Binary Tree

题目描述Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path fromthe root node down to the nearest leaf node.Note: A leaf is a node with no chi...

2019-04-03 21:50:04 92

原创 剑指offer_跳台阶

题目描述一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。原题链接:https://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4?tpId=13&tqId=11161&tPage=1&rp=1&ru=/ta/coding-i...

2019-04-02 11:04:19 100

原创 LeetCode104. Maximum Depth of Binary Tree

题目原题链接https://leetcode.com/problems/maximum-depth-of-binary-tree/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node do...

2019-03-22 21:36:41 104

原创 Leetcode 102. Binary Tree Level Order Traversal

题目描述题目链接:https://leetcode-cn.com/problems/binary-tree-level-order-traversal/给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。例如:给定二叉树: [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7返回其层次遍历结果...

2019-03-22 21:33:41 118

原创 LeetCode 101.对称二叉树

class Solution {public:bool isMirror(TreeNode* p, TreeNode* q){if(!p &amp;&amp; !q)return true;else if(p &amp;&amp; !q || !p &amp;&amp; q)return false;else if(p-&gt;val == q-&gt;val){return i...

2019-03-18 12:56:03 88

原创 LeetCode 100. Same Tree

LeetCode 100. Same Tree题目描述原题链接:https://leetcode.com/problems/same-tree/description/Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered ...

2019-03-17 14:36:00 90

原创 LeetCode 96. Unique Binary Search Trees

96. Unique Binary Search Trees题目给定一个整数 n,求以 1 ... n 为节点组成的二叉搜索树有多少种?示例:输入: 3输出: 5解释:给定 n = 3, 一共有 5 种不同结构的二叉搜索树: 1 3 3 2 1 \ / / / \ \ 3 ...

2019-03-16 22:15:57 92

原创 XGBoost与Lightgbm

本文参考自https://cloud.tencent.com/developer/article/1389899https://cloud.tencent.com/developer/article/1052678https://cloud.tencent.com/developer/article/1052664XGBoost1、重要参数详解booster[default=gbtree...

2019-02-25 11:02:38 474

原创 数据挖掘问题记录

1、xgboost.core.XGBoostError: b"Invalid Parameter format for max_depth expect int but valueparams = {‘n_estimators’ : 150, ‘min_child_weight’ : 3, ‘max_depth’:6} xgb_model = xgb.XGBClassifier(params...

2019-01-24 11:41:14 1174

原创 XGBoost安装问题 xgboost.libpath.XGBooetLibraryNotFound:Cannot find XGBoost Library in the candidate path

安装完XGBoost之后运行产生如下问题 xgboost.libpath.XGBooetLibraryNotFound:Cannot find XGBoost Library in the candidate path解决方案在http://ssl.picnet.com.au/xgboost/中下载对应版本的动态链接库xgboost.xll,将其放到报错中提示的位置,在我电脑上这个位置是C...

2018-12-07 21:33:14 3280 3

原创 二月寒假计划

1、深度学习书籍a. python深度学习b.机器学习实战基于Sklearn和TensorFlowc.花书论文a.RNNb.Resnetc.Cliquenet实践keras实现常用网络结构跑心音数据,心音数据精度达到93%。视频a.吴恩达机器学习与深度学习视频b.林轩田机器学习基石3、机器学习博客总结及代码实践a.支持向量机b.随机森林c.决策树d.聚类书籍...

2018-12-06 22:30:18 139

原创 Argparse

Argparse是Python内置的一个用于选项与参数解析的模块,在程序中定义好需要的参数。常用于参数较多的情况。add_argument()方法ArgumentParser.add_argument(name or flags…[, action][, nargs][, const][, default][, type][, choices][, required][, help][, me...

2018-12-04 21:44:40 759

原创 100-Days-Of-ML-Code(一)sklearn数据预处理

第一天主要学习了使用sklearn进行数据预处理。1、缺失值填补Imputerimport numpy as npfrom sklearn import Imputerimputer = Imputer(missing_values='NaN', strategy='mean', verbose=0)X1 = imputer.fit([[1,2], [np.nan, 3]])X1...

2018-11-21 11:07:44 131

原创 深度学习资源

SE模块https://mp.weixin.qq.com/s?__biz=MzA3MzI4MjgzMw==&amp;amp;amp;mid=2650729486&amp;amp;amp;idx=3&amp;amp;amp;sn=5b2b6f0e7443ecf0971d4743d5480bb6&amp;amp;amp;chksm=871b2870b06ca166bc18413060898886db534c2b5ade468f832d3f85d5d75549f1...

2018-11-15 09:56:34 157

原创 每日学习记录

Tensorflow1、使用GPUconfig = tf.ConfigProto(device_count={‘gpu’: 0})config.gpu_options.allow_growth = Trueself.sess = tf.Session(config=config)2、保存模型3、导入模型Python1、*args, **kwargs*args 是用来发送一个非键值...

2018-11-12 23:47:19 209

原创 Tensorflow GPU版本安装

安装教程,亲测有效!链接:https://blog.csdn.net/weixin_39290638/article/details/80045236特别注意在安装tensorflow如图所示步骤,会出现找不到清华仓库镜像的问题,解决方法是 conda config --remove channels default ,先将默认镜像删除,在进行 conda create -n tensorf...

2018-11-04 19:49:28 191

原创 udacity 深度学习课程实战项目之预测共享单车的使用情况

题目知识点1、pd.get_dummiespandas.get_dummies(data, prefix=None, prefix_sep=’_’, dummy_na=False, columns=None, sparse=False, drop_first=False)参数data : array-like, Series, or DataFrame输入的数据prefix : s...

2018-10-23 22:32:15 1158

原创 线性回归总结

线性回归处理的是回归问题,也就是通过过去的数据去预测未来的结果,而且形成的函数始终是连续的。 线性回归模型 h(x)=θx+b(目标就是要求得较好的θ和b的值,使得代价函数越小越好) 找最优解的两种方法 寻找最优解有两种方法,一个是Gradient decent,另一个是Normal equation。最优解可以使代价函数取到最小值。 1、Gradi...

2018-09-12 11:10:18 667

原创 SLIC

Assiment 超像素处理图片,显示每个区域的相邻区域,并有图片的直观结果做验证。 代码: from __future__ import divisionimport collections as collimport numpy as npfrom scipy import ndimage as ndifrom skimage.util import img_a...

2018-09-09 20:46:50 1545 2

原创 Numpy学习记录

1、创建array a = np.array([1,2,3], dtype=float32) a = np.zeros((3, 4)) #生成3行4列的元素全为0的矩阵 a = np.ones((3, 4)) a = np.arrange(10, 20, 2) a = np.arrange(12).reshape(3, 4) a = np.linespace(1, 10, 20)...

2018-09-08 23:11:43 189

原创 感知机总结

感知机是一个二分类的线性分类模型。 感知机函数:f(x)=sign(wx+b)。 sign函数:当x&amp;gt;=0时值为+1,当x&amp;lt;0时值为-1。 感知机学习过程:设定w,b初始值为0,某个点坐标代入y*(wx+b)值小于等于0时称该点为误分类点,更新w,b值,w:=w+r*y*x,b:=b+r*y(r为学习率)。迭代直到不存在误分类点为止。 感知机学习算法的原始...

2018-09-05 21:45:18 270

原创 leetcode题目解答记录

69.x的平方根class Solution: def mySqrt(self, x): &amp;amp;amp;amp;quot;&amp;amp;amp;amp;quot;&amp;amp;amp;amp;quot; :type x: int :rtype: int &amp;amp;amp;amp;quot;&amp;amp;amp;amp;quot;&a

2018-08-24 10:14:49 415

原创 Tensorflow 函数记录

1、tf.name_scope(转载自:https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/5-12-scope/) 在 Tensorflow 当中有两种途径生成变量 variable, 一种是 tf.get_variable(), 另一种是 tf.Variable(). 如果在 tf.name_scope() 的...

2018-08-24 09:31:07 117

原创 LINUX服务器input_data无法读取mnist数据集

在服务器上跑mnist识别的程序,发现始终无法通过input_data读取数据集,仔细检查了存放的路径没有发现问题,最后发现我把数据集下载了解压缩压缩之后再上传到服务器,而input_data能够读取的是gz格式的数据集。...

2018-08-04 21:52:38 529 1

原创 配置服务器tensorflow环境

问题:使用conda命令提示没找到这个命令解决方案1、添加Anacond环境变量 vi ~/.bashrc 添加 :保存后 执行 source ~/.bashrc 2.tensorflow 环境克隆 conda create -n 【你自己的环境名字】 –clone tf1.50 已经存在的环境 tf1.50是root账户下建立的初始环境,请不要使用此环境,自己需...

2018-08-01 21:52:59 1294

原创 21个项目玩转Tensorflow之mnist数字识别

欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I...

2018-07-30 10:09:39 674

空空如也

空空如也

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

TA关注的人

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