Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | /** * Per-Skill Deficiency Profile Generator * * Creates 32 student profiles - one for each abacus skill being deficient. * Each profile has: * - All PREREQUISITE skills at high exposure (mastered) * - The TARGET skill at 0 exposure (deficient) * - The practicingSkills list includes all prerequisites + target skill * * This enables fair A/B comparison where: * - Same student model (Hill function parameters) * - Different deficient skill * - BKT should identify the specific deficient skill * - Adaptive mode should target and improve it faster than classic */ import type { StudentProfile } from '../types' /** * Order of skills in curriculum progression */ const SKILL_ORDER = [ // Basic addition 'basic.directAddition', 'basic.heavenBead', 'basic.simpleCombinations', // Basic subtraction 'basic.directSubtraction', 'basic.heavenBeadSubtraction', 'basic.simpleCombinationsSub', // Five complements addition 'fiveComplements.4=5-1', 'fiveComplements.3=5-2', 'fiveComplements.2=5-3', 'fiveComplements.1=5-4', // Five complements subtraction 'fiveComplementsSub.-4=-5+1', 'fiveComplementsSub.-3=-5+2', 'fiveComplementsSub.-2=-5+3', 'fiveComplementsSub.-1=-5+4', // Ten complements addition 'tenComplements.9=10-1', 'tenComplements.8=10-2', 'tenComplements.7=10-3', 'tenComplements.6=10-4', 'tenComplements.5=10-5', 'tenComplements.4=10-6', 'tenComplements.3=10-7', 'tenComplements.2=10-8', 'tenComplements.1=10-9', // Ten complements subtraction 'tenComplementsSub.-9=+1-10', 'tenComplementsSub.-8=+2-10', 'tenComplementsSub.-7=+3-10', 'tenComplementsSub.-6=+4-10', 'tenComplementsSub.-5=+5-10', 'tenComplementsSub.-4=+6-10', 'tenComplementsSub.-3=+7-10', 'tenComplementsSub.-2=+8-10', 'tenComplementsSub.-1=+9-10', ] as const /** * Learner type configurations. * * Each learner type has different Hill function parameters: * - K (halfMaxExposure): Exposures needed for 50% mastery * - n (hillCoefficient): Curve steepness (higher = more delayed onset, then steeper) * - masteredExposure: Exposures needed for ~90% mastery * * CALIBRATION NOTES: * - With ~26 problems/session and 12 sessions, that's ~312 total problems * - A skill getting 1/10 of problems = ~30 exposures over 12 sessions * - We want learning to develop GRADUALLY over many sessions * - Fast learners should reach 80% around session 6-8 * - Slow learners should still be improving at session 12 * * Hill function: P(correct) = exposure^n / (K^n + exposure^n) */ export const LEARNER_TYPES = { fast: { name: 'Fast Learner', halfMaxExposure: 25, hillCoefficient: 2.0, /** * With K=25, n=2.0: * - 10 exposures → 14% (still struggling) * - 25 exposures → 50% (halfway) * - 50 exposures → 80% (proficient) * - 75 exposures → 90% (mastered) */ masteredExposure: 75, helpUsageProbabilities: [0.7, 0.3] as [number, number], helpBonuses: [0, 0.12] as [number, number], baseResponseTimeMs: 4000, responseTimeVariance: 0.25, }, average: { name: 'Average Learner', halfMaxExposure: 40, hillCoefficient: 2.5, /** * With K=40, n=2.5: * - 15 exposures → 5% (struggling) * - 30 exposures → 27% (starting to get it) * - 40 exposures → 50% (halfway) * - 80 exposures → 84% (proficient) * - 120 exposures → 94% (mastered) */ masteredExposure: 120, helpUsageProbabilities: [0.55, 0.45] as [number, number], helpBonuses: [0, 0.15] as [number, number], baseResponseTimeMs: 5500, responseTimeVariance: 0.35, }, slow: { name: 'Slow Learner', halfMaxExposure: 60, hillCoefficient: 3.0, /** * With K=60, n=3.0: * - 20 exposures → 4% (struggling) * - 40 exposures → 23% (slow progress) * - 60 exposures → 50% (halfway) * - 100 exposures → 82% (proficient) * - 150 exposures → 94% (mastered) */ masteredExposure: 150, helpUsageProbabilities: [0.4, 0.6] as [number, number], helpBonuses: [0, 0.2] as [number, number], baseResponseTimeMs: 7000, responseTimeVariance: 0.4, }, } as const export type LearnerType = keyof typeof LEARNER_TYPES const DEFAULT_LEARNER_TYPE: LearnerType = 'average' /** * Generate a student profile deficient in a specific skill. * * @param deficientSkillId - The skill ID that will be at 0 exposure * @param learnerType - Type of learner (fast, average, slow) */ export function generateDeficientProfile( deficientSkillId: string, learnerType: LearnerType = DEFAULT_LEARNER_TYPE ): StudentProfile { const config = LEARNER_TYPES[learnerType] // Find the index of the deficient skill in SKILL_ORDER const deficientIndex = SKILL_ORDER.indexOf(deficientSkillId as (typeof SKILL_ORDER)[number]) if (deficientIndex === -1) { throw new Error(`Unknown skill ID: ${deficientSkillId}. Must be one of SKILL_ORDER.`) } // Build initial exposures: // - All skills BEFORE deficientIndex: high exposure (mastered) // - The deficient skill itself: 0 exposure // - All skills AFTER deficientIndex: 0 exposure (not yet learned) const initialExposures: Record<string, number> = {} for (let i = 0; i < SKILL_ORDER.length; i++) { const skillId = SKILL_ORDER[i] if (i < deficientIndex) { // Prerequisite skill - mastered initialExposures[skillId] = config.masteredExposure } else if (i === deficientIndex) { // Deficient skill - 0 exposure initialExposures[skillId] = 0 } else { // Future skill - not yet learned (0 exposure) // These won't be in practicingSkills anyway initialExposures[skillId] = 0 } } // Human-readable skill name for profile description const skillName = getSkillDisplayName(deficientSkillId) return { name: `${config.name} - Deficient: ${skillName}`, description: `${config.name} proficient in all prerequisites, but deficient in ${skillName}`, halfMaxExposure: config.halfMaxExposure, hillCoefficient: config.hillCoefficient, initialExposures, helpUsageProbabilities: config.helpUsageProbabilities, helpBonuses: config.helpBonuses, baseResponseTimeMs: config.baseResponseTimeMs, responseTimeVariance: config.responseTimeVariance, } } /** * Get the practicing skills for a deficient profile. * Includes all prerequisites + the deficient skill itself. */ export function getPracticingSkillsForDeficiency(deficientSkillId: string): string[] { const deficientIndex = SKILL_ORDER.indexOf(deficientSkillId as (typeof SKILL_ORDER)[number]) if (deficientIndex === -1) { throw new Error(`Unknown skill ID: ${deficientSkillId}`) } // Return all skills up to and including the deficient skill return SKILL_ORDER.slice(0, deficientIndex + 1) as string[] } /** * Generate all 32 per-skill deficiency profiles for a given learner type. */ export function generateAllDeficiencyProfiles( learnerType: LearnerType = DEFAULT_LEARNER_TYPE ): Array<{ skillId: string learnerType: LearnerType profile: StudentProfile practicingSkills: string[] }> { return SKILL_ORDER.map((skillId) => ({ skillId, learnerType, profile: generateDeficientProfile(skillId, learnerType), practicingSkills: getPracticingSkillsForDeficiency(skillId), })) } /** * Generate ALL combinations: 32 skills × 3 learner types = 96 profiles. */ export function generateAllSkillLearnerCombinations(): Array<{ skillId: string learnerType: LearnerType profile: StudentProfile practicingSkills: string[] }> { const combinations: Array<{ skillId: string learnerType: LearnerType profile: StudentProfile practicingSkills: string[] }> = [] for (const learnerType of Object.keys(LEARNER_TYPES) as LearnerType[]) { for (const skillId of SKILL_ORDER) { combinations.push({ skillId, learnerType, profile: generateDeficientProfile(skillId, learnerType), practicingSkills: getPracticingSkillsForDeficiency(skillId), }) } } return combinations } /** * Get a subset of profiles for faster testing. * Selects one skill from each category. */ export function getRepresentativeProfiles(learnerType: LearnerType = DEFAULT_LEARNER_TYPE): Array<{ skillId: string learnerType: LearnerType profile: StudentProfile practicingSkills: string[] }> { const representativeSkills = [ // Basic (1 from each sub-type) 'basic.directAddition', 'basic.heavenBead', 'basic.simpleCombinations', 'basic.directSubtraction', // Five complements (2 total) 'fiveComplements.3=5-2', 'fiveComplementsSub.-3=-5+2', // Ten complements (4 total - early, mid, late) 'tenComplements.9=10-1', 'tenComplements.5=10-5', 'tenComplementsSub.-9=+1-10', 'tenComplementsSub.-5=+5-10', ] return representativeSkills.map((skillId) => ({ skillId, learnerType, profile: generateDeficientProfile(skillId, learnerType), practicingSkills: getPracticingSkillsForDeficiency(skillId), })) } /** * Get representative profiles for ALL learner types. * Returns 10 skills × 3 learner types = 30 profiles. */ export function getRepresentativeProfilesAllLearners(): Array<{ skillId: string learnerType: LearnerType profile: StudentProfile practicingSkills: string[] }> { const allProfiles: Array<{ skillId: string learnerType: LearnerType profile: StudentProfile practicingSkills: string[] }> = [] for (const learnerType of Object.keys(LEARNER_TYPES) as LearnerType[]) { allProfiles.push(...getRepresentativeProfiles(learnerType)) } return allProfiles } /** * Human-readable skill names */ function getSkillDisplayName(skillId: string): string { const names: Record<string, string> = { 'basic.directAddition': 'Direct Addition', 'basic.heavenBead': 'Heaven Bead', 'basic.simpleCombinations': 'Simple Combinations', 'basic.directSubtraction': 'Direct Subtraction', 'basic.heavenBeadSubtraction': 'Heaven Bead Subtraction', 'basic.simpleCombinationsSub': 'Simple Combinations Sub', 'fiveComplements.4=5-1': '+4 (5-1)', 'fiveComplements.3=5-2': '+3 (5-2)', 'fiveComplements.2=5-3': '+2 (5-3)', 'fiveComplements.1=5-4': '+1 (5-4)', 'fiveComplementsSub.-4=-5+1': '-4 (-5+1)', 'fiveComplementsSub.-3=-5+2': '-3 (-5+2)', 'fiveComplementsSub.-2=-5+3': '-2 (-5+3)', 'fiveComplementsSub.-1=-5+4': '-1 (-5+4)', 'tenComplements.9=10-1': '+9 (10-1)', 'tenComplements.8=10-2': '+8 (10-2)', 'tenComplements.7=10-3': '+7 (10-3)', 'tenComplements.6=10-4': '+6 (10-4)', 'tenComplements.5=10-5': '+5 (10-5)', 'tenComplements.4=10-6': '+4 (10-6)', 'tenComplements.3=10-7': '+3 (10-7)', 'tenComplements.2=10-8': '+2 (10-8)', 'tenComplements.1=10-9': '+1 (10-9)', 'tenComplementsSub.-9=+1-10': '-9 (+1-10)', 'tenComplementsSub.-8=+2-10': '-8 (+2-10)', 'tenComplementsSub.-7=+3-10': '-7 (+3-10)', 'tenComplementsSub.-6=+4-10': '-6 (+4-10)', 'tenComplementsSub.-5=+5-10': '-5 (+5-10)', 'tenComplementsSub.-4=+6-10': '-4 (+6-10)', 'tenComplementsSub.-3=+7-10': '-3 (+7-10)', 'tenComplementsSub.-2=+8-10': '-2 (+8-10)', 'tenComplementsSub.-1=+9-10': '-1 (+9-10)', } return names[skillId] || skillId } /** * Export the skill order for tests */ export { SKILL_ORDER } |