算法
Zoey29
Work hard, Have fun, Make history!
展开
-
八皇后问题(递归解法)
八皇后问题,即在一个8*8的棋盘上放8个皇后,使得这8个皇后无法互相攻击( 任意2个皇后不能处于同一行,同一列或是对角线上),输出所有可能的摆放情况。 Write an algorithm to print all ways of arranging eight queens on a chess board so that none of them share the same row, col原创 2017-06-06 10:57:08 · 1419 阅读 · 0 评论 -
如何得到一个较好的机器学习系统
牢记“It’s not who has the best algorithm that wins.It’s who has the most data.”要想得到高效的系统:首先,特征一定要选好;其次,模型复杂度要合适。这一点可以降低偏差(bias),即防止欠拟合。保证 J train(θ)比较小。最后,训练数据要充足。这一点可降低方差(variance),防止过拟合。保证J test...原创 2018-10-13 10:31:41 · 475 阅读 · 0 评论 -
统计学习三要素个人理解
模型模型就是所要学习的函数或分布,用以表征输出与输入之间的联系。策略按照什么准则(损失函数,风险函数,经验风险函数=>结构风险函数)选择最好的模型。算法最优化问题求解方法,如何使损失最小进而使模型最好。...原创 2018-10-12 15:31:23 · 690 阅读 · 0 评论 -
决策树学习基本算法
输入训练集D={(x1,y1),(x2,y2),…(xm,ym)};属性集A={a1,a2,…ad}.过程:函数TreeGenerate(D,A)生成结点node;if D中样本全属于同一类别C:将node标记为C类叶结点;递归返回;end ifif A=空集 或 D中样本在A上取值相同:将node标记为D中样本数(当前结点)最多的类(成为叶结点);递归返回;end if...原创 2018-09-27 14:16:23 · 3233 阅读 · 0 评论 -
【算法导论】两个n位的二进制整数相加问题
题目 考虑把两个n位二进制整数加起来的问题,这两个整数分别存储在两个n元数组A和B中。这两个整数的和应按二进制形式存储在一个(n+1)元数组C中。请给出该问题的形式化描述,并写出伪代码。找到的答案如下: Input: An array of booleans A=⟨a1,a2,…,an⟩, an array of booleans B=⟨b1,b2,…,bn⟩, each represen...原创 2018-04-11 10:06:34 · 3173 阅读 · 5 评论 -
round robin
Round-robin (RR) is one of the algorithms employed by process and network schedulers in computing. As the term is generally used, time slices (also known as time quanta) are assigned to each process i原创 2017-11-13 10:38:00 · 395 阅读 · 0 评论 -
Logit(log odds)
The logit function is the inverse of the sigmoidal “logistic” function or logistic transform used in mathematics, especially in statistics. When the function’s variable represents a probability p, the原创 2017-07-10 14:03:18 · 10341 阅读 · 0 评论 -
Round-robin
轮询算法: Round-robin (RR) is one of the algorithms employed by process and network schedulers in computing. As the term is generally used, time slices (also known as time quanta) are assigned to each pro原创 2017-07-06 13:15:50 · 1176 阅读 · 0 评论 -
埃拉托色尼筛选法
埃拉托色尼筛选法(the Sieve of Eratosthenes)简称埃氏筛法,是古希腊数学家埃拉托色尼(Eratosthenes 274B.C.~194B.C.)提出的一种筛选法。 用于求一定范围内的质数. 步骤: (1)先把1删除(现今数学界1既不是质数也不是合数) (2)读取队列中当前最小的数2,然后把2的倍数删去 (3)读取队列中当前最小的数3,然后把3的倍数删去 (4)读取原创 2017-06-26 10:08:32 · 915 阅读 · 0 评论 -
Levenshtein distance(Edit distance)
In information theory, Linguistics and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two原创 2017-07-10 15:09:50 · 447 阅读 · 0 评论 -
对递归的一点理解
递归方法就是直接或间接调用自身的方法。最简单的情况称为基础情况或终止条件;而遇到其余情况就应将问题简化为子问题,子问题在本质上和原始问题是一样的,但是更简单也更小。因为子问题与原始问题具有相同的性质,所以可以用不同的参数来调用这个方法,这称作递归调用。 递归实现简单、直接,但是并不高效。 下面以计算斐波纳挈数为例解释调用过程: java code:import java.util.Sca原创 2017-06-05 14:20:03 · 635 阅读 · 0 评论 -
K均值算法
K均值算法,即K-means,主要分为两步:确定簇标记移动簇中心输入:K(簇的个数),训练集{x1,x2,…xm}首先,初始化K个簇中心点 μ1,μ2,…μK;Repeat{确定各样本点簇标记for i=1 to mxi的簇标记:= 与xi距离最近的簇中心的标记根据当前簇标记移动簇中心点for k=1 to Kμk:=簇k中样本点的平均向量}...原创 2018-10-18 09:55:32 · 1163 阅读 · 0 评论