zoukankan      html  css  js  c++  java
  • finds 算法

    实现《机器学习》19页的FIND-S算法。

    验证不同的实例顺序

    开始于非最特殊假设。

    #__author__=lx
    #__date__=2011.10.18
    #__brief__=FIND-S, from 'machine learning' 19
    
    def find_s():
            
            x1 = [ 'sunny', 'warm', 'nurmal', 'strong', 'warm', 'same' , 1 ]
            x2 = [ 'sunny', 'warm', 'high', 'strong', 'warm', 'same' , 1 ]
            x3 = [ 'rainy', 'cold', 'high', 'strong', 'warm', 'change', 0 ]
            x4 = [ 'sunny', 'warm', 'high', 'strong', 'cool', 'change', 1 ]
    
            h = [ None, None, None, None, None, None ]
            h1 = [ 'sunny', 'cold', 'high', 'strong', 'warm', 'change' ]
    
            xa = [ x1, x2, x3, x4 ]
            
            xb = [ x2, x3, x4, x1 ]
    
            for i in xb:
                    if i[6] == 1:
                            index = 0
                            for j in i[ :-1 ]:
                                    if ( h1[index] == None ):
                                            h1[index] = j
                                    elif ( h1[index] != j ):
                                            h1[index] = '?'
                                    index += 1
    
            for i in h1:
                    print i
                                    
                                            
    
    
    if __name__ == "__main__":
            find_s();
    

      

  • 相关阅读:
    30网络通信之多线程
    U盘自动拷贝
    多态原理探究
    应用安全
    应用安全
    编码表/转义字符/进制转换
    代码审计
    文件上传
    渗透测试-Web安全-SSRF
    中间人攻击
  • 原文地址:https://www.cnblogs.com/lxgeek/p/2216595.html
Copyright © 2011-2022 走看看