sinadabiri / Transport-Mode-GPS-CNN

Inferring transportation modes from GPS trajectories using a Convolutional Neural Network
MIT License
45 stars 18 forks source link

What's this logic in Instance_Creation.py file? #8

Open arilwan opened 4 years ago

arilwan commented 4 years ago

I cannot understand the logic in the following code from the Instance_Creation.py please?

min_trip_time = 20 * 60  # 20 minutes equal to 1200 seconds
    threshold = 200  # fixed of number of GPS points for each instance
    i = 0
    while i <= (len(Data) - 1):
        No = 0
        ModeType = Data[i, 3]
        Counter = 0
        # index: save the instance indices when an instance is being created and concatenate all in the remove
        index = []
        # First, we always have an instance with one GPS point.
        while i <= (len(Data) - 1) and Data[i, 3] == ModeType and Counter < threshold:
            if delta_time[i] <= min_trip_time:
                Counter += 1
                index.append(i)
                i += 1
            else:
                Counter += 1
                index.append(i)
                i += 1
                break

Why breaking user's trajectory into trips with min_trip?