Numpy Implementation#
NumpyReflectiveEquilibrium#
- class rethon.NumpyReflectiveEquilibrium#
Bases:
StandardReflectiveEquilibrium
Methods
account
(commitments, theory)Account of the theory w.r.t.
achievement
(commitments, theory, ...)The achievement function \(Z\).
commitment_candidates
([time])Commitment candidates for choosing next commitments.
default_model_parameters
()Default model parameters of the standard model.
dialectical_structure
()Return the dialectical structure on which the model is based.
faithfulness
(commitments, initial_commitments)Faithfulness of the commitments w.r.t.
finished
(**kwargs)Implements
ReflectiveEquilibrium.finished()
.hamming_distance
(position1, position2, penalties)The weighted Hamming distance.
is_dirty
()Checks whether the model demand an update of internal attributes.
model_name
()Model name.
model_parameter
(name)Returns model parameters by names.
model_parameter_names
()Returns names (keys) of the model parameters.
model_parameters
()Getting all model parameters as dict.
model_parameters_set_to_default
()Resets the model parameters to their default values.
next_step
([time])Triggers search for next commitments/theory.
penalty
(pos1, pos2, sentence, penalties)A penalty function.
pick_commitment_candidate
(...)Implements :py:func:ReflectiveEquilibrium.pick_commitment_candidate.
pick_theory_candidate
(theory_candidates, ...)Implements :py:func:ReflectiveEquilibrium.pick_theory_candidate.
re_process
([initial_commitments, max_steps])Process of finding a reflective equilibrium based on given initial commitments.
reset_model_parameters
(parameters)Resetting model parameters.
set_dialectical_structure
(dialectical_structure)Set the dialectical structure on which the model is based.
set_dirty
(dirty)Should be used to indicate whether attributes are reset that demand updating other attributes of the model.
set_initial_state
(initial_commitments)Set the initial state of the model.
set_model_parameters
([parameters])Setting model parameters either by a dictionary or key-value pairs.
set_state
(state)Setting the current state of the model.
state
()Getting the current state of the model as
REState
.systematicity
(theory)Systematicity of the theory.
theory_candidates
([time])Theory candidates for choosing the next theory.
update
(**kwargs)Subclasses can extend/override this method to update internal attributes of the model.
get_id
set_id
- hamming_distance(position1, position2, penalties)#
The weighted Hamming distance.
A weighted (asymmetric) Hamming Distance \(D\) between two positions \(\mathcal{A}\) and \(\mathcal{B}\) which is defined by
\[D_{d_0,d_1,d_2,d_3}(\mathcal{A}, \mathcal{B}):= \sum_{\{s,\neg s\} \subset S} d_{{d_0,d_1,d_2,d_3}}(\mathcal{A}, \mathcal{B}, \{s,\neg s\})\]and based on the
penalty()
-function.- Parameters:
position1 (
Position
) –position2 (
Position
) –penalties – A float-list of penalty values for the
penalty()
-function.
- Return type:
float
- Returns:
- penalty(pos1, pos2, sentence, penalties)#
A penalty function.
The penalty function calculates a penalty value for two sentences of two positions given a list of penalty-value and is defined by
\[\begin{split}d_{{d_0,d_1,d_2,d_3}}(\mathcal{A}, \mathcal{B}, \{s,\neg s\}):= \begin{cases} d_3 \text{ if } \{s,\neg s\}\subset(\mathcal{A}\cup \mathcal{B}), \\ d_2 \text{ if } \{s,\neg s\}\cap \mathcal{A} \neq \emptyset \text{ and } \{s,\neg s\}\cap \mathcal{B} = \emptyset, \\ d_3 \text{ if } \{s,\neg s\}\cap \mathcal{A} = \emptyset \text{ and } \{s,\neg s\}\cap \mathcal{B} \neq \emptyset, \\ d_0 \text{ otherwise.}\end{cases}\end{split}\]- Parameters:
position1 –
position2 –
sentence (
int
) – The index of the sentences with both positions.penalties (
List
[float
]) – A float-list of penalty values.pos1 (Position) –
pos2 (Position) –
- Return type:
float
- Returns:
GlobalNumpyReflectiveEquilibrium#
- class rethon.GlobalNumpyReflectiveEquilibrium#
Bases:
GlobalReflectiveEquilibrium
,NumpyReflectiveEquilibrium
Methods
account
(commitments, theory)Account of the theory w.r.t.
achievement
(commitments, theory, ...)The achievement function \(Z\).
commitment_candidates
(**kwargs)Implements
basics.ReflectiveEquilibrium.commitment_candidates()
default_model_parameters
()Default model parameters of the standard model.
dialectical_structure
()Return the dialectical structure on which the model is based.
faithfulness
(commitments, initial_commitments)Faithfulness of the commitments w.r.t.
finished
(**kwargs)Implements
ReflectiveEquilibrium.finished()
.global_optima
(initial_commitments)Searches for globally optimal theory-commitment pairs (according to the achievement function).
hamming_distance
(position1, position2, penalties)The weighted Hamming distance.
is_dirty
()Checks whether the model demand an update of internal attributes.
model_name
()Model name.
model_parameter
(name)Returns model parameters by names.
model_parameter_names
()Returns names (keys) of the model parameters.
model_parameters
()Getting all model parameters as dict.
model_parameters_set_to_default
()Resets the model parameters to their default values.
next_step
([time])Triggers search for next commitments/theory.
penalty
(pos1, pos2, sentence, penalties)A penalty function.
pick_commitment_candidate
(...)Implements :py:func:ReflectiveEquilibrium.pick_commitment_candidate.
pick_theory_candidate
(theory_candidates, ...)Implements :py:func:ReflectiveEquilibrium.pick_theory_candidate.
re_process
([initial_commitments, max_steps])Process of finding a reflective equilibrium based on given initial commitments.
reset_model_parameters
(parameters)Resetting model parameters.
set_dialectical_structure
(dialectical_structure)Set the dialectical structure on which the model is based.
set_dirty
(dirty)Should be used to indicate whether attributes are reset that demand updating other attributes of the model.
set_initial_state
(initial_commitments)Set the initial state of the model.
set_model_parameters
([parameters])Setting model parameters either by a dictionary or key-value pairs.
set_state
(state)Setting the current state of the model.
state
()Getting the current state of the model as
REState
.systematicity
(theory)Systematicity of the theory.
theory_candidates
(**kwargs)Implements
basics.ReflectiveEquilibrium.theory_candidates()
update
(**kwargs)Implements
basics.ReflectiveEquilibrium.update()
get_id
set_id
- __init__(dialectical_structure=None, initial_commitments=None, model_name='GlobalNumpyReflectiveEquilibrium')#
- Parameters:
dialectical_structure (DialecticalStructure | None) –
initial_commitments (Position | None) –
LocalNumpyReflectiveEquilibrium#
- class rethon.LocalNumpyReflectiveEquilibrium#
Bases:
LocalReflectiveEquilibrium
,NumpyReflectiveEquilibrium
Numpy implementation of a locally searching RE process.
Methods
account
(commitments, theory)Account of the theory w.r.t.
achievement
(commitments, theory, ...)The achievement function \(Z\).
commitment_candidates
(**kwargs)Implements
basics.ReflectiveEquilibrium.commitment_candidates()
default_model_parameters
()Default model parameters of the standard model.
dialectical_structure
()Return the dialectical structure on which the model is based.
faithfulness
(commitments, initial_commitments)Faithfulness of the commitments w.r.t.
finished
(**kwargs)Implements
ReflectiveEquilibrium.finished()
.Choose an initial theory in the neighbourhood of the empty position.
hamming_distance
(position1, position2, penalties)The weighted Hamming distance.
is_dirty
()Checks whether the model demand an update of internal attributes.
model_name
()Model name.
model_parameter
(name)Returns model parameters by names.
model_parameter_names
()Returns names (keys) of the model parameters.
model_parameters
()Getting all model parameters as dict.
model_parameters_set_to_default
()Resets the model parameters to their default values.
next_step
([time])Triggers search for next commitments/theory.
penalty
(pos1, pos2, sentence, penalties)A penalty function.
pick_commitment_candidate
(...)Implements :py:func:ReflectiveEquilibrium.pick_commitment_candidate.
pick_theory_candidate
(theory_candidates, ...)Implements :py:func:ReflectiveEquilibrium.pick_theory_candidate.
re_process
([initial_commitments, max_steps])Process of finding a reflective equilibrium based on given initial commitments.
reset_model_parameters
(parameters)Resetting model parameters.
set_dialectical_structure
(dialectical_structure)Set the dialectical structure on which the model is based.
set_dirty
(dirty)Should be used to indicate whether attributes are reset that demand updating other attributes of the model.
set_initial_state
(initial_commitments)Set the initial state of the model.
set_model_parameters
([parameters])Setting model parameters either by a dictionary or key-value pairs.
set_state
(state)Setting the current state of the model.
state
()Getting the current state of the model as
REState
.systematicity
(theory)Systematicity of the theory.
theory_candidates
(**kwargs)Implements
basics.ReflectiveEquilibrium.theory_candidates()
update
(**kwargs)Subclasses can extend/override this method to update internal attributes of the model.
get_id
set_id
- first_theory()#
Choose an initial theory in the neighbourhood of the empty position.
- Return type:
Position