Fix random state for kmean clustering
When the kmeans algorithm is used to cluster networks, this is not deterministic by default. The result is that repeated runs of the `simplify_network` and `cluster_network` rules can and usually do produce different results that vary somewhat randomly. This makes results less reproducible when given only a pypsa-eur configuration file. The fix is to supply a fixed random state to the k-means algorithm.
This commit is contained in:
parent
835bfc0f6a
commit
f7ee47238a
@ -226,6 +226,7 @@ def busmap_for_n_clusters(n, n_clusters, solver_name, focus_weights=None, algori
|
||||
algorithm_kwds.setdefault('n_init', 1000)
|
||||
algorithm_kwds.setdefault('max_iter', 30000)
|
||||
algorithm_kwds.setdefault('tol', 1e-6)
|
||||
algorithm_kwds.setdefault('random_state', 0)
|
||||
|
||||
n.determine_network_topology()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user