上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要: #include <stdio.h>#include <stdlib.h>voidhello( a, b )int a ;int b ;{ a = 5; b = 6; printf( "a is %d \n b is %d\n", a, b );}intmain(){ hello(); exit( 0 );} 阅读全文
posted @ 2011-10-26 19:17 lxgeek 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 贝叶斯学习算法应用于机器学习的有两个原因,第一:贝叶斯学习能够计算显式的假设概率,如朴素贝叶斯分类器。第二:贝叶斯方法为理解机器学习的其他方法提供了手段,如分析FIND-S算法。 贝叶斯法则对与贝叶斯学习至关重要,其形式如下: 贝叶斯法则提供了一种计算假设概率的方法,它基于假设的先验概率、给定假设下观察到不同数据的概率以及观察到的数据本身。其中P(H)用来代表在没有训练数据前假设H拥有的初始概率,因此其通常被称为先验概率(prior probability),它反映了我们所拥有的关于假设H是一正确假设的机会的背景知识。如果没有这一先验知识,那么我们可以简单地将每一候选假设赋予相同的先验... 阅读全文
posted @ 2011-10-26 11:44 lxgeek 阅读(2533) 评论(0) 推荐(0) 编辑
摘要: 实现《机器学习》19页的FIND-S算法。验证不同的实例顺序开始于非最特殊假设。#__author__=lx#__date__=2011.10.18#__brief__=FIND-S, from 'machine learning' 19def find_s(): x1 = [ 'sunny', 'warm', 'nurmal', 'strong', 'warm', 'same' , 1 ] x2 = [ 'sunny', 'warm', 'h 阅读全文
posted @ 2011-10-18 16:09 lxgeek 阅读(3361) 评论(0) 推荐(0) 编辑
摘要: /* * author:lx * date: 2011-10-04 * brief: strcpy */#include <stdio.h>#include <stdlib.h>#include <assert.h>void*lx_strcpy( char *p, char *q ){ char *address = q; for ( ; *p != '\0'; p++ ) { assert( *q != '\0' ); *q = *p; ... 阅读全文
posted @ 2011-10-04 14:50 lxgeek 阅读(221) 评论(0) 推荐(0) 编辑
摘要: /* * author:lx * date:2011-10-04 * brief: convent int to string */#include <stdio.h>#include <stdlib.h>voidcon_string( int a ){ int m = 10; char p[6]; int c = 1; char *q = p; while ( a != 0 ) { c = a % m; a = a / ... 阅读全文
posted @ 2011-10-04 14:34 lxgeek 阅读(201) 评论(0) 推荐(0) 编辑
摘要: #__author__=lx#__date__=2011-10-03#__brief__=DFStime = 0d = []f = []color = []p = []def DFS_VISIT( G, i ): color[ i ] = 'gray' global time time += 1 d[i] = time print i+1 for v in G[i]: if color[v-1] == 'white': p[v-1] =... 阅读全文
posted @ 2011-10-03 20:21 lxgeek 阅读(235) 评论(0) 推荐(0) 编辑
摘要: #__author__=lx#__date__=2011-10-03#__brief__=BFSfrom collections import dequedef BFS( G, s ): d = [] color = [] p = [] L = deque() for i in range( len( G ) ): if i != s: color.append( 'white' ) d.append( ... 阅读全文
posted @ 2011-10-03 19:52 lxgeek 阅读(351) 评论(0) 推荐(0) 编辑
摘要: #__author__=lx#__date__=2011-09-29#__brief__=Heap_sortdef left( i ): return 2*idef right( i ): return 2*i + 1def swap( a1, a2 ): return a2, a1def max_heap( A, i ): if i == 0: return l = left( i ) r = right( i ) largest = i if l <... 阅读全文
posted @ 2011-09-29 18:51 lxgeek 阅读(130) 评论(0) 推荐(0) 编辑
摘要: #__author__=lx#__date__=2011-09-27#__brief_=shell_sortdef shell_sort( l ): gap = 0 n = len( l ) while ( gap <= n ): gap = gap * 3 + 1 while ( gap > 0 ): i = gap while ( i < n ): j = i - gap ... 阅读全文
posted @ 2011-09-27 09:29 lxgeek 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #__author__=lx#__date__=2011-09-26#__brief__=bubble_sortdef swap( a1, a2 ): return a2, a1def bullble_sort( l ): b = l for i in l: n = b.index( i ) j = 0 q = True while ( j < len( l ) - n - 1 ): if... 阅读全文
posted @ 2011-09-26 15:24 lxgeek 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页