xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 3KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-07
  • 語言: Python
  • 標簽: Python??動物識別??

資源簡介

Python實現動物識別產生式系統,適合初學機器學習者,有應該更正的地方,歡迎指正

資源截圖

代碼片段和文件信息

#?-*-?coding:?utf-8?-*-
“““
Created?on?Sun?Dec?24?15:13:13?2017

@author:?user
“““
import?numpy?as?np
class?productionSystem:
????def?__init__(self):
????????f=open(“productions.txt““r“)
????????self.productions=[]
????????self.charicters=[]
????????self.myclass=(f.readline().strip(“最終類別為:“).strip()).split(“,“)
????????for?line?in?f.readlines():
????????????if(line!=‘\n‘):
????????????????line=line.replace(“->““?“)
????????????????line=line.replace(“““?“)
????????????????line=line.split()
????????????????self.productions.append(line)
????????????????for?ch?in?line:
????????????????????if?(ch?not?in?self.myclass)?and?(ch?not?in?self.charicters):
????????????????????????self.charicters.append(ch)
????def?showProduction(self):
????????print()
????def?match(selfx):
????????for?ch?in?self.productions[x][:-1]:
????????????if(ch?in?self.work):
????????????????continue
????????????else:
????????????????return?False
????????return?True
????def?classify(selfwork):
????????used=np.zeros(len(self.productions))
????????counter=len(self.work)
????????while(True):
????????????for?i?in?range(len(self.productions)):
????????????????if(used[i]==0?and?self.match(i)):
????????????????????used[i]=1
????????????????????self.work.append(self.productions[i][-1])
????????????????????if(self.work[-1]?in?self.myclass):
????????????????????????return?True
????????????tmp=len(self.work)
????????????if(tmp==counter):
????????????????return?False
????????????else:
????????????????counter=tmp
????def?dowork(self):
????????print(“所有類別有:“)
????????for?t?in?self.myclass:
????????????print(‘{:<10}‘.format(t)end=““)
????????print()
????????print(“所有屬性有:“)
????????counter=0
????????for?t?in?self.charicters:
????????????counter+=1
????????????if(counter%5==0):
????????????????print(‘{:<10}‘.format(t))
????????????else:
????????????????print(‘{:<10}‘.format(t)end=‘‘)
????????self.work=input(“\n請輸入屬性\n----屬性之間用空格隔開----\n“)
????????self.work=self.work.split()
????????if(self.classify(self.work)):
????????????print(“該物種為:“+self.work[-1])
????????else:
????????????print(“抱歉,未能識別出該物種\n“)
def?main():
????p=productionSystem()
????p.dowork()
????
if?__name__==“__main__“:
????main()

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????429??2017-12-24?16:24??ProductionSystem\productions.txt

?????文件???????2346??2017-12-24?19:35??ProductionSystem\production_system.py

?????文件???????2225??2017-12-24?18:56??ProductionSystem\__pycache__\production_system.cpython-36.pyc

?????目錄??????????0??2017-12-24?18:56??ProductionSystem\__pycache__

?????目錄??????????0??2017-12-24?17:15??ProductionSystem

-----------?---------??----------?-----??----

?????????????????5000????????????????????5


評論

共有 條評論