trajminer
.TrajectoryData¶
-
class
trajminer.
TrajectoryData
(attributes, data, tids, labels=None)¶ Trajectory data wrapper.
- attributesarray-like
The names of attributes/features describing trajectory points in the dataset.
- dataarray-like, shape: (n_trajectories, n_points, n_features)
The trajectory data.
- tidsarray-like
The corresponding trajectory IDs of trajectories in
data
.- labelsarray-like (default=None)
The corresponding labels of trajectories in
data
.
-
__init__
(attributes, data, tids, labels=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
get_attributes
()¶ Retrieves the attributes in the dataset.
- attributesarray
An array of length n_features.
-
get_label
(tid)¶ Retrieves the label for the corresponding tid.
- tidint
The trajectory ID.
- labelint or str
The corresponding label.
-
get_labels
(unique=False)¶ Retrieves the labels of the trajectories in the dataset.
- uniquebool (default=False)
If
True
, then the set of unique labels is returned. Otherwise, an array with the labels of each individual trajectory is returned.
- labelsarray
An array of length n_trajectories if unique=False, and of length n_labels otherwise.
-
get_tids
(label=None)¶ Retrieves the trajectory IDs in the dataset.
- labelint (default=None)
If None, then retrieves all trajectory IDs. Otherwise, returns the IDs corresponding to the given label.
- attributesarray
An array of length n_trajectories.
-
get_trajectories
(label=None)¶ Retrieves multiple trajectories from the dataset.
- labelint (default=None)
The label of the trajectories to be retrieved. If
None
, then all trajectories are retrieved.
- trajectoriesarray
The trajectories of the given label. If label=None or if the dataset does not contain labels, then all trajectories are returned.
-
get_trajectory
(tid)¶ Retrieves a trajectory from the dataset.
- tidint
The trajectory ID.
- trajectoryarray, shape: (n_points, n_features)
The corresponding trajectory.
-
length
()¶ Returns the number of trajectories in the dataset.
- lengthint
Number of trajectories in the dataset.
-
merge
(other, ignore_duplicates=True, inplace=True)¶ Merges this trajectory data with another one. Notice that this method only works if the datasets have the same set of attributes.
- other
trajminer.TrajectoryData
The dataset to be merged with.
- ignore_duplicatesbool (default=True)
If True, then trajectory IDs in other that already exist in self are ignored. Otherwise, raises an exception when a duplicate is found.
- inplacebool (default=True)
If True modifies the current object, otherwise returns a new object.
- dataset
trajminer.TrajectoryData
The merged dataset. If inplace=True, then returns the modified current object.
- other
-
stats
(print_stats=False)¶ Computes statistics for the dataset.
- print_statsbool (default=False)
If True, stats are printed.
- statsdict
A dictionary containing the dataset statistics.