1
0
Fork 0
Old engine for Continuous Time Bayesian Networks. Superseded by reCTBN. 🐍 https://github.com/madlabunimib/PyCTBN
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
PyCTBN/main_package/classes/structure_graph/trajectory.py

45 lines
1.4 KiB

import typing
import numpy as np
class Trajectory(object):
""" Abstracts the infos about a complete set of trajectories, represented as a numpy array of doubles
(the time deltas) and a numpy matrix of ints (the changes of states).
:param list_of_columns: the list containing the times array and values matrix
:type list_of_columns: List
:param original_cols_number: total number of cols in the data
:type original_cols_number: int
:_actual_trajectory: the trajectory containing also the duplicated/shifted values
:_times: the array containing the time deltas
"""
def __init__(self, list_of_columns: typing.List, original_cols_number: int):
"""Constructor Method
"""
self._times = list_of_columns[0]
self._actual_trajectory = list_of_columns[1]
self._original_cols_number = original_cols_number
@property
def trajectory(self) -> np.ndarray:
return self._actual_trajectory[:, :self._original_cols_number]
@property
def complete_trajectory(self) -> np.ndarray:
return self._actual_trajectory
@property
def times(self):
return self._times
def size(self):
return self._actual_trajectory.shape[0]
def __repr__(self):
return "Complete Trajectory Rows: " + str(self.size()) + "\n" + self.complete_trajectory.__repr__() + \
"\nTimes Rows:" + str(self.times.size) + "\n" + self.times.__repr__()