find-s 演算法

來源:互聯網
上載者:User

實現《機器學習》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', '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();

  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.