39f4a5bba7bc33aaa5d6ed60c7de784d557323d1,TraditionalML/eval_OneLayer.py,,update_representation,#Any#Any#Any#,10

Before Change


            prev_time = time

    // TODO: instead of printing, save this info 
    print("IP address", source_ip,
          "\nLast update", time,
          "\nRepresentation:", representation)

if __name__ == "__main__":
    // path to the pcap to get the update from
    pcap_path = sys.argv[1]

After Change


    state = r.hgetall(source_ip)
    representation = None
    if state:
        representation = json.loads(state[b"representation"].decode("ascii"))
        prev_time = float(state[b"time"])

    if representation is None:
        prev_time = None
        representation = np.zeros(representations.shape[1])

    for i, rep in enumerate(representations):
        time = timestamps[i].timestamp()
        if prev_time is None:
            representation = rep
            prev_time = time
        elif time > prev_time:
            time_diff = time - prev_time
            alpha = 1 - np.exp(-time_diff/time_const)
            representation += alpha*(rep - representation)
            prev_time = time

    state = {"time": time, "representation": list(representation)}
    r.hmset(source_ip, state)

if __name__ == "__main__":
    // path to the pcap to get the update from
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: CyberReboot/NetworkML
Commit Name: 39f4a5bba7bc33aaa5d6ed60c7de784d557323d1
Time: 2017-08-03
Author: clewis@iqt.org
File Name: TraditionalML/eval_OneLayer.py
Class Name:
Method Name: update_representation


Project Name: cve-search/cve-search
Commit Name: 3b2c309b3c29d05fee2e4d00e9210301fd0b4cfc
Time: 2020-10-22
Author: paul.tikken@gmail.com
File Name: lib/cpelist.py
Class Name: CPEList
Method Name: importList


Project Name: OpenMined/Grid
Commit Name: 92bb41035940965a436897f16294b6b563117efc
Time: 2021-02-21
Author: ionesiojr@gmail.com
File Name: apps/domain/src/main/core/services/infra_service.py
Class Name:
Method Name: create_worker_msg