ChainScoreData
The purpose of the ChainScoreData
object is reflected in its name: its purpose is to store data about the values of scores throughout the entire history of the Markov chain. You can think of it as containing an Array
of Dict
objects, where each element in the array is a Dict
that corresponds to one state of the chain. In turn, each Dict
contains keys for every AbstractScore
passed to the chain by the user, and the values of the Dict
are the values of the scoring functions, evaluated on a particular plan in the chain.
get_scores_at_step()
GerryChain.get_scores_at_step
— Functionget_scores_at_step(chain_data::ChainScoreData,
step::Int;
score_names::Array{String,1}=String[])::Dict{String, Any}
Returns the detailed scores of the partition at step step
. If no scores are passed in, all scores are returned by default. Here, step=0 represents the score of the original (initial) partition, so step=t will return the scores of the plan that was produced after taking t steps of the Markov chain.
Arguments:
- chain_data : ChainScoreData object containing scores of partitions at each step of the Markov Chain
- step : The step of the chain at which scores are desired
- score_names : An optional array of Strings representing the scores for which the user is requesting the values
recom_chain
or flip_chain
returns a ChainScoreData
object. If you want to know what the values of any/all scores were at a particular step in the chain, use get_scores_at_step
. This will return a Dict{String, Any}
from the name of the score to its value at step step
. If no scores are passed in, all scores are returned by default. Here, step=0
represents the score of the original (initial) partition, so step=t
will return the scores of the plan that was produced after taking t
steps of the Markov chain.
Running get_scores_at_step()
for different score types would get you different kinds of return values:
- Running
get_scores_at_step(chain_data, step, "name_of_district_aggregate_score")
would return anArray
of lengthd
, whered
is the number of districts. - Running
get_scores_at_step(chain_data, step, "name_of_district_score")
would return anArray
of lengthd
, whered
is the number of districts. - Running
get_scores_at_step(chain_data, step, "name_of_plan_score")
would return a single value, representing the value of thePlanScore
for the plan at stepstep
.
get_score_values()
GerryChain.get_score_values
— Methodget_score_values(chain_data::ChainScoreData,
score_name::String)
Returns the value of specified score at every step of the chain.
Arguments:
- chain_data : ChainScoreData object containing scores of partitions at each step of the Markov Chain
- score_name : Name of the score of interest
If you want to query the ChainScoreData
for all values of a particular score throughout the history of the chain, use get_score_values
. It will return an array of values where each element of the array corresponds to the value of the score at step i
of the chain.