phad-c32.py
def _parseTrainingData():
    """Parse the week 3 training data."""
    try:
        allData = np.load(open("data/train_data.npy", "rb"))
        print("Loading pre-parsed training data...", end='')
    except IOError:
        print("Parsing the training data...", end='')
        # Parse the Training Data
        trainingFiles = [
            "data/training/week3_monday_inside",
            "data/training/week3_monday_extra_inside",
            "data/training/week3_tuesday_inside",
            "data/training/week3_tuesday_extra_inside",
            "data/training/week3_wednesday_inside",
            "data/training/week3_wednesday_extra_inside",
            "data/training/week3_thursday_inside",
            "data/training/week3_friday_inside",
        ]
        allDays = np_parse_pcap(trainingFiles)
        # Create a single matrix of packets x features
        trainData = np.vstack([pkts for (pkts, times) in allDays])
        # Create a single matrix of packets x features
        trainTimes = np.vstack([times for (pkts, times) in allDays])

        allData = np.hstack((trainTimes, trainData))
        np.save(open("data/train_data.npy", "wb"), allData)

    print("Done!")
    return allData
Parse the week 3 training data.
Parse the week 3 training data.
Parse the week 3 training data .
def _parseTrainingData():
    try:
        allData = np.load(open("data/train_data.npy", "rb"))
        print("Loading pre-parsed training data...", end='')
    except IOError:
        print("Parsing the training data...", end='')
        trainingFiles = [
            "data/training/week3_monday_inside",
            "data/training/week3_monday_extra_inside",
            "data/training/week3_tuesday_inside",
            "data/training/week3_tuesday_extra_inside",
            "data/training/week3_wednesday_inside",
            "data/training/week3_wednesday_extra_inside",
            "data/training/week3_thursday_inside",
            "data/training/week3_friday_inside",
        ]
        allDays = np_parse_pcap(trainingFiles)
        trainData = np.vstack([pkts for (pkts, times) in allDays])
        trainTimes = np.vstack([times for (pkts, times) in allDays])
        allData = np.hstack((trainTimes, trainData))
        np.save(open("data/train_data.npy", "wb"), allData)
    print("Done!")
    return allData
def _parseTrainingData ( ) : try : allData = np . load ( open ( "data/train_data.npy" , "rb" ) ) print ( "Loading pre-parsed training data..." , end = '' ) except IOError : print ( "Parsing the training data..." , end = '' ) trainingFiles = [ "data/training/week3_monday_inside" , "data/training/week3_monday_extra_inside" , "data/training/week3_tuesday_inside" , "data/training/week3_tuesday_extra_inside" , "data/training/week3_wednesday_inside" , "data/training/week3_wednesday_extra_inside" , "data/training/week3_thursday_inside" , "data/training/week3_friday_inside" , ] allDays = np_parse_pcap ( trainingFiles ) trainData = np . vstack ( [ pkts for ( pkts , times ) in allDays ] ) trainTimes = np . vstack ( [ times for ( pkts , times ) in allDays ] ) allData = np . hstack ( ( trainTimes , trainData ) ) np . save ( open ( "data/train_data.npy" , "wb" ) , allData ) print ( "Done!" ) return allData
Parse the week 3 training data.
Parse the week 3 training data .
"""Parse the week 3 training data.""" # Parse the Training Data # Create a single matrix of packets x features # Create a single matrix of packets x features