phad-c32.py
def _parseTestingData():
    """Parse week 4 and 5 of testing data."""
    try:
        allData = np.load(open("data/test_data.npy", "rb"))
        print("Loading pre-parsed training data...", end='')
    except IOError:
        print("Parsing the testing data...", end='')
        # Parse the Training Data
        testingFiles = [
            "data/testing/week4_monday_inside",
            #  "data/testing/week4_tuesday_inside",  <-- doesn't exist
            "data/testing/week4_wednesday_inside",
            "data/testing/week4_thursday_inside",
            "data/testing/week4_friday_inside",
            "data/testing/week5_monday_inside",
            "data/testing/week5_tuesday_inside",
            "data/testing/week5_wednesday_inside",
            "data/testing/week5_thursday_inside",
            "data/testing/week5_friday_inside",
        ]

        allDays = np_parse_pcap(testingFiles)
        # Create a single matrix of packets x features
        testData = np.vstack([pkts for (pkts, times) in allDays])
        # Create a single matrix of packets x features
        testTimes = np.vstack([times for (pkts, times) in allDays])
        allData = np.hstack((testTimes, testData))

        np.save(open("data/test_data.npy", "wb"), allData)

    print("Done!")
    return allData
Parse week 4 and 5 of testing data.
Parse week 4 and 5 of testing data.
Parse week 4 and 5 of testing data .
def _parseTestingData():
    try:
        allData = np.load(open("data/test_data.npy", "rb"))
        print("Loading pre-parsed training data...", end='')
    except IOError:
        print("Parsing the testing data...", end='')
        testingFiles = [
            "data/testing/week4_monday_inside",
            "data/testing/week4_wednesday_inside",
            "data/testing/week4_thursday_inside",
            "data/testing/week4_friday_inside",
            "data/testing/week5_monday_inside",
            "data/testing/week5_tuesday_inside",
            "data/testing/week5_wednesday_inside",
            "data/testing/week5_thursday_inside",
            "data/testing/week5_friday_inside",
        ]
        allDays = np_parse_pcap(testingFiles)
        testData = np.vstack([pkts for (pkts, times) in allDays])
        testTimes = np.vstack([times for (pkts, times) in allDays])
        allData = np.hstack((testTimes, testData))
        np.save(open("data/test_data.npy", "wb"), allData)
    print("Done!")
    return allData
def _parseTestingData ( ) : try : allData = np . load ( open ( "data/test_data.npy" , "rb" ) ) print ( "Loading pre-parsed training data..." , end = '' ) except IOError : print ( "Parsing the testing data..." , end = '' ) testingFiles = [ "data/testing/week4_monday_inside" , "data/testing/week4_wednesday_inside" , "data/testing/week4_thursday_inside" , "data/testing/week4_friday_inside" , "data/testing/week5_monday_inside" , "data/testing/week5_tuesday_inside" , "data/testing/week5_wednesday_inside" , "data/testing/week5_thursday_inside" , "data/testing/week5_friday_inside" , ] allDays = np_parse_pcap ( testingFiles ) testData = np . vstack ( [ pkts for ( pkts , times ) in allDays ] ) testTimes = np . vstack ( [ times for ( pkts , times ) in allDays ] ) allData = np . hstack ( ( testTimes , testData ) ) np . save ( open ( "data/test_data.npy" , "wb" ) , allData ) print ( "Done!" ) return allData
Parse week 4 and 5 of testing data.
Parse week 4 and 5 of testing data .
"""Parse week 4 and 5 of testing data.""" # Parse the Training Data #  "data/testing/week4_tuesday_inside",  <-- doesn't exist # Create a single matrix of packets x features # Create a single matrix of packets x features