自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 问答 (1)
  • 收藏
  • 关注

原创 概率校准

概率校准分类器输出的概率,通过校准可以达到更好的效果,常用于CTR和风控领域。概率校准简介模型校准-知乎校准评估-reliability diagram、Logarithmic Loss、Brier scorereliability diagram根据模型的输出将样本分成10个桶,即预测为0至0.1的样本归为一个桶,预测为0.1至0.2的样本归为一个桶等等,以这10个桶作为横坐标;计算每个桶内的正样本占比作为纵坐标,以此绘制的曲线reliability diagram可用于评估。relia

2020-07-12 11:17:55 547

原创 算法课10-dynamic programming III

String similarity如何衡量两个字符串的相似度?引入edit distance的概念 δ+αp,q\delta + \alpha_{p,q}δ+αp,q​ gap+mismatch 即,填充一个空格或者把pq对应位置的字母换成一致,最终使得两个字符串达到一致需要最小化这个距离Hirschberg算法可将空间压缩到θ(m+n)\theta(m+n)θ(m+n)单汇最短路径...

2018-12-05 20:25:37 203

原创 算法课9-dynamic programming II

背包问题串讲背包问题没有办法用贪心法得到最优解,都是通过动态规划来实现最优解。只有gold dust模型可以用贪心法得到最优解(性价比最高实现)。0-1背包问题【每个物品只可以拿一次】OPT(i, w) = max profit subset of items 1, …, i with weight limit w.它是伪多项式时间的解法,NPC问题解释看这里 0-1背包为什么有多...

2018-11-27 21:14:45 219

原创 算法课8-Dynamic Programming⭐️

动态规划是常考算法,将指数级的问题降到多项式级别。动态规划和分治法都是将问题划分成子问题进行求解,它们的区别主要是:分治法的子问题无重叠动态规划的子问题有重叠,并且重叠的个数是指数级别的动态规划和贪心法的相同之处是原问题包含子问题的最优解,而它们的区别在于:贪心法只看局部最优,最终达到全局最优对于动态规划局部最优不一定是全局最优1. Weighted interval ...

2018-11-18 10:54:16 342

原创 算法课7-Divide and Conquer

分治的思想,最经典的两个例子首先是排序的两个例子一个是快排 一个是归并排序【请看到这里的你,去复习一下排序算法】【这里填充快排和归并排序代码】...

2018-11-09 09:40:41 510

原创 算法课6-并查集Union Find

为了提高查找速度,三种方法:Link by sizeLink by rank(height)Path Compression并查集的典型应用:Percolation总时间限制: 1000ms 内存限制: 32768kB描述定义一个N行N列的矩阵,矩阵中的每个元素是个方格,每个方格有两种可能的状态:开通的或关闭的。初始时,所有方格都是关闭的。输入数据的每一步会指...

2018-11-01 20:25:59 640

原创 算法课5-贪心算法(贪心在图中的应用)

