powergrid_synth.distribution.distribution_input_model
Input model for the Schweitzer feeder generator.
Uses a 3-D kernel density estimate (KDE) over (N_nodes, P_load, P_gen) to sample realistic combinations of feeder size and loading, as described in Section III-A of Schweitzer et al. (2017).
Module Contents
- class powergrid_synth.distribution.distribution_input_model.DistributionInputModel(bw_method=None, seed=None)[source]
3-D KDE input model for feeder size and loading.
The model is fitted on reference feeders and then sampled to produce realistic
(n_nodes, total_load, total_gen)triples.- Parameters:
bw_method (str or float, optional) – Bandwidth method passed to
scipy.stats.gaussian_kde.seed (int or None, optional) – Random seed for reproducibility.
- _fit_kde(data)[source]
Fit KDE with regularization for near-singular covariance.
- Parameters:
data (numpy.ndarray)
- Return type:
scipy.stats.gaussian_kde
- fit(feeders)[source]
Fit the KDE from a collection of reference feeder graphs.
Each graph must have node attributes
P_mw(positive for load, negative for generation).- Parameters:
feeders (sequence of nx.Graph) – Reference feeder graphs.
- Return type:
self
- fit_from_arrays(n_nodes, total_load, total_gen)[source]
Fit directly from arrays (no graph objects needed).
- Parameters:
n_nodes (array-like of int)
total_load (array-like of float)
total_gen (array-like of float)
- Return type:
self
- pdf(n_nodes, total_load, total_gen)[source]
Evaluate the KDE density at a given point.
- Parameters:
n_nodes (float) – Coordinates in the 3-D input space.
total_load (float) – Coordinates in the 3-D input space.
total_gen (float) – Coordinates in the 3-D input space.
- Returns:
Estimated probability density.
- Return type:
float
- sample(n_samples=1)[source]
Draw samples from the fitted input model.
- Parameters:
n_samples (int) – Number of samples to draw.
- Return type:
list of FeederInputSample