07 2015 档案

【Power of Two】cpp
摘要:题目:Given an integer, write a function to determine if it is a power of two.代码:class Solution {public: bool isPowerOfTwo(int n) { if ( n>... 阅读全文

posted @ 2015-07-22 07:23 承续缘 阅读(281) 评论(0) 推荐(0) 编辑

【Binary Search Tree Iterator 】cpp
摘要:题目:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the n... 阅读全文

posted @ 2015-07-14 19:25 承续缘 阅读(201) 评论(0) 推荐(0) 编辑

【Binary Tree Right Side View 】cpp
摘要:题目:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exa... 阅读全文

posted @ 2015-07-14 18:39 承续缘 阅读(190) 评论(0) 推荐(0) 编辑

【Count Complete Tree Nodes】cpp
摘要:题目:Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, exc... 阅读全文

posted @ 2015-07-14 17:25 承续缘 阅读(314) 评论(0) 推荐(0) 编辑

【Kth Smallest Element in a BST 】cpp
摘要:题目:Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's t... 阅读全文

posted @ 2015-07-14 13:00 承续缘 阅读(198) 评论(0) 推荐(0) 编辑

【Invert Binary Tree】cpp
摘要:题目:Invert Binary TreeTotal Accepted:20346Total Submissions:57084My SubmissionsQuestionSolutionInvert a binary tree. 4 / \ 2 7 / \ / \1 ... 阅读全文

posted @ 2015-07-14 12:48 承续缘 阅读(221) 评论(0) 推荐(0) 编辑

【Lowest Common Ancestor of a Binary Search Tree】cpp
摘要:题目:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedi... 阅读全文

posted @ 2015-07-14 12:35 承续缘 阅读(219) 评论(0) 推荐(0) 编辑

【Lowest Common Ancestor of a Binary Tree】cpp
摘要:题目:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowe... 阅读全文

posted @ 2015-07-14 10:55 承续缘 阅读(250) 评论(0) 推荐(0) 编辑

【Support Vector Regression】林轩田机器学习技法
摘要:上节课讲了Kernel的技巧如何应用到Logistic Regression中。核心是L2 regularized的error形式的linear model是可以应用Kernel技巧的。这一节,继续沿用representer theorem,延伸到一般的regression问题。首先想到的就是rid... 阅读全文

posted @ 2015-07-13 16:40 承续缘 阅读(1908) 评论(0) 推荐(0) 编辑

【Balanced Binary Tree】cpp
摘要:题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the de... 阅读全文

posted @ 2015-07-12 14:17 承续缘 阅读(286) 评论(0) 推荐(0) 编辑

【Kernel Logistic Regression】林轩田机器学习技术
摘要:最近求职真慌,一方面要看机器学习,一方面还刷代码。还是静下心继续看看课程,因为觉得实在讲的太好了。能求啥样搬砖工作就随缘吧。这节课的核心就在如何把kernel trick到logistic regression上。首先把松弛变量的表达形式修改一下,把constrained的形式改成unconstra... 阅读全文

posted @ 2015-07-09 17:32 承续缘 阅读(1684) 评论(0) 推荐(0) 编辑

【作业一】林轩田机器学习技术
摘要:关注的是编程题目Q15~Q20这里需要借用libsvm的python包,需要一下几个处理步骤:(1)到libsvm官网(http://www.csie.ntu.edu.tw/~cjlin/libsvm/)下载.gz包,解压缩到一个目录(2)在解压的根目录make命令(3)再到解压缩根目录下的pyth... 阅读全文

posted @ 2015-07-07 22:38 承续缘 阅读(1579) 评论(2) 推荐(0) 编辑

【Soft-Margin Support Vector Machine】林轩田机器学习技术
摘要:Hard-Margin的约束太强了:要求必须把所有点都分开。这样就可能带来overfiiting,把noise也当成正确的样本点了。Hard-Margin有些“学习洁癖”,如何克服这种学习洁癖呢?沿用pocket算法的思想,修改一下优化目标函数的形式,补上一个错分点的惩罚项CΣ...。(1)C越大,... 阅读全文

posted @ 2015-07-05 17:16 承续缘 阅读(1242) 评论(0) 推荐(0) 编辑

【Kernal Support Vector Machine】林轩田机器学习技术
摘要:考虑dual SVM 问题:如果对原输入变量做了non-linear transform,那么在二次规划计算Q矩阵的时候,就面临着:先做转换,再做内积;如果转换后的项数很多(如100次多项式转换),那么耗费的时间就比较多。能否在计算Q矩阵这一步的时候,把transform+inner product... 阅读全文

posted @ 2015-07-05 10:16 承续缘 阅读(1037) 评论(0) 推荐(0) 编辑

【Dual Support Vector Machine】林轩田机器学习技法
摘要:这节课内容介绍了SVM的核心。首先,既然SVM都可以转化为二次规划问题了,为啥还有有Dual啥的呢?原因如下:如果x进行non-linear transform后,二次规划算法需要面对的是d`+1维度的N个变量,以及N个约束如果d`的维度超大,那么二次规划解起来的代价就太大了。因此,SVM的精髓就在... 阅读全文

posted @ 2015-07-03 22:33 承续缘 阅读(987) 评论(0) 推荐(0) 编辑

【Linear Support Vector Machine】林轩田机器学习技法
摘要:首先从介绍了Large_margin Separating Hyperplane的概念。(在linear separable的前提下)找到largest-margin的分界面,即最胖的那条分界线。下面开始一步步说怎么找到largest-margin separating hyperplane。接下来... 阅读全文

posted @ 2015-07-02 20:45 承续缘 阅读(1102) 评论(0) 推荐(0) 编辑

【作业4】林轩田机器学习基石
摘要:作业四的代码题目主要是基于ridge regression来做的,并加上了各种cross-validation的情况。由于ridge regression是有analytic solution,所以直接求逆矩阵就OK了,过程并不复杂。只有在做cross-validation的时候遇上了些问题。#en... 阅读全文

posted @ 2015-07-01 19:33 承续缘 阅读(967) 评论(0) 推荐(0) 编辑

导航