自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 ID3、C4.5、CART、random forest、bagging、boosting、Adaboost、GBDT、xgboost模型总结

以下内容来自本人知乎专栏发布内容,转载请标注出处!知乎链接:https://zhuanlan.zhihu.com/p/34534004一、决策树首先,决策树是一个有监督的分类模型,其本质是选择一个能带来最大信息增益的特征值进行树的分割,直到到达结束条件或者叶子结点纯度到达一定阈值。下图是决策树的一个简单例子按照分割指标和分割方法,决策树的经典模型可以分为ID3、C4.5以及CART...

2020-02-21 15:04:13 302

原创 leetcode-top100-liked-questions-medium

1、Target SumYou are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol.Find...

2018-07-11 20:39:38 585

原创 leetcode-top 100 liked questions-python

1、Find All Anagrams in a StringGiven a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both stri...

2018-06-24 16:27:07 701

原创 leetcode-easy-python

1、Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 2...

2018-06-24 12:25:40 249

原创 leetcode-sql

1、Second Highest SalaryWrite a SQL query to get the second highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+...

2018-06-24 11:58:26 174

原创 top interviews questions-leetcode-python附代码详解

1、Convert Sorted Array to Binary Search Tree(将升序的数组转换成平衡二叉树):2、Happy Number3、Min Stack-实现返回最小元素的栈4、Plus One数组的值转成数值,加1之后,输出值的列表形式5、判断一个数是否是3的幂6、 Pascal's Triangle打印出帕斯卡三角形7、Pascal's Triangle II得到帕斯卡三角...

2018-04-17 23:55:03 568

原创 dynamic-programming-python-leetcode(动态规划)

1、Min Cost Climbing StairsOn 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 c...

2018-03-26 17:29:52 1194

原创 Array-leetcode-python

1、Array Partition IGiven an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to...

2018-03-26 14:13:43 191

原创 leetcode-python-binary search

1、Two Sum II - Input array is sortedGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should ...

2018-03-25 19:50:43 192

原创 leetcode-Tree-python

1、Same TreeGiven two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.E...

2018-03-23 16:11:08 173

原创 Minimum Index Sum of Two Lists-python

解答:运用python的dict快速创建hash索引class Solution(object):    def findRestaurant(self, list1, list2):        pos1={v:pos for pos,v in enumerate(list1)} # 对list构建字典索引,键是数组的值,值是数组的下标        length=len(list2)+len...

2018-03-22 14:03:20 160

原创 Intersection of Two Linked Lists-python

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 ↘ c...

2018-03-22 13:36:29 126

原创 Linked List Cycle II-python

解答:要想得知链表环开始的地方,需要先判断链表是否有环(参考本博客Linked List Cycle),当判断为有环时,记住当前所指的位置,将其中一个指针重置到链表头部,两个指针开始以相同步长1往后遍历链表,当再次相遇时,即环开始的地方class Solution:    # @param head, a ListNode    # @return a list node    def detec...

2018-03-22 13:08:36 188

原创 Linked List Cycle(判断链表是否有环)-python

Given a linked list, determine if it has a cycle in it.解答:定义两个指针分别从链表头部开始,一个指针每次走一步,另一个指针每次走两步,若两个指针所指的值相等,则说明有环,否则没环;要注意指针所指之处是否为空class Solution(object):    def hasCycle(self, head):        """      ...

2018-03-22 12:55:43 822

原创 Remove Duplicates from Sorted List-python

Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.解答:需要注意链...

2018-03-22 12:35:34 103

原创 Merge Two Sorted Lists-python

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->1...

2018-03-22 11:04:14 392

原创 Palindrome Number(判断数字是不是回文数)-python

Determine whether an integer is a palindrome. Do this without extra space.解答 : 有的答案是把数转成字符串,逆序之后与原来的相等,那么就是回文数;本人提供的答案是,设置两个指针,分别指向头部和尾部,对比对应的数是否相等,直到指针指向中间位置,结束。class Solution(object):    def isPalin...

2018-03-22 10:54:57 443

原创 Reverse Integer-python

Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with an envi...

2018-03-22 10:38:28 366

原创 leetcode-Two sum(最佳思路以及python代码实现)

1、Two sumGiven nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].答案:使用hashtable,建立数组值和下标的键值对,在python中相当于使用dict来存储,dict的key是数组的值,数组的下标是dict的value。class Solution(o...

2018-03-22 10:17:57 2223 2

原创 ID3、C4.5、CART、随机森林、bagging、boosting、GBDT、xgboost算法总结

参考本人在知乎上面分享的总结~https://zhuanlan.zhihu.com/p/34534004, 希望可以帮助到大家

2018-03-22 09:33:21 832

空空如也

空空如也

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

TA关注的人

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