1. dijkstra算法总体思路是使用一个距离数组来存储到源点的最小距离,每次找到距离数组中最小的那个点对应的距离和点,遍历这个点的邻接点,如果用这个点做跳板,距离更小的话,更新邻接点对应的距离数组。int * dijkstra(int s, ALGraph & graph){ for(int i=0;i<graph.vexNum;i++){ visi...

2018-10-30 14:30:29 2102

原创 算法课4-图

表示方法分为邻接矩阵和邻接表 推荐邻接表BFS DFS是基础以下基于邻接表BFS 和 DFS转自https://blog.csdn.net/LaoJiu_/article/details/50389860BFS用队列 DFS用递归或栈#include <iostream>#include <iostream>#include &amp

2018-10-28 15:41:59 201

原创 算法课3-堆和优先队列

堆的性质堆是一个完全二叉树(最后一层的节点都在左边)一般都用数组来表示堆,i结点的父结点下标就为(i – 1) / 2。它的左右子结点下标分别为2 * i + 1和2 * i + 2建堆 O(N) 合并两个堆的时间复杂度和建堆相同把元素插入堆和把某元素删除,时间复杂度O(logn)每次插入都是将先将新数据放在数组最后,由于从这个新数据的父结点到根结点必然为一个有序的序列,将新数据与其...

2018-10-14 11:14:38 151

原创 算法课2-算法课第一次作业总结

A:单词翻转总时间限制: 1000ms 内存限制: 65536kB描述:输入一个句子(一行),将句子中的每一个单词翻转后输出。输入:只有一行,为一个字符串,不超过500个字符。单词之间以空格隔开。输出:翻转每一个单词后的字符串,单词之间的空格需与原文一致。样例输入hello world样例输出olleh dlrow这道题算是首次用c++在oj上刷题,一开始调用了r...

2018-09-23 15:39:43 1773

原创 算法课1-oj输入输出那点事

第一种,简单输入 #include<iostream> using namespace std; int a,b; cin>>a>>b;

2018-09-23 11:42:25 200

原创 LeetCode Combination Sum系列

Combination Sum系列 第一题是基础,给定一个数组和一个target,求有多少种组合可以加成target。运用回溯法,注意,每次add进结果里的数组需要newclass Solution { public List<List<Integer>> combinationSum(int[] candidates, int target) { ...

2018-06-08 10:26:57 211

转载 Java使用multimap数据结构

我们希望得到键可以重复的map数据结构,这样在查询特定键时可以返回多个值,类似数据库的查询。Google Guava提供了一种优雅的数据结构Multimap可以实现一个键对应到多个值的效果。 创建:Multimap<String,Object> myMultimap = ArrayListMultimap.create();插入值: // Adding some key/value

2017-10-28 11:16:03 17380 1

转载 LeetCode 496. Next Greater Element I

You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of num

2017-09-22 15:35:40 155

转载 LeetCode 栈和队列的互换

225. Implement Stack using Queues栈是先进后出,队列是先进先出,要使用队列实现栈,应该在每次添加元素的时候,将队列整个颠倒,使得删除元素时满足栈的结构。class MyStack { private Queue<Integer>q; /** Initialize your data structure here. */ public MySta

2017-09-07 10:45:53 329

转载 LeetCode 67. Add Binary

题目要求如下 Given two binary strings, return their sum (also a binary string). For example, a = “11” b = “1” Return “100”.一开始想的是转化成十进制一加,再转化回来就行,写了这个class Solution { public String addBinary(Stri

2017-09-05 20:48:35 267

转载 LeetCode 205. Isomorphic Strings

题目要求如下 Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be rep

2017-08-28 15:06:29 158

转载 Leetcode DP198.House Robber&53. Maximum Subarray

198. House Robber题目要求如下 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

2017-08-22 16:57:33 235

转载 LeetCode 643. Maximum Average Subarray I 滑动窗口

题目要求如下 Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value. Example

2017-08-22 11:11:12 208

转载 LeetCode 458.Poor Pigs

这一题感觉更像是数学题 题目要求如下 There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 m

2017-08-21 10:09:22 240

转载 LeetCode(九)231. Power of Two&405. Convert a Number to Hexadecimal

231.Power of Two题目要求判断一个数是否是2的乘方。 可以使用循环求解,也可以用位运算如下public class Solution { public boolean isPowerOfTwo(int n) { return n>0 && ((n & (n-1)) == 0); }}使用如下代码可以求解一个数的二进制中1的个数 int ans = 0

2017-08-18 17:20:41 182

转载 LeetCode(八)415. Add Strings

题目要求如下 Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100. Both num1 and num2 cont

2017-08-18 16:39:31 173

转载 LeetCode(七)HashSet 202. Happy Number

202. Happy Number题目要求如下 Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the nu

2017-08-18 16:32:43 209

转载 LeetCode(六) DP 70.Climbing Stairs&552. Student Attendance Record II

70.Climbing Stairs题目要求如下 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?

2017-08-18 16:18:35 217

转载 LeetCode(五)387. First Unique Character in a String&409. Longest Palindrome

387. First Unique Character in a String题目要求如下 Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1. Examples: s = “leetcode”

2017-08-13 12:37:58 185

转载 LeetCode(四)链表206. Reverse Linked List&2. Add Two Numbers

206. Reverse Linked List翻转一个链表 解法如下/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class

2017-08-13 11:43:39 160

转载 LeetCode(三)HashMap169. Majority Element&350. Intersection of Two Arrays II

169. Majority Element题目要求如下 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non

2017-08-13 11:29:47 184

转载 LeetCode(二)563. Binary Tree Tilt&404.Sum of Left Leaves&108.Convert Sorted Array to BST

Binary Tree Tilt题目要求如下 Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values an

2017-08-11 17:31:42 167

转载 LeetCode(一)--461.Hamming Distance&476.Number Complement 位运算

Hamming Distance 题目要求如下 The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hammi

2017-08-11 17:02:25 200

原创 coursera-使用python访问网络数据-密歇根大学

课程总体比较简单,是python for everyone的系列课程之一,零基础的朋友也好上手。 课程简单随记笔记在此记录一下。 week2 正则表达式 ‘^From’ 以’From’为开头 ‘.’匹配任意字符 ‘.*’任意字符任意次数 \S 非空格字符 + 表示一次或者多次 eg.\S+ 至少一个非空格字符 re.search()返回是否匹配正则表达式 re.findall()

2016-12-02 11:39:43 2325

原创 Coursera Algorithms 学习之路(一)

软件渣渣真的要发愤图强啊,保完研的日子不能荒废,把学得渣一样的数据结构和算法重新捡起来,加油啦~ 第一周的编程作业,在这里记录一下,Percolationpublic class Percolation { int[][]id; int n; public Percolation(int n) { // create n-by-n grid, w

2016-09-30 10:23:30 1734

原创 安卓使用SOAP调用WebService

String namespace = “http://Service.com/“; String url=”http://”+webserviceIp+”:8080/CareServer/CareServer?wsdl”SoapObject soapObject = new SoapObject(namespace, “uploadTalk”); soapObject.addP

2016-06-21 16:39:29 615

转载 安卓e.printStackTrace()打印方法

找了很多地方,都说这句错误信息在Logcat中打印,可是根本找不到啊。终于找到一个方法,好用!知道错误是什么真是太幸福了~Log.i("debug",Log.getStackTraceString(e));

2016-06-21 16:30:45 3140

原创 安卓传递自定义类型

//发送 Intent i = new Intent(); i.setClass(LoginActivity.this, MainActivity.class); Bundle bundle=new Bundle(); bundle.putSerializable(“tc

2016-06-19 15:17:16 230

原创 C#总秒数与datetime相互转换

DateTime d = DateTime.ParseExact(c00.ToString(), "yyyyMMdd HH:mm:ss", null);//根据时间字符串输出datetime对象 TimeSpan ts1 = new TimeSpan(d.Ticks); double c11 = ts1.TotalSeconds;//转换为总秒数//

2016-06-06 19:38:37 5498

空空如也

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

TA关注的人

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