gum.config
:the configuration object for pyAgrum¶
In [1]:
import pyAgrum as gum
print("="*35)
print(gum.config)
print("="*35)
=================================== [core] default_maxnumberofthreads = 24 [notebook] potential_visible_digits = 4 potential_with_colors = True potential_color_0 = #FF7F64 potential_color_1 = #7FFF64 potential_with_fraction = False potential_fraction_limit = 50 potential_fraction_round_error = 1e-6 potential_fraction_with_latex = True histogram_horizontal_visible_digits = 2 histogram_vertical_visible_digits = 2 histogram_horizontal_threshold = 8 histogram_line_threshold = 40 histogram_color = darkseagreen histogram_edge_color = darkgreen histogram_use_percent = True histogram_discretized_visualisation = histogram histogram_discretized_scale = 1.0 histogram_mode = compact histogram_epsilon = 1e-8 potential_parent_values = merge figure_facecolor = #E0E0E0 flow_background_color = transparent flow_border_color = transparent flow_border_width = 0 graph_format = svg show_inference_time = True default_arc_color = #4A4A4A default_node_bgcolor = #404040 default_node_fgcolor = white evidence_bgcolor = sandybrown evidence_fgcolor = black default_node_cmap = Pastel1 default_arc_cmap = BuGn default_edge_cmap = BuGn default_graph_size = 5 default_graph_inference_size = 8 graph_rankdir = TB graph_layout = dot default_markovrandomfield_view = factorgraph junctiontree_graph_size = 10 junctiontree_with_names = True junctiontree_separator_bgcolor = palegreen junctiontree_separator_fgcolor = black junctiontree_separator_fontsize = 8 junctiontree_clique_bgcolor = burlywood junctiontree_clique_fgcolor = black junctiontree_clique_fontsize = 10 junctiontree_map_cliquescale = 0.3 junctiontree_map_sepscale = 0.1 junctiontree_map_edgelen = 1 junctiontree_map_size = 10 graphdiff_missing_style = dashed graphdiff_missing_color = red graphdiff_overflow_style = dashed graphdiff_overflow_color = purple graphdiff_reversed_style = solid graphdiff_reversed_color = purple graphdiff_correct_style = solid graphdiff_correct_color = grey [BN] allow_modification_when_saving = False [factorgraph] default_node_bgcolor = coral default_node_fgcolor = black default_factor_bgcolor = burlywood edge_length = 0.7 edge_length_inference = 0.9 graph_layout = neato [dynamicBN] default_graph_size = 6 [influenceDiagram] default_graph_size = 6 default_chance_bgcolor = #808080 default_chance_fgcolor = white default_utility_bgcolor = #50508A default_utility_fgcolor = white default_decision_bgcolor = #9A5050 default_decision_fgcolor = white chance_shape = ellipse utility_shape = hexagon decision_shape = box decision_arc_style = tapered, bold, dotted utility_arc_style = dashed default_id_size = 6 default_id_inference_size = 6 utility_visible_digits = 2 utility_show_stdev = True utility_show_loss = False [credalnet] default_node_bgcolor = #404040 default_node_fgcolor = white histo_max_color = #BBFFAA [causal] show_latent_names = False latex_do_prefix = \text{do}( latex_do_suffix = ) default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [ROC] draw_color = #008800 fill_color = #AAEEAA [ctbn] show_latent_names = False default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [bnmixture] default_graph_size = 5 default_line_size = 1.0 default_head_size = 0.25 default_arrow_type = normal default_arc_cmap = Greens default_arc_color = #4A4A4A default_arc_style = solid default_node_bgcolor = #404040 default_node_fgcolor = white default_layout = fdp default_overlap = 0 default_bar_capsize = 1.5 default_bar_height = 0.8 default_boot_histo_scale = 2.0 default_histo_scale = 1.0 correct_arc_style = solid correct_arc_color = green incorrect_arc_style = dashed incorrect_arc_color = green left_quantile = 0.2 right_quantile = 0.8 [Pickle] add_version = True add_date = True ===================================
pyagrum.ini
¶
As far as it can be done with Python, gum.config
is a singleton. The configuration is a mix between the defaults (which exactly define the possible section
and property
) and a file pyagrum.ini
(if present in the current folder) that contains only the changed properties.
section
and key
are case insensitive.
config
constantly keeps track of the differences between defaults and actual values :¶
In [2]:
gum.config['dynamicBN','default_graph_size']=10
print("Configuration only for the current session")
print('-'*40)
gum.config.diff()
Configuration only for the current session ---------------------------------------- [dynamicBN] default_graph_size = 10
In [3]:
# if there is a local modification, __repr__ shows only the diff other wise it show all properties
gum.config
Out[3]:
[dynamicBN] default_graph_size = 10
In [4]:
# __str__ shows all the properties
print(gum.config)
[core] default_maxnumberofthreads = 24 [notebook] potential_visible_digits = 4 potential_with_colors = True potential_color_0 = #FF7F64 potential_color_1 = #7FFF64 potential_with_fraction = False potential_fraction_limit = 50 potential_fraction_round_error = 1e-6 potential_fraction_with_latex = True histogram_horizontal_visible_digits = 2 histogram_vertical_visible_digits = 2 histogram_horizontal_threshold = 8 histogram_line_threshold = 40 histogram_color = darkseagreen histogram_edge_color = darkgreen histogram_use_percent = True histogram_discretized_visualisation = histogram histogram_discretized_scale = 1.0 histogram_mode = compact histogram_epsilon = 1e-8 potential_parent_values = merge figure_facecolor = #E0E0E0 flow_background_color = transparent flow_border_color = transparent flow_border_width = 0 graph_format = svg show_inference_time = True default_arc_color = #4A4A4A default_node_bgcolor = #404040 default_node_fgcolor = white evidence_bgcolor = sandybrown evidence_fgcolor = black default_node_cmap = Pastel1 default_arc_cmap = BuGn default_edge_cmap = BuGn default_graph_size = 5 default_graph_inference_size = 8 graph_rankdir = TB graph_layout = dot default_markovrandomfield_view = factorgraph junctiontree_graph_size = 10 junctiontree_with_names = True junctiontree_separator_bgcolor = palegreen junctiontree_separator_fgcolor = black junctiontree_separator_fontsize = 8 junctiontree_clique_bgcolor = burlywood junctiontree_clique_fgcolor = black junctiontree_clique_fontsize = 10 junctiontree_map_cliquescale = 0.3 junctiontree_map_sepscale = 0.1 junctiontree_map_edgelen = 1 junctiontree_map_size = 10 graphdiff_missing_style = dashed graphdiff_missing_color = red graphdiff_overflow_style = dashed graphdiff_overflow_color = purple graphdiff_reversed_style = solid graphdiff_reversed_color = purple graphdiff_correct_style = solid graphdiff_correct_color = grey [BN] allow_modification_when_saving = False [factorgraph] default_node_bgcolor = coral default_node_fgcolor = black default_factor_bgcolor = burlywood edge_length = 0.7 edge_length_inference = 0.9 graph_layout = neato [dynamicBN] default_graph_size = 10 [influenceDiagram] default_graph_size = 6 default_chance_bgcolor = #808080 default_chance_fgcolor = white default_utility_bgcolor = #50508A default_utility_fgcolor = white default_decision_bgcolor = #9A5050 default_decision_fgcolor = white chance_shape = ellipse utility_shape = hexagon decision_shape = box decision_arc_style = tapered, bold, dotted utility_arc_style = dashed default_id_size = 6 default_id_inference_size = 6 utility_visible_digits = 2 utility_show_stdev = True utility_show_loss = False [credalnet] default_node_bgcolor = #404040 default_node_fgcolor = white histo_max_color = #BBFFAA [causal] show_latent_names = False latex_do_prefix = \text{do}( latex_do_suffix = ) default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [ROC] draw_color = #008800 fill_color = #AAEEAA [ctbn] show_latent_names = False default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [bnmixture] default_graph_size = 5 default_line_size = 1.0 default_head_size = 0.25 default_arrow_type = normal default_arc_cmap = Greens default_arc_color = #4A4A4A default_arc_style = solid default_node_bgcolor = #404040 default_node_fgcolor = white default_layout = fdp default_overlap = 0 default_bar_capsize = 1.5 default_bar_height = 0.8 default_boot_histo_scale = 2.0 default_histo_scale = 1.0 correct_arc_style = solid correct_arc_color = green incorrect_arc_style = dashed incorrect_arc_color = green left_quantile = 0.2 right_quantile = 0.8 [Pickle] add_version = True add_date = True
In [5]:
print(gum.config["notebook","evidence_bgcolor"])
print(gum.config.get("notebook","evidence_bgcolor"))
sandybrown sandybrown
Setter¶
In [6]:
gum.config["notebook","evidence_bgcolor"]="papayawhip"
gum.config["causal","default_graph_size"]=1.9
In [7]:
gum.config # once again, only the diff with defaults
Out[7]:
[notebook] evidence_bgcolor = papayawhip [dynamicBN] default_graph_size = 10 [causal] default_graph_size = 1.9
constant structure, mutable content¶
The structure section.key
is fixed by default and readonly : one can only change the value of an existing property
In [8]:
try:
gum.config["AAA","OOO"]=1
except SyntaxError as e:
print("Syntax error : {}".format(e.msg))
Syntax error : Section 'AAA' unknown in pyAgrum configuration.
In [9]:
try:
gum.config["causal","OOO"]=1
except SyntaxError as e:
print("Syntax error : {}".format(e.msg))
Syntax error : Key 'causal,OOO' unknown in pyAgrum configuration.
properties as string¶
All the properties are stored as string !
In [10]:
gum.config["notebook","default_graph_size"]
Out[10]:
'5'
In [11]:
gum.config["notebook","default_graph_size"]=10
gum.config["notebook","default_graph_size"]
Out[11]:
'10'
... but can be typed using asInt, asFloat, asBool¶
In [12]:
gum.config['dynamicBN','default_graph_size']
Out[12]:
'10'
In [13]:
gum.config.asInt['dynamicBN','default_graph_size']
Out[13]:
10
In [14]:
print(type(gum.config['dynamicBN','default_graph_size']))
print(type(gum.config.asInt['dynamicBN','default_graph_size']))
<class 'str'> <class 'int'>
In [15]:
if gum.config["causal","show_latent_names"]=="False":
print("not very convenient test")
if not gum.config.asBool["causal","show_latent_names"]:
print("better test")
not very convenient test better test
Reset, reload, save¶
The configuration can be saved in the current folder (gum.config.save()
).
The configuration can be restored from the default (reset) or the current saved state (reload).
In [16]:
gum.config.reset() # back to defaults
gum.config # no diff => shows all the properties
Out[16]:
# no customized property [core] default_maxnumberofthreads = 24 [notebook] potential_visible_digits = 4 potential_with_colors = True potential_color_0 = #FF7F64 potential_color_1 = #7FFF64 potential_with_fraction = False potential_fraction_limit = 50 potential_fraction_round_error = 1e-6 potential_fraction_with_latex = True histogram_horizontal_visible_digits = 2 histogram_vertical_visible_digits = 2 histogram_horizontal_threshold = 8 histogram_line_threshold = 40 histogram_color = darkseagreen histogram_edge_color = darkgreen histogram_use_percent = True histogram_discretized_visualisation = histogram histogram_discretized_scale = 1.0 histogram_mode = compact histogram_epsilon = 1e-8 potential_parent_values = merge figure_facecolor = #E0E0E0 flow_background_color = transparent flow_border_color = transparent flow_border_width = 0 graph_format = svg show_inference_time = True default_arc_color = #4A4A4A default_node_bgcolor = #404040 default_node_fgcolor = white evidence_bgcolor = sandybrown evidence_fgcolor = black default_node_cmap = Pastel1 default_arc_cmap = BuGn default_edge_cmap = BuGn default_graph_size = 5 default_graph_inference_size = 8 graph_rankdir = TB graph_layout = dot default_markovrandomfield_view = factorgraph junctiontree_graph_size = 10 junctiontree_with_names = True junctiontree_separator_bgcolor = palegreen junctiontree_separator_fgcolor = black junctiontree_separator_fontsize = 8 junctiontree_clique_bgcolor = burlywood junctiontree_clique_fgcolor = black junctiontree_clique_fontsize = 10 junctiontree_map_cliquescale = 0.3 junctiontree_map_sepscale = 0.1 junctiontree_map_edgelen = 1 junctiontree_map_size = 10 graphdiff_missing_style = dashed graphdiff_missing_color = red graphdiff_overflow_style = dashed graphdiff_overflow_color = purple graphdiff_reversed_style = solid graphdiff_reversed_color = purple graphdiff_correct_style = solid graphdiff_correct_color = grey [BN] allow_modification_when_saving = False [factorgraph] default_node_bgcolor = coral default_node_fgcolor = black default_factor_bgcolor = burlywood edge_length = 0.7 edge_length_inference = 0.9 graph_layout = neato [dynamicBN] default_graph_size = 6 [influenceDiagram] default_graph_size = 6 default_chance_bgcolor = #808080 default_chance_fgcolor = white default_utility_bgcolor = #50508A default_utility_fgcolor = white default_decision_bgcolor = #9A5050 default_decision_fgcolor = white chance_shape = ellipse utility_shape = hexagon decision_shape = box decision_arc_style = tapered, bold, dotted utility_arc_style = dashed default_id_size = 6 default_id_inference_size = 6 utility_visible_digits = 2 utility_show_stdev = True utility_show_loss = False [credalnet] default_node_bgcolor = #404040 default_node_fgcolor = white histo_max_color = #BBFFAA [causal] show_latent_names = False latex_do_prefix = \text{do}( latex_do_suffix = ) default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [ROC] draw_color = #008800 fill_color = #AAEEAA [ctbn] show_latent_names = False default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [bnmixture] default_graph_size = 5 default_line_size = 1.0 default_head_size = 0.25 default_arrow_type = normal default_arc_cmap = Greens default_arc_color = #4A4A4A default_arc_style = solid default_node_bgcolor = #404040 default_node_fgcolor = white default_layout = fdp default_overlap = 0 default_bar_capsize = 1.5 default_bar_height = 0.8 default_boot_histo_scale = 2.0 default_histo_scale = 1.0 correct_arc_style = solid correct_arc_color = green incorrect_arc_style = dashed incorrect_arc_color = green left_quantile = 0.2 right_quantile = 0.8 [Pickle] add_version = True add_date = True
In [17]:
try:
gum.config.load() # reload pyagrum.ini
except FileNotFoundError:
pass # no pyagrum.ini in the folder
gum.config
Out[17]:
# no customized property [core] default_maxnumberofthreads = 24 [notebook] potential_visible_digits = 4 potential_with_colors = True potential_color_0 = #FF7F64 potential_color_1 = #7FFF64 potential_with_fraction = False potential_fraction_limit = 50 potential_fraction_round_error = 1e-6 potential_fraction_with_latex = True histogram_horizontal_visible_digits = 2 histogram_vertical_visible_digits = 2 histogram_horizontal_threshold = 8 histogram_line_threshold = 40 histogram_color = darkseagreen histogram_edge_color = darkgreen histogram_use_percent = True histogram_discretized_visualisation = histogram histogram_discretized_scale = 1.0 histogram_mode = compact histogram_epsilon = 1e-8 potential_parent_values = merge figure_facecolor = #E0E0E0 flow_background_color = transparent flow_border_color = transparent flow_border_width = 0 graph_format = svg show_inference_time = True default_arc_color = #4A4A4A default_node_bgcolor = #404040 default_node_fgcolor = white evidence_bgcolor = sandybrown evidence_fgcolor = black default_node_cmap = Pastel1 default_arc_cmap = BuGn default_edge_cmap = BuGn default_graph_size = 5 default_graph_inference_size = 8 graph_rankdir = TB graph_layout = dot default_markovrandomfield_view = factorgraph junctiontree_graph_size = 10 junctiontree_with_names = True junctiontree_separator_bgcolor = palegreen junctiontree_separator_fgcolor = black junctiontree_separator_fontsize = 8 junctiontree_clique_bgcolor = burlywood junctiontree_clique_fgcolor = black junctiontree_clique_fontsize = 10 junctiontree_map_cliquescale = 0.3 junctiontree_map_sepscale = 0.1 junctiontree_map_edgelen = 1 junctiontree_map_size = 10 graphdiff_missing_style = dashed graphdiff_missing_color = red graphdiff_overflow_style = dashed graphdiff_overflow_color = purple graphdiff_reversed_style = solid graphdiff_reversed_color = purple graphdiff_correct_style = solid graphdiff_correct_color = grey [BN] allow_modification_when_saving = False [factorgraph] default_node_bgcolor = coral default_node_fgcolor = black default_factor_bgcolor = burlywood edge_length = 0.7 edge_length_inference = 0.9 graph_layout = neato [dynamicBN] default_graph_size = 6 [influenceDiagram] default_graph_size = 6 default_chance_bgcolor = #808080 default_chance_fgcolor = white default_utility_bgcolor = #50508A default_utility_fgcolor = white default_decision_bgcolor = #9A5050 default_decision_fgcolor = white chance_shape = ellipse utility_shape = hexagon decision_shape = box decision_arc_style = tapered, bold, dotted utility_arc_style = dashed default_id_size = 6 default_id_inference_size = 6 utility_visible_digits = 2 utility_show_stdev = True utility_show_loss = False [credalnet] default_node_bgcolor = #404040 default_node_fgcolor = white histo_max_color = #BBFFAA [causal] show_latent_names = False latex_do_prefix = \text{do}( latex_do_suffix = ) default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [ROC] draw_color = #008800 fill_color = #AAEEAA [ctbn] show_latent_names = False default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [bnmixture] default_graph_size = 5 default_line_size = 1.0 default_head_size = 0.25 default_arrow_type = normal default_arc_cmap = Greens default_arc_color = #4A4A4A default_arc_style = solid default_node_bgcolor = #404040 default_node_fgcolor = white default_layout = fdp default_overlap = 0 default_bar_capsize = 1.5 default_bar_height = 0.8 default_boot_histo_scale = 2.0 default_histo_scale = 1.0 correct_arc_style = solid correct_arc_color = green incorrect_arc_style = dashed incorrect_arc_color = green left_quantile = 0.2 right_quantile = 0.8 [Pickle] add_version = True add_date = True
Using configuration¶
In [18]:
import pyAgrum.lib.notebook as gnb
bn=gum.fastBN("D->C<-A->B[4];A->E")
bn.cpt("B")
Out[18]:
|
|
|
| |
---|---|---|---|---|
0.0956 | 0.1359 | 0.2205 | 0.5479 | |
0.4200 | 0.2845 | 0.2424 | 0.0531 |
In [19]:
gum.config["notebook","potential_visible_digits"]=1
bn.cpt("B")
Out[19]:
|
|
|
| |
---|---|---|---|---|
0.1 | 0.1 | 0.2 | 0.5 | |
0.4 | 0.3 | 0.2 | 0.1 |
In [20]:
gum.config['notebook', 'potential_color_0']="#AA00AA"
gum.config['notebook', 'potential_color_1']="#00FFAA"
bn.cpt("B")
Out[20]:
|
|
|
| |
---|---|---|---|---|
0.1 | 0.1 | 0.2 | 0.5 | |
0.4 | 0.3 | 0.2 | 0.1 |
In [21]:
gum.config["notebook","potential_visible_digits"]=4
gnb.flow.add(bn.cpt("B"),"Ugly float")
gum.config["notebook","potential_visible_digits"]=1
gnb.flow.add(bn.cpt("B"),"Ugly 1digit-float")
gum.config['notebook', 'potential_with_fraction']=True
gum.config['notebook', 'potential_fraction_with_latex']=False
gum.config['notebook', 'potential_fraction_limit']=2000
gnb.flow.add(bn.cpt("B"),"Simple fraction")
gum.config['notebook', 'potential_fraction_with_latex']=True
gnb.flow.add(bn.cpt("B"),"Sophisticated fraction with LaTeX")
gnb.flow.display()
|
|
|
| |
---|---|---|---|---|
0.0956 | 0.1359 | 0.2205 | 0.5479 | |
0.4200 | 0.2845 | 0.2424 | 0.0531 |
|
|
|
| |
---|---|---|---|---|
0.1 | 0.1 | 0.2 | 0.5 | |
0.4 | 0.3 | 0.2 | 0.1 |
|
|
|
| |
---|---|---|---|---|
79/826 | 187/1376 | 73/331 | 709/1294 | |
633/1507 | 369/1297 | 127/524 | 79/1488 |
|
|
|
| |
---|---|---|---|---|
$$\frac{79}{826}$$ | $$\frac{187}{1376}$$ | $$\frac{73}{331}$$ | $$\frac{709}{1294}$$ | |
$$\frac{633}{1507}$$ | $$\frac{369}{1297}$$ | $$\frac{127}{524}$$ | $$\frac{79}{1488}$$ |
In [22]:
gnb.sideBySide(bn,gnb.getInference(bn,evs={"A":1},targets={"B"}))
In [23]:
gum.config["notebook","evidence_bgcolor"]="green"
gum.config["notebook","default_node_bgcolor"]="yellow"
gum.config["notebook","default_node_fgcolor"]="red"
gnb.sideBySide(bn,gnb.getInference(bn,evs={"A":1},targets={"B"}))
In [24]:
gum.config["notebook","default_graph_size"]=1
gnb.sideBySide(bn,gnb.getInference(bn,evs={"A":1},targets={"B"}))
In [25]:
gum.config["notebook","default_graph_inference_size"]="1"
gnb.sideBySide(bn,gnb.getInference(bn,evs={"A":1},targets={"B"}))
Finding a specific property¶
In [26]:
#find anything containing arc
gum.config.grep("arc")
[notebook] default_arc_color = #4A4A4A default_arc_cmap = BuGn [influenceDiagram] decision_arc_style = tapered, bold, dotted utility_arc_style = dashed [bnmixture] default_arc_cmap = Greens default_arc_color = #4A4A4A default_arc_style = solid correct_arc_style = solid correct_arc_color = green incorrect_arc_style = dashed incorrect_arc_color = green
In [27]:
#find anything containing default
gum.config.grep("default")
[core] default_maxnumberofthreads = 24 [notebook] default_arc_color = #4A4A4A default_node_bgcolor = yellow default_node_fgcolor = red default_node_cmap = Pastel1 default_arc_cmap = BuGn default_edge_cmap = BuGn default_graph_size = 1 default_graph_inference_size = 1 default_markovrandomfield_view = factorgraph [factorgraph] default_node_bgcolor = coral default_node_fgcolor = black default_factor_bgcolor = burlywood [dynamicBN] default_graph_size = 6 [influenceDiagram] default_graph_size = 6 default_chance_bgcolor = #808080 default_chance_fgcolor = white default_utility_bgcolor = #50508A default_utility_fgcolor = white default_decision_bgcolor = #9A5050 default_decision_fgcolor = white default_id_size = 6 default_id_inference_size = 6 [credalnet] default_node_bgcolor = #404040 default_node_fgcolor = white [causal] default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [ctbn] default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black [bnmixture] default_graph_size = 5 default_line_size = 1.0 default_head_size = 0.25 default_arrow_type = normal default_arc_cmap = Greens default_arc_color = #4A4A4A default_arc_style = solid default_node_bgcolor = #404040 default_node_fgcolor = white default_layout = fdp default_overlap = 0 default_bar_capsize = 1.5 default_bar_height = 0.8 default_boot_histo_scale = 2.0 default_histo_scale = 1.0
In [28]:
# if a section contains the search, all its properties are shown
gum.config.grep("caus")
[causal] show_latent_names = False latex_do_prefix = \text{do}( latex_do_suffix = ) default_graph_size = 2.5 default_node_bgcolor = #404040 default_node_fgcolor = white default_latent_bgcolor = #A08080 default_latent_fgcolor = black
Saving current configuration in pyagrum.ini
¶
In [29]:
gum.config.reset() # back to defaults
gum.config['notebook','default_arc_color'] = "#AAAAAA"
gum.config['notebook','evidence_bgcolor'] = "green"
gum.config.save() # store curent changes
In [30]:
gum.config.reset() # back to defaults
gum.config.save() # store defaults back
From PyAgrumConfiguration to ConfigParser¶
In [31]:
from configparser import ConfigParser
c=ConfigParser()
gum.config['notebook','default_arc_color'] = "#AAAAAA"
gum.config['notebook','evidence_bgcolor'] = "green"
c.read_string(gum.config.__repr__())
print(c.sections())
['notebook']