transcripty.data package¶
Submodules¶
transcripty.data.calibration module¶
-
transcripty.data.calibration.
CPMobjective
(params, target)¶ Used as objective function in calibrateCPM
- Parameters
params (np.array((2,), float64)) – An array of the parameters ordered according to CPMParams
target (CalibrationTargets) – The calibration targets
- Returns
score – The score associated with a particular parameter set
- Return type
float64
-
transcripty.data.calibration.
HPMobjective
(params, target)¶ Used as objective function in calibrateHPM
- Parameters
params (np.array((4,), float64)) – An array of the parameters ordered according to HPMParams
target (CalibrationTargets) – The calibration targets
- Returns
score – The score associated with a particular parameter set
- Return type
float64
-
transcripty.data.calibration.
calibrateCPM
(target=<transcripty.data.targets.CalibrationTargets object>, nevals=500)¶ Searches the parameter space to find the set of parameters that provide the best fit to our calibration targets
- Parameters
target (CalibrationTargets) – The calibration targets
- Returns
parameters – The parameters found by the optimization algorithm
- Return type
dict
-
transcripty.data.calibration.
calibrateHPM
(target=<transcripty.data.targets.CalibrationTargets object>, nevals=500)¶ Searches the parameter space to find the set of parameters that provide the best fit to our calibration targets
- Parameters
target (CalibrationTargets) – The calibration targets
- Returns
parameters – The parameters found by the optimization algorithm
- Return type
dict
transcripty.data.targets module¶
This file contains the calibration targets that we will use to find the “optimal” parameters for the model
-
class
transcripty.data.targets.
CPMParams
(p, sigma)¶ Bases:
tuple
-
property
p
¶ Alias for field number 0
-
property
sigma
¶ Alias for field number 1
-
property
-
class
transcripty.data.targets.
CalibrationTargets
(credit_corr, y2_deciles)¶ Bases:
object
This holds the calibration targets used for calibrating the model
- Parameters
credit_corr (float64) – The correlation between the credits earned in years 1 and 2
y2_deciles_by_quartile (np.array((9, 5), float64)) – The 20/50/80 percent quantiles of total credits earned after two years for each gpa quartile
-
See parameters
-
compare_results
(gpa, credits, corrmult=25.0, normalize=False)¶ Compares the credit simulation results with the calibration targets
- Parameters
gpa (np.array((N,), float64)) – A simulation of gpa of N individuals
credits (np.array((N, T_c), float64)) – A simulation of credits earned by N individuals over T_c periods
corrmult (float64, optional(25.0)) – A multiplier used to scale the importance of the correlation between years 1 and 2
normalize (bool, optional(false)) – If normalize is true then computes the percent difference in targets rather than absolute differences
- Returns
diff – The ‘score’ of a particular simulation. The higher the score, the less we believe the parameters that generated the score
- Return type
float64