Giter Club home page Giter Club logo

tychen5 / ntu_ants-lab Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 2.0 139.35 MB

Advanced Network Technologies and Services Laboratory (先進網路資訊安全實驗室)

Home Page: https://www.airitilibrary.com/Publication/alDetailedMesh1?DocID=U0001-1308201921554000#Summary

Jupyter Notebook 91.70% Python 1.04% C++ 5.41% Shell 0.01% Makefile 0.01% C 1.81% Objective-C 0.03% HTML 0.01%
classification clustering deep-learning malware-analysis neural-network similarity visualization

ntu_ants-lab's People

Contributors

howardohmygod avatar tychen5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mindis yrkuo

ntu_ants-lab's Issues

get_Rep_CommMotifSeq: NameError: name 'repNew' is not defined

有幾個家族在跑RasMMA.ipynb裡面的get_Rep_CommMotifSeq時,會噴出NameError: name 'repNew' is not defined

在編號1~15中會出現error的family

zbot_0.8 -> NameError: name 'repNew' is not defined
allaple_0.8 -> NameError: name 'repNew' is not defined

Error Trace Detail

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

Source Code (RasMMA.ipynb)

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裡面也找不到此變數的宣告。

compute_Score: ZeroDivisionError: float division by zero

有幾個家族在跑RasMMA.ipynb裡面的compute_Score,會噴出ZeroDivisionError: float division by zero

在編號1~15中會出現error的family

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

Error Trace Detail

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

Source Code (RasMMA.ipynb)

# 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。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.