Initialization Methods – catsim.initialization

All implemented classes in this module inherit from a base abstract class Initializer. Simulator allows that a custom initializer be used during the simulation, as long as it also inherits from Initializer.

Inheritance diagram of catsim.initialization
class catsim.initialization.FixedPointInitializer(start: float)[source]

Bases: Initializer

Initialize every examinee’s ability at the same fixed point.

This initializer is useful for controlled experiments where you want all examinees to start with the same initial ability estimate.

Parameters:
startfloat

The starting ability value for every examinee.

initialize(index: int | None = None, **kwargs: Any) float[source]

Return the same ability value that was passed to the constructor.

Parameters:
indexint or None, optional

The index of the current examinee. This parameter is not used by this method. Default is None.

**kwargsdict

Additional keyword arguments. Not used by this method.

Returns:
float

The fixed ability value that was passed to the constructor.

class catsim.initialization.InitializationDistribution(*values)[source]

Bases: Enum

Distribution to use for ability estimate initialization.

Attributes:
UNIFORMstr

Uniform distribution for initialization.

NORMALstr

Normal (Gaussian) distribution for initialization.

class catsim.initialization.RandomInitializer(dist_type: InitializationDistribution = InitializationDistribution.UNIFORM, dist_params: tuple = (-5, 5))[source]

Bases: Initializer

Randomly initialize the first estimate of an examinee’s ability from a statistical distribution.

Parameters:
dist_typeInitializationDistribution, optional

Distribution type to use for initialization (uniform or normal). Default is UNIFORM.

dist_paramstuple, optional

Distribution parameters: - For uniform: tuple of (min, max) values (order doesn’t matter) - For normal: tuple of (mean, std) values (in this exact order) Default is (-5, 5).

initialize(index: int | None = None, **kwargs: Any) float[source]

Generate an initial ability value using the chosen distribution and parameters.

Parameters:
indexint or None, optional

The index of the current examinee. This parameter is not used by this method. Default is None.

**kwargsdict

Additional keyword arguments.

  • rng (numpy.random.Generator): Random number generator used by the object, guarantees reproducibility of outputs.

Returns:
float

An ability value generated from the chosen distribution using the specified parameters.

Raises:
RuntimeError

If an invalid distribution type is encountered (should not happen after validation in __init__).