socialchoicekit.data_generation module
- class socialchoicekit.data_generation.BaseValuationProfileGenerator(seed: int | None = None)[source]
Bases:
object
The abstract cardinal utility generator. This class should not be instantiated directly.
The data generator assumes that the utilities are generated for the normalized social choice setting.
Parameters
- seed: Union[int, None]
The seed for the random number generator. If None, the random number generator will not be seeded.
- generate(profile: Profile) → ValuationProfile[source]
Generates a cardinal profile based on the inputted ordinal profile.
Parameters
- profile: StrictProfile
A (N, M) array, where N is the number of agents and M is the number of alternatives. The element at (i, j) indicates the agent’s ordinal utility for alternative j, where 1 is the most preferred alternative and M is the least preferred alternative. If the agent finds an item or alternative unacceptable, the element would be np.nan.
Returns
- ValuationProfile
A (N, M) array, where N is the number of agents and M is the number of alternatives. The element at (i, j) indicates the agent’s cardinal utility for alternative j. If the agent finds an item or alternative unacceptable, the element would be np.nan.
- class socialchoicekit.data_generation.NormalValuationProfileGenerator(mean: float, variance: float, seed: int | None = None)[source]
Bases:
BaseValuationProfileGenerator
A simple data generator that first generates a valuation profile (cardinal utilities) based on a normal probability distribution, and assigns the normalized generated utilities to alternatives based on the inputted profile (ordinal utilities).
Parameters
- mean: float
The mean of the normal distribution. 0.5 by default.
- varaince: float
The variance of the normal distribution. 0.2 by default. Any generated values below 0 will be clipped to 0.
- seed: Union[int, None]
The seed for the random number generator. If None, the random number generator will not be seeded.
- generate(profile: StrictProfile) → ValuationProfile[source]
Generates a cardinal profile based on the inputted ordinal profile.
Parameters
- profile: StrictProfile
A (N, M) array, where N is the number of agents and M is the number of alternatives. The element at (i, j) indicates the agent’s ordinal utility for alternative j, where 1 is the most preferred alternative and M is the least preferred alternative. If the agent finds an item or alternative unacceptable, the element would be np.nan.
Returns
- ValuationProfile
A (N, M) array, where N is the number of agents and M is the number of alternatives. The element at (i, j) indicates the agent’s cardinal utility for alternative j. If the agent finds an item or alternative unacceptable, the element would be np.nan.
- class socialchoicekit.data_generation.UniformValuationProfileGenerator(high: float, low: float, seed: int | None = None)[source]
Bases:
BaseValuationProfileGenerator
A simple data generator that first generates a valuation profile (cardinal utilities) based on a uniform probability distribution, and assigns the normalized generated utilities to alternatives based on the inputted profile (ordinal utilities).
Parameters
- high: float
The upper bound of the uniform distribution. 1 by default. Must be positive.
- low: float
The lower bound of the uniform distribution. 0 by default. Must be positive.
- seed: Union[int, None]
The seed for the random number generator. If None, the random number generator will not be seeded.
- generate(profile: StrictProfile) → ValuationProfile[source]
Generates a cardinal profile based on the inputted ordinal profile.
Parameters
- profile: StrictProfile
A (N, M) array, where N is the number of agents and M is the number of alternatives. The element at (i, j) indicates the agent’s ordinal utility for alternative j, where 1 is the most preferred alternative and M is the least preferred alternative. If the agent finds an item or alternative unacceptable, the element would be np.nan.
Returns
- ValuationProfile
A (N, M) array, where N is the number of agents and M is the number of alternatives. The element at (i, j) indicates the agent’s cardinal utility for alternative j. If the agent finds an item or alternative unacceptable, the element would be np.nan.