relife.data.ReplacementPolicyData

relife.data.ReplacementPolicyData

class relife.data.ReplacementPolicyData(T: float, n_indices: int, n_samples: int, indices: numpy.ndarray, samples: numpy.ndarray, times: numpy.ndarray, durations: numpy.ndarray, rewards: numpy.ndarray, events: numpy.ndarray, args: numpy.ndarray, a0: numpy.ndarray)[source]

Bases: relife.data.RenewalRewardData

Replacement policy data.

Methods

astuple

Converts the dataclass attributes as a tuple.

mean_number_of_events

Mean number of events with respect to time.

mean_total_reward

Mean total reward with respect to time.

number_of_events

Counts the number of events with respect to times.

to_lifetime_data

Builds a lifetime data sample.

total_reward

Total reward with respect to time.

Attributes

size

The number of indices.

events

Event types.

args

Extra arguments required by the lifetime model.

a0

Age of the assets at the first replacement.

events: numpy.ndarray

Event types.

args: numpy.ndarray

Extra arguments required by the lifetime model.

a0: numpy.ndarray

Age of the assets at the first replacement.

to_lifetime_data(t0: float = 0, tf: Optional[float] = None, sample: Optional[int] = None) relife.data.LifetimeData[source]

Builds a lifetime data sample.

Parameters
  • t0 (float, optional) – Start of the observation period, by default 0.

  • tf (float, optional) – End of the observation period, by default the time at the end of the observation.

  • sample (int, optional) – Index of the sample, by default all sample are mixed.

Returns

The lifetime data sample built from the observation period [t0,tf] of the renewal process.

Return type

LifetimeData

Raises

ValueError – if t0 is greater than tf.

astuple() tuple

Converts the dataclass attributes as a tuple.

mean_number_of_events() Tuple[numpy.ndarray, numpy.ndarray]

Mean number of events with respect to time.

Returns

The ordered times and mean number of events as a tuple (times, counts).

Return type

Tuple[ndarray, ndarray]

mean_total_reward() Tuple[numpy.ndarray, numpy.ndarray]

Mean total reward with respect to time.

Returns

The ordered times and mean total rewards as a tuple (times, z).

Return type

Tuple[ndarray, ndarray]

number_of_events(sample: int) Tuple[numpy.ndarray, numpy.ndarray]

Counts the number of events with respect to times.

Parameters

sample (int) – Index of the sample.

Returns

The ordered times and total number of events as a tuple (times, counts).

Return type

Tuple[ndarray, ndarray]

property size: int

The number of indices.

Returns

Size of indices array.

Return type

int

total_reward(sample: int) Tuple[numpy.ndarray, numpy.ndarray]

Total reward with respect to time.

Parameters

sample (int) – Index of the sample.

Returns

The ordered times and total rewards as a tuple (times, z).

Return type

Tuple[ndarray, ndarray]

rewards: numpy.ndarray

Reward associated at each event.