tychen5 / ntu_ants-lab Goto Github PK
View Code? Open in Web Editor NEWAdvanced Network Technologies and Services Laboratory (先進網路資訊安全實驗室)
Home Page: https://www.airitilibrary.com/Publication/alDetailedMesh1?DocID=U0001-1308201921554000#Summary
Advanced Network Technologies and Services Laboratory (先進網路資訊安全實驗室)
Home Page: https://www.airitilibrary.com/Publication/alDetailedMesh1?DocID=U0001-1308201921554000#Summary
有幾個家族在跑RasMMA.ipynb裡面的get_Rep_CommMotifSeq時,會噴出NameError: name 'repNew' is not defined
zbot_0.8 -> NameError: name 'repNew' is not defined
allaple_0.8 -> NameError: name 'repNew' is not defined
NameError Traceback (most recent call last)
<ipython-input-12-b6e7823afcf5> in <module>()
17
18 print(outputPath, pickleDir)
---> 19 main(data_directory, tag, outputPath, manualThresholdNumber)
<ipython-input-12-b6e7823afcf5> in main(data_directory, tag, outputPath, manualThresholdNumber)
4 date_time = datetime.datetime.now()
5 print(date_time.strftime("%Y-%b-%d %H:%M"))
----> 6 startClustering(data_directory, tag, outputPath, manualThresholdNumber)
7 date_time = datetime.datetime.now()
8 print(date_time.strftime("%Y-%b-%d %H:%M"))
<ipython-input-11-1e4aa6d47375> in startClustering(data_directory, tag, outputPath, thresholdValue)
17 tag,
18 outputPath,
---> 19 thresholdValue)
20
21 # saving intermediatePool as pickle file
<ipython-input-11-bac1e31319dc> in do_RasMMA_clustering(data_directory, tag, outputPath, thresholdValue)
37
38 # calculate scoreList in candidate clusters
---> 39 scoreList = findMergeCandidateScoreList(toMergeCandidateDict, generatedSeqNum)
40 # check and merge exactly the same candidates before merge clusters
41 scoreList = checkExactlySameCandidates(scoreList)
<ipython-input-11-36e0a55e1990> in findMergeCandidateScoreList(toMergeCandidateDict, generatedSeqNum)
12 Ri = toMergeCandidateDict[ dictKeys[i] ][0]
13 Rj = toMergeCandidateDict[ dictKeys[j] ][0]
---> 14 repNew_CMS = get_Rep_CommMotifSeq(Ri, Rj) # get rep's common motif seq.
15 clusterTempName = "G" + str(generatedSeqNum)
16 Rnew = (clusterTempName, repNew_CMS)
<ipython-input-11-4c0f20e12e7a> in get_Rep_CommMotifSeq(Ri, Rj)
13 commonSequence = do_globalAlignment(rep1, rep2) # do Alignment
14 repNew = commonSequence
---> 15 return repNew
NameError: name 'repNew' is not defined
def get_Rep_CommMotifSeq(Ri, Rj):
global repNew
rep1 = []
for motif in Ri[1]:
rep1.extend(motif)
rep2 = []
for motif in Rj[1]:
rep2.extend(motif)
repNew_CMS = []
if(rep1 and rep2):
commonSequence = do_globalAlignment(rep1, rep2) # do Alignment
repNew = commonSequence
return repNew
因為沒加上global repNew
之前會產生UnboundLocalError: local variable 'repNew' referenced before assignment
的error,所以我先加上去。目前判斷NameError的錯誤訊息可能是因為沒有進入到if(rep1 and rep2)
的判斷裡面就直接return repNew,在其他有被引入.ipynb裡面也找不到此變數的宣告。
有幾個家族在跑RasMMA.ipynb裡面的compute_Score
,會噴出ZeroDivisionError: float division by zero
domaiq_0.8 -> ZeroDivisionError: float division by zero
expiro_0.8 -> ZeroDivisionError: float division by zero
kazy_0.8 -> ZeroDivisionError: float division by zero
sality_0.8 -> ZeroDivisionError: float division by zero
installcore_0.8 -> ZeroDivisionError: float division by zero
softpulse_0.8 -> ZeroDivisionError: float division by zero
symmi_0.8 -> ZeroDivisionError: float division by zero
zusy_0.8 -> ZeroDivisionError: float division by zero
loadmoney_0.8 -> ZeroDivisionError: float division by zero
sytro_0.8 -> ZeroDivisionError: float division by zero
virut_0.8 -> ZeroDivisionError: float division by zero
ZeroDivisionError Traceback (most recent call last)
<ipython-input-21-f51fb98ae00c> in <module>()
17
18 print(outputPath, pickleDir)
---> 19 main(data_directory, tag, outputPath, manualThresholdNumber)
<ipython-input-21-f51fb98ae00c> in main(data_directory, tag, outputPath, manualThresholdNumber)
4 date_time = datetime.datetime.now()
5 print(date_time.strftime("%Y-%b-%d %H:%M"))
----> 6 startClustering(data_directory, tag, outputPath, manualThresholdNumber)
7 date_time = datetime.datetime.now()
8 print(date_time.strftime("%Y-%b-%d %H:%M"))
<ipython-input-11-1e4aa6d47375> in startClustering(data_directory, tag, outputPath, thresholdValue)
17 tag,
18 outputPath,
---> 19 thresholdValue)
20
21 # saving intermediatePool as pickle file
<ipython-input-11-bac1e31319dc> in do_RasMMA_clustering(data_directory, tag, outputPath, thresholdValue)
37
38 # calculate scoreList in candidate clusters
---> 39 scoreList = findMergeCandidateScoreList(toMergeCandidateDict, generatedSeqNum)
40 # check and merge exactly the same candidates before merge clusters
41 scoreList = checkExactlySameCandidates(scoreList)
<ipython-input-11-36e0a55e1990> in findMergeCandidateScoreList(toMergeCandidateDict, generatedSeqNum)
15 clusterTempName = "G" + str(generatedSeqNum)
16 Rnew = (clusterTempName, repNew_CMS)
---> 17 score = compute_Score(Ri, Rj, Rnew)
18 Ri_name = Ri[0]
19 Rj_name = Rj[0]
<ipython-input-11-896931b6b6bc> in compute_Score(Ri, Rj, Rnew)
18 Lorg = max(L_Ri, L_Rj)
19 Lnew = len(repNew)
---> 20 return float(Lnew)/Lorg
21 else:
22 return 0
ZeroDivisionError: float division by zero
# compute score of Rnew
# the score calculate method is the length ratio of new to origin one
# Ri is a tuple like ('G0', [['A#A', 'C#C'],['D#D']])
def compute_Score(Ri, Rj, Rnew):
if(Rnew[1]):
repI = []
for API_motif in Ri[1]:
repI.extend(API_motif)
repJ = []
for API_motif in Rj[1]:
repJ.extend(API_motif)
repNew = []
for API_motif in Rnew[1]:
repNew.extend(API_motif)
L_Ri = len(repI)
L_Rj = len(repJ)
Lorg = max(L_Ri, L_Rj)
Lnew = len(repNew)
return float(Lnew)/Lorg
else:
return 0
會有這錯誤應該是因為 len(repI) 跟 len(repJ)都為0,但是為啥?學長這邊有寫個else: return 0
,不知道可以不可以多判斷如果 len(repI) 跟 len(repJ)都為就直接return 0。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.