Skip to main content

TemporalSampler

Struct TemporalSampler 

Source
pub struct TemporalSampler { /* private fields */ }
Expand description

Sampler for temporal patterns in transaction generation.

Implementations§

Source§

impl TemporalSampler

Source

pub fn new(seed: u64) -> Self

Create a new temporal sampler.

Source

pub fn with_config( seed: u64, seasonality_config: SeasonalityConfig, working_hours_config: WorkingHoursConfig, holidays: Vec<NaiveDate>, ) -> Self

Create a temporal sampler with custom configuration.

Source

pub fn with_full_config( seed: u64, seasonality_config: SeasonalityConfig, working_hours_config: WorkingHoursConfig, holidays: Vec<NaiveDate>, industry_seasonality: Option<IndustrySeasonality>, holiday_calendar: Option<HolidayCalendar>, ) -> Self

Create a temporal sampler with full enhanced configuration.

Source

pub fn with_period_end_dynamics( seed: u64, seasonality_config: SeasonalityConfig, working_hours_config: WorkingHoursConfig, holidays: Vec<NaiveDate>, industry_seasonality: Option<IndustrySeasonality>, holiday_calendar: Option<HolidayCalendar>, period_end_dynamics: PeriodEndDynamics, ) -> Self

Create a temporal sampler with period-end dynamics.

Source

pub fn set_intra_day_patterns(&mut self, patterns: IntraDayPatterns)

Sets the intra-day patterns for time-of-day activity variation.

Source

pub fn get_intra_day_multiplier(&self, time: NaiveTime, is_human: bool) -> f64

Gets the intra-day multiplier for a given time.

Source

pub fn with_industry_seasonality(self, seasonality: IndustrySeasonality) -> Self

Set industry-specific seasonality.

Source

pub fn with_holiday_calendar(self, calendar: HolidayCalendar) -> Self

Set regional holiday calendar.

Source

pub fn set_industry_seasonality(&mut self, seasonality: IndustrySeasonality)

Set industry seasonality (mutable reference version).

Source

pub fn set_holiday_calendar(&mut self, calendar: HolidayCalendar)

Set holiday calendar (mutable reference version).

Source

pub fn with_period_end(self, dynamics: PeriodEndDynamics) -> Self

Set period-end dynamics.

Source

pub fn set_period_end_dynamics(&mut self, dynamics: PeriodEndDynamics)

Set period-end dynamics (mutable reference version).

Source

pub fn period_end_dynamics(&self) -> Option<&PeriodEndDynamics>

Get the period-end dynamics if set.

Source

pub fn set_use_period_end_dynamics(&mut self, enabled: bool)

Enable or disable period-end dynamics usage.

Source

pub fn industry_seasonality(&self) -> Option<&IndustrySeasonality>

Get the industry seasonality if set.

Source

pub fn holiday_calendar(&self) -> Option<&HolidayCalendar>

Get the holiday calendar if set.

Source

pub fn generate_us_holidays(year: i32) -> Vec<NaiveDate>

Generate US federal holidays for a given year.

Source

pub fn is_weekend(&self, date: NaiveDate) -> bool

Check if a date is a weekend.

Source

pub fn get_day_of_week_multiplier(&self, date: NaiveDate) -> f64

Get the day-of-week activity multiplier.

Returns a multiplier based on the day of the week:

  • Monday: Higher activity (catch-up from weekend)
  • Tuesday: Slightly elevated
  • Wednesday/Thursday: Normal
  • Friday: Reduced (early departures, winding down)
  • Saturday/Sunday: Uses weekend_activity setting
Source

pub fn is_holiday(&self, date: NaiveDate) -> bool

Check if a date is a holiday.

Source

pub fn is_month_end(&self, date: NaiveDate) -> bool

Check if a date is month-end (last N days of month).

Source

pub fn is_quarter_end(&self, date: NaiveDate) -> bool

Check if a date is quarter-end.

Source

pub fn is_year_end(&self, date: NaiveDate) -> bool

Check if a date is year-end.

Source

pub fn last_day_of_month(date: NaiveDate) -> NaiveDate

Get the last day of the month for a given date.

Source

pub fn get_date_multiplier(&self, date: NaiveDate) -> f64

Get the activity multiplier for a specific date.

Combines:

  • Base seasonality (month-end, quarter-end, year-end spikes)
  • Day-of-week patterns (Monday catch-up, Friday slowdown)
  • Weekend activity reduction
  • Holiday activity reduction (from calendar or legacy list)
  • Industry-specific seasonality (if configured)
  • Period-end dynamics (if configured, replaces legacy flat multipliers)
Source

pub fn get_period_end_multiplier(&self, date: NaiveDate) -> f64

Get the period-end multiplier for a date.

Returns the period-end component of the date multiplier, using dynamics if available, otherwise legacy flat multipliers.

Source

pub fn get_base_date_multiplier(&self, date: NaiveDate) -> f64

Get the base multiplier without industry seasonality.

Source

pub fn get_industry_multiplier(&self, date: NaiveDate) -> f64

Get only the industry seasonality multiplier for a date.

Source

pub fn sample_date(&mut self, start: NaiveDate, end: NaiveDate) -> NaiveDate

Sample a posting date within a range based on seasonality.

Source

pub fn sample_time(&mut self, is_human: bool) -> NaiveTime

Sample a posting time based on working hours.

Source

pub fn expected_count_for_date( &self, date: NaiveDate, daily_average: f64, ) -> u64

Calculate expected transaction count for a date given daily average.

Source

pub fn reset(&mut self, seed: u64)

Reset the sampler with a new seed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V