自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 python 二维列表转化为一维列表

nums = [[1,2], [3,4]]a = sum(nums,[])   一句话 

2018-12-10 22:34:02 1797 4

原创 softmax与多个逻辑谛斯回归的区别?

做图像分类的时候,我一般选择去掉VGG-16 ,Xception,inception_v3 最后几层全连接层,然后利用多个逻辑谛斯回归的原因在于此:1、使用softmax回归或者多个logistics回归解决多分类问题时:使用哪一个主要根据类别之间是否互斥。对于选择softmax分类器还是k个logistics分类器,取决于所有类别之间是否互斥。所有类别之间明显互斥用softmax;所有类...

2018-07-19 11:30:25 1472

转载 给定一个target,问:数组是否有两个元素的和为target;

转载:https://blog.csdn.net/u010515761/article/details/43451035题目:编写一个函数,输入为一个int型的数组numbers和一个int型变量target,找到这个数组中和为target的两个元素,输出其index。假设每组输入有且仅有一组输出示例:Input: numbers={6, 2, 15, 7,11}, target=9Output:...

2018-06-29 11:48:43 1366

转载 逻辑回归一些问题

转载自:http://www.cnblogs.com/ModifyRong/p/7739955.html1.对逻辑回归的进一步提问    逻辑回归虽然从形式上非常的简单,但是其内涵是非常的丰富。有很多问题是可以进行思考的逻辑回归的损失函数为什么要使用极大似然函数作为损失函数?损失函数一般有四种,平方损失函数,对数损失函数,HingeLoss0-1损失函数,绝对值损失函数。将极大似然函数取对数以后等...

2018-06-19 17:02:54 706

原创 判断一个数是否是质数---埃拉托斯特尼筛法

1、题目:Count the number of prime numbers less than a non-negative number, n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.2、解答:这道题给定一个非负数n,让我们求小于n的...

2018-06-15 10:18:05 387

原创 动态规划--两字字符串的编辑距离

1、题目Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 = "eat"Output: 231Explanation: Deleting "s" from "sea" adds th...

2018-06-06 11:37:46 168

原创 动态规划--unique paths 2

1、题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the...

2018-06-06 10:34:05 149

原创 动态规划----unique paths

1、题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the...

2018-06-06 09:43:25 142

原创 动态规划---计算等差数列的个数

1、题目:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmetic sequen...

2018-06-05 11:52:48 1449

原创 动态规划---回文子串

1、题目:Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consi...

2018-06-05 11:06:31 164

原创 动态规划--统计给定nun,从0~num每个数二进制表示时0的个数

1、题目:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5 yo...

2018-06-05 10:10:26 194

原创 动态规划---范围累加和查询

1、题目Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumR...

2018-06-05 09:19:28 162

原创 动态规划---房子抢劫最大利润

1、题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent ...

2018-06-05 09:01:23 431

原创 动态规划---最大和的子集

1、题目:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanati...

2018-06-05 08:46:52 522

原创 动态规划--爬楼梯

1、题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positiv...

2018-06-05 08:39:26 145

原创 动态规划---最好的一天买卖股票

1、题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock...

2018-06-05 08:27:43 531

原创 动态规划--最小代价爬楼梯

1、题目:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top ...

2018-06-05 08:19:23 843

原创 随机森林的特征重要性原理

1、随机森林得到的feature importance的原理?答:在随机森林中某个特征X的重要性的计算方法如下:1:对于随机森林中的每一颗决策树,使用相应的OOB(袋外数据)数据来计算它的袋外数据误差,记为errOOB1.2:  随机地对袋外数据OOB所有样本的特征X加入噪声干扰(就可以随机的改变样本在特征X处的值),再次计算它的袋外数据误差,记为errOOB2.3:假设随机森林中有Ntree棵树...

2018-05-25 17:04:39 17219 2

原创 集成学习

1、目前的集成学习方法大致可分为两大类;                1)个体学习器间存在强依赖关系、必须串形生成的序列化方法。                        常见的有:  Boosting家族的:     AdaBoost 、GBDT、XGBoost                2)个体学习器间不存在强依赖关系、可同时生成的并行化方法。                    ...

2018-05-25 16:51:00 506

原创 决策树理论--Decision tree

决策树面试被提及的题目:1、决策树的原理:        从根结点开始,对实例的某一特征进行测试,根据测试的结果,将实例分配到其子结点;每一个子结点对应着该特征的一个取值。如此递归地对实例进行测试并分配,直至达到叶结点。最后将实例分配到叶结点的类中。2、决策树的过程(步骤):        决策树学习通常包括3个步骤:特征选择、决策树的生成和树的剪枝。3、决策树的终止条件:        节点中的...

2018-05-24 19:14:27 749

原创 二叉树---反转二叉树,也就镜像二叉树

1、题目:Invert a binary tree.Example:Input: 4 / \ 2 7 / \ / \1 3 6 9Output: 4 / \ 7 2 / \ / \9 6 3 12、解答:无3、C++代码class Solution {public: TreeNode* inver...

2018-05-14 11:52:27 170

原创 二叉树4--求二叉树的深度

1、题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no childr...

2018-05-14 11:13:40 398

原创 二叉树3---求每层结点的均值

1、题目:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 11]Explanati...

2018-05-14 10:49:47 486

原创 二叉树2---修剪二叉树线索树

1、题目:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree, so t...

2018-05-14 10:02:36 192

原创 二叉树--合并两颗二叉树

1、题目:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary t...

2018-05-14 09:27:40 3046

原创 链表22--删除倒数第n个元素

1、题目:Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, t...

2018-05-11 11:52:48 114

原创 链表21 -- 分割链表

1、题目:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each o...

2018-05-11 11:17:24 154

原创 链表20---反转链表中指定的位置

1、题目:Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3->2->5-&g...

2018-05-11 10:49:45 366

原创 链表19---循环链表,找到链表循环的起始位置

1、题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?2、解答: 先用两个指...

2018-05-11 09:54:20 634

原创 链表18--删除重复的元素包括自己

1、题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2->3->3->4->4->5Output: 1-&gt...

2018-05-10 12:23:04 109

原创 链表17---链表排序

1、题目:Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output: -1->0...

2018-05-10 11:50:49 113

原创 链表16--两个数相加

1、题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and ret...

2018-05-10 10:40:44 105

原创 链表15--重排链表

1、题目:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2-&gt...

2018-05-10 10:11:35 370

原创 链表14

1、题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which t...

2018-05-08 12:09:12 76

原创 链表13

1、题目:Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return the list as 2->1->4->3.Note:Your algorithm should use only con...

2018-05-08 11:31:47 96

原创 链表12

1、题目:奇偶问题Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do ...

2018-05-07 12:14:25 134

原创 链表11

1、题目 You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and ret...

2018-05-07 11:57:36 126

原创 链表10

1、题目:Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts".The length of each part should be as equal as possible: no two p...

2018-05-07 11:00:48 96

原创 链表9

1、题目:We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the values in the linked list.Return the number of connected component...

2018-05-07 10:08:19 80

原创 链表8

1、题目Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘ ...

2018-05-05 12:07:01 103

空空如也

空空如也

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

TA关注的人

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