import numpy as np
import torch
import math
GUESS = 0.25
def main():
ability = 1
difficulty = 0.5
p = irt(ability, difficulty)
correct = 1 if np.random.uniform(0, 1) < p else 0
print(p, correct)
def irt(ability, difficulty):
diff = ability - difficulty
p = 1 / (1 + math.exp(-diff))
return GUESS + (1 - GUESS) * p
if __name__ == '__main__':
main()