-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import matplotlib.pyplot as plt | ||
import seaborn as sns | ||
|
||
from ema_workbench import load_results | ||
from ema_workbench.analysis import clusterer, plotting, Density | ||
|
||
# load data | ||
fn = r'./data/500 gas cases no policy.tar.gz' | ||
experiments, outcomes = load_results(fn) | ||
data = outcomes['Cumulative profit'] | ||
|
||
# calcuate distances | ||
distances = clusterer.calculate_cid(data) | ||
|
||
# plot dedrog | ||
# clusterer.plot_dendrogram(distances) | ||
|
||
# do agglomerative clustering on the distances | ||
clusters = clusterer.apply_agglomerative_clustering(distances, | ||
n_clusters=5) | ||
|
||
# show the clusters in the output space | ||
x = experiments.copy() | ||
x['clusters'] = clusters.astype('object') | ||
plotting.lines(x, outcomes, group_by='clusters', | ||
density=Density.VIOLIN) | ||
|
||
# show the input space | ||
# sns.pairplot(x, hue='clusters', | ||
# vars=['Initial well productivity per year','Carbon price multiplier', | ||
# 'Initial costs for well development','Operating costs per m3 NG', 'Societal urge to become carbon neutral', | ||
# 'Subsidy provision factor', 'Factor onshore to offshore BoP costs', | ||
# 'Competition constant offshore hydrogen production', 'Platform modification costs', 'Transitioning factor', | ||
# 'Price volatility'], | ||
# plot_kws=dict(s=13)) | ||
plt.show() |