learngraph 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/routes/analytics.js +288 -0
- package/dist/cjs/api/routes/analytics.js.map +1 -0
- package/dist/cjs/api/routes/assessments.js +269 -0
- package/dist/cjs/api/routes/assessments.js.map +1 -0
- package/dist/cjs/api/routes/curriculum.js +345 -0
- package/dist/cjs/api/routes/curriculum.js.map +1 -0
- package/dist/cjs/api/routes/edges.js +162 -0
- package/dist/cjs/api/routes/edges.js.map +1 -0
- package/dist/cjs/api/routes/explore.js +224 -0
- package/dist/cjs/api/routes/explore.js.map +1 -0
- package/dist/cjs/api/routes/learners.js +324 -0
- package/dist/cjs/api/routes/learners.js.map +1 -0
- package/dist/cjs/api/routes/me.js +404 -0
- package/dist/cjs/api/routes/me.js.map +1 -0
- package/dist/cjs/api/routes/skills.js +319 -0
- package/dist/cjs/api/routes/skills.js.map +1 -0
- package/dist/cjs/api/server.js +185 -0
- package/dist/cjs/api/server.js.map +1 -0
- package/dist/cjs/api/types.js +10 -0
- package/dist/cjs/api/types.js.map +1 -0
- package/dist/cjs/assessment/adaptive.js +390 -0
- package/dist/cjs/assessment/adaptive.js.map +1 -0
- package/dist/cjs/assessment/bkt.js +362 -0
- package/dist/cjs/assessment/bkt.js.map +1 -0
- package/dist/cjs/assessment/index.js +54 -0
- package/dist/cjs/assessment/index.js.map +1 -0
- package/dist/cjs/assessment/irt.js +420 -0
- package/dist/cjs/assessment/irt.js.map +1 -0
- package/dist/cjs/assessment/mastery-engine.js +411 -0
- package/dist/cjs/assessment/mastery-engine.js.map +1 -0
- package/dist/cjs/components/LearningPathView.js +320 -0
- package/dist/cjs/components/LearningPathView.js.map +1 -0
- package/dist/cjs/components/ProgressDashboard.js +308 -0
- package/dist/cjs/components/ProgressDashboard.js.map +1 -0
- package/dist/cjs/components/SkillCard.js +264 -0
- package/dist/cjs/components/SkillCard.js.map +1 -0
- package/dist/cjs/components/SkillExplorer.js +401 -0
- package/dist/cjs/components/SkillExplorer.js.map +1 -0
- package/dist/cjs/components/SkillGraph.js +435 -0
- package/dist/cjs/components/SkillGraph.js.map +1 -0
- package/dist/cjs/components/hooks.js +510 -0
- package/dist/cjs/components/hooks.js.map +1 -0
- package/dist/cjs/components/index.js +77 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/components/types.js +34 -0
- package/dist/cjs/components/types.js.map +1 -0
- package/dist/cjs/index.js +35 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/llm/adapters/anthropic.js +91 -3
- package/dist/cjs/llm/adapters/anthropic.js.map +1 -1
- package/dist/cjs/llm/adapters/gemini.js +101 -8
- package/dist/cjs/llm/adapters/gemini.js.map +1 -1
- package/dist/cjs/llm/adapters/index.js +42 -1
- package/dist/cjs/llm/adapters/index.js.map +1 -1
- package/dist/cjs/llm/adapters/ollama.js +120 -3
- package/dist/cjs/llm/adapters/ollama.js.map +1 -1
- package/dist/cjs/llm/adapters/openai.js +108 -2
- package/dist/cjs/llm/adapters/openai.js.map +1 -1
- package/dist/cjs/mcp/cli.js +302 -0
- package/dist/cjs/mcp/cli.js.map +1 -0
- package/dist/cjs/mcp/index.js +79 -0
- package/dist/cjs/mcp/index.js.map +1 -0
- package/dist/cjs/mcp/prompts.js +425 -0
- package/dist/cjs/mcp/prompts.js.map +1 -0
- package/dist/cjs/mcp/resources.js +371 -0
- package/dist/cjs/mcp/resources.js.map +1 -0
- package/dist/cjs/mcp/server.js +410 -0
- package/dist/cjs/mcp/server.js.map +1 -0
- package/dist/cjs/mcp/tools.js +612 -0
- package/dist/cjs/mcp/tools.js.map +1 -0
- package/dist/cjs/mcp/types.js +10 -0
- package/dist/cjs/mcp/types.js.map +1 -0
- package/dist/cjs/types/assessment.js +46 -0
- package/dist/cjs/types/assessment.js.map +1 -0
- package/dist/cjs/types/bloom.js +12 -1
- package/dist/cjs/types/bloom.js.map +1 -1
- package/dist/cjs/types/index.js +7 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/api/routes/analytics.js +285 -0
- package/dist/esm/api/routes/analytics.js.map +1 -0
- package/dist/esm/api/routes/assessments.js +266 -0
- package/dist/esm/api/routes/assessments.js.map +1 -0
- package/dist/esm/api/routes/curriculum.js +342 -0
- package/dist/esm/api/routes/curriculum.js.map +1 -0
- package/dist/esm/api/routes/edges.js +159 -0
- package/dist/esm/api/routes/edges.js.map +1 -0
- package/dist/esm/api/routes/explore.js +221 -0
- package/dist/esm/api/routes/explore.js.map +1 -0
- package/dist/esm/api/routes/learners.js +321 -0
- package/dist/esm/api/routes/learners.js.map +1 -0
- package/dist/esm/api/routes/me.js +401 -0
- package/dist/esm/api/routes/me.js.map +1 -0
- package/dist/esm/api/routes/skills.js +316 -0
- package/dist/esm/api/routes/skills.js.map +1 -0
- package/dist/esm/api/server.js +179 -0
- package/dist/esm/api/server.js.map +1 -0
- package/dist/esm/api/types.js +9 -0
- package/dist/esm/api/types.js.map +1 -0
- package/dist/esm/assessment/adaptive.js +384 -0
- package/dist/esm/assessment/adaptive.js.map +1 -0
- package/dist/esm/assessment/bkt.js +354 -0
- package/dist/esm/assessment/bkt.js.map +1 -0
- package/dist/esm/assessment/index.js +21 -0
- package/dist/esm/assessment/index.js.map +1 -0
- package/dist/esm/assessment/irt.js +406 -0
- package/dist/esm/assessment/irt.js.map +1 -0
- package/dist/esm/assessment/mastery-engine.js +406 -0
- package/dist/esm/assessment/mastery-engine.js.map +1 -0
- package/dist/esm/components/LearningPathView.js +316 -0
- package/dist/esm/components/LearningPathView.js.map +1 -0
- package/dist/esm/components/ProgressDashboard.js +304 -0
- package/dist/esm/components/ProgressDashboard.js.map +1 -0
- package/dist/esm/components/SkillCard.js +260 -0
- package/dist/esm/components/SkillCard.js.map +1 -0
- package/dist/esm/components/SkillExplorer.js +397 -0
- package/dist/esm/components/SkillExplorer.js.map +1 -0
- package/dist/esm/components/SkillGraph.js +398 -0
- package/dist/esm/components/SkillGraph.js.map +1 -0
- package/dist/esm/components/hooks.js +502 -0
- package/dist/esm/components/hooks.js.map +1 -0
- package/dist/esm/components/index.js +61 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/components/types.js +31 -0
- package/dist/esm/components/types.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/llm/adapters/anthropic.js +88 -2
- package/dist/esm/llm/adapters/anthropic.js.map +1 -1
- package/dist/esm/llm/adapters/gemini.js +98 -7
- package/dist/esm/llm/adapters/gemini.js.map +1 -1
- package/dist/esm/llm/adapters/index.js +15 -4
- package/dist/esm/llm/adapters/index.js.map +1 -1
- package/dist/esm/llm/adapters/ollama.js +117 -2
- package/dist/esm/llm/adapters/ollama.js.map +1 -1
- package/dist/esm/llm/adapters/openai.js +105 -1
- package/dist/esm/llm/adapters/openai.js.map +1 -1
- package/dist/esm/mcp/cli.js +267 -0
- package/dist/esm/mcp/cli.js.map +1 -0
- package/dist/esm/mcp/index.js +39 -0
- package/dist/esm/mcp/index.js.map +1 -0
- package/dist/esm/mcp/prompts.js +419 -0
- package/dist/esm/mcp/prompts.js.map +1 -0
- package/dist/esm/mcp/resources.js +359 -0
- package/dist/esm/mcp/resources.js.map +1 -0
- package/dist/esm/mcp/server.js +372 -0
- package/dist/esm/mcp/server.js.map +1 -0
- package/dist/esm/mcp/tools.js +598 -0
- package/dist/esm/mcp/tools.js.map +1 -0
- package/dist/esm/mcp/types.js +9 -0
- package/dist/esm/mcp/types.js.map +1 -0
- package/dist/esm/types/assessment.js +40 -0
- package/dist/esm/types/assessment.js.map +1 -0
- package/dist/esm/types/bloom.js +11 -0
- package/dist/esm/types/bloom.js.map +1 -1
- package/dist/esm/types/index.js +2 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/types/api/routes/analytics.d.ts +14 -0
- package/dist/types/api/routes/analytics.d.ts.map +1 -0
- package/dist/types/api/routes/assessments.d.ts +14 -0
- package/dist/types/api/routes/assessments.d.ts.map +1 -0
- package/dist/types/api/routes/curriculum.d.ts +14 -0
- package/dist/types/api/routes/curriculum.d.ts.map +1 -0
- package/dist/types/api/routes/edges.d.ts +14 -0
- package/dist/types/api/routes/edges.d.ts.map +1 -0
- package/dist/types/api/routes/explore.d.ts +14 -0
- package/dist/types/api/routes/explore.d.ts.map +1 -0
- package/dist/types/api/routes/learners.d.ts +14 -0
- package/dist/types/api/routes/learners.d.ts.map +1 -0
- package/dist/types/api/routes/me.d.ts +14 -0
- package/dist/types/api/routes/me.d.ts.map +1 -0
- package/dist/types/api/routes/skills.d.ts +14 -0
- package/dist/types/api/routes/skills.d.ts.map +1 -0
- package/dist/types/api/server.d.ts +147 -0
- package/dist/types/api/server.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +443 -0
- package/dist/types/api/types.d.ts.map +1 -0
- package/dist/types/assessment/adaptive.d.ts +155 -0
- package/dist/types/assessment/adaptive.d.ts.map +1 -0
- package/dist/types/assessment/bkt.d.ts +185 -0
- package/dist/types/assessment/bkt.d.ts.map +1 -0
- package/dist/types/assessment/index.d.ts +18 -0
- package/dist/types/assessment/index.d.ts.map +1 -0
- package/dist/types/assessment/irt.d.ts +159 -0
- package/dist/types/assessment/irt.d.ts.map +1 -0
- package/dist/types/assessment/mastery-engine.d.ts +178 -0
- package/dist/types/assessment/mastery-engine.d.ts.map +1 -0
- package/dist/types/components/LearningPathView.d.ts +40 -0
- package/dist/types/components/LearningPathView.d.ts.map +1 -0
- package/dist/types/components/ProgressDashboard.d.ts +49 -0
- package/dist/types/components/ProgressDashboard.d.ts.map +1 -0
- package/dist/types/components/SkillCard.d.ts +34 -0
- package/dist/types/components/SkillCard.d.ts.map +1 -0
- package/dist/types/components/SkillExplorer.d.ts +39 -0
- package/dist/types/components/SkillExplorer.d.ts.map +1 -0
- package/dist/types/components/SkillGraph.d.ts +38 -0
- package/dist/types/components/SkillGraph.d.ts.map +1 -0
- package/dist/types/components/hooks.d.ts +187 -0
- package/dist/types/components/hooks.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +59 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/types.d.ts +410 -0
- package/dist/types/components/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm/adapters/anthropic.d.ts +84 -1
- package/dist/types/llm/adapters/anthropic.d.ts.map +1 -1
- package/dist/types/llm/adapters/gemini.d.ts +93 -6
- package/dist/types/llm/adapters/gemini.d.ts.map +1 -1
- package/dist/types/llm/adapters/index.d.ts +13 -4
- package/dist/types/llm/adapters/index.d.ts.map +1 -1
- package/dist/types/llm/adapters/ollama.d.ts +126 -1
- package/dist/types/llm/adapters/ollama.d.ts.map +1 -1
- package/dist/types/llm/adapters/openai.d.ts +104 -1
- package/dist/types/llm/adapters/openai.d.ts.map +1 -1
- package/dist/types/mcp/cli.d.ts +15 -0
- package/dist/types/mcp/cli.d.ts.map +1 -0
- package/dist/types/mcp/index.d.ts +32 -0
- package/dist/types/mcp/index.d.ts.map +1 -0
- package/dist/types/mcp/prompts.d.ts +27 -0
- package/dist/types/mcp/prompts.d.ts.map +1 -0
- package/dist/types/mcp/resources.d.ts +59 -0
- package/dist/types/mcp/resources.d.ts.map +1 -0
- package/dist/types/mcp/server.d.ts +136 -0
- package/dist/types/mcp/server.d.ts.map +1 -0
- package/dist/types/mcp/tools.d.ts +344 -0
- package/dist/types/mcp/tools.d.ts.map +1 -0
- package/dist/types/mcp/types.d.ts +137 -0
- package/dist/types/mcp/types.d.ts.map +1 -0
- package/dist/types/types/assessment.d.ts +512 -0
- package/dist/types/types/assessment.d.ts.map +1 -0
- package/dist/types/types/bloom.d.ts +4 -0
- package/dist/types/types/bloom.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +3 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +48 -3
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bayesian Knowledge Tracing (BKT)
|
|
3
|
+
*
|
|
4
|
+
* Implements the classic BKT model for tracking learner mastery.
|
|
5
|
+
* BKT is a hidden Markov model with two hidden states (mastery/no mastery)
|
|
6
|
+
* and uses four parameters:
|
|
7
|
+
* - P(L₀): Prior probability of mastery (pInit)
|
|
8
|
+
* - P(T): Probability of learning/transition (pLearn)
|
|
9
|
+
* - P(S): Probability of slip (wrong despite mastery) (pSlip)
|
|
10
|
+
* - P(G): Probability of guess (correct despite no mastery) (pGuess)
|
|
11
|
+
*
|
|
12
|
+
* @see Corbett & Anderson (1994). Knowledge tracing: Modeling the acquisition
|
|
13
|
+
* of procedural knowledge. User Modeling and User-Adapted Interaction.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import type { SkillId } from '../types/skill.js';
|
|
18
|
+
import type { BKTParameters, BKTState, BKTConfig, MasteryState } from '../types/index.js';
|
|
19
|
+
/**
|
|
20
|
+
* Default BKT configuration
|
|
21
|
+
*/
|
|
22
|
+
export declare const BKT_CONFIG_DEFAULTS: Required<BKTConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* BKT update result
|
|
25
|
+
*/
|
|
26
|
+
export interface BKTUpdateResult {
|
|
27
|
+
/** Updated mastery probability */
|
|
28
|
+
pMastery: number;
|
|
29
|
+
/** Whether mastery threshold is met */
|
|
30
|
+
isMastered: boolean;
|
|
31
|
+
/** Probability of the observation given the model */
|
|
32
|
+
likelihood: number;
|
|
33
|
+
/** Previous mastery probability (before update) */
|
|
34
|
+
previousMastery: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* BKT prediction result
|
|
38
|
+
*/
|
|
39
|
+
export interface BKTPrediction {
|
|
40
|
+
/** Probability of correct response */
|
|
41
|
+
pCorrect: number;
|
|
42
|
+
/** Expected mastery after correct response */
|
|
43
|
+
masteryIfCorrect: number;
|
|
44
|
+
/** Expected mastery after incorrect response */
|
|
45
|
+
masteryIfIncorrect: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Bayesian Knowledge Tracing Engine
|
|
49
|
+
*
|
|
50
|
+
* Tracks learner mastery using the classic BKT model.
|
|
51
|
+
* Can be used with skill-level or global parameters.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const bkt = new BKTEngine();
|
|
56
|
+
*
|
|
57
|
+
* // Initialize state for a skill
|
|
58
|
+
* let state = bkt.initializeState('skill-1');
|
|
59
|
+
*
|
|
60
|
+
* // Update after correct response
|
|
61
|
+
* state = bkt.update(state, true).state;
|
|
62
|
+
* console.log(`Mastery: ${state.pMastery.toFixed(2)}`);
|
|
63
|
+
*
|
|
64
|
+
* // Update after incorrect response
|
|
65
|
+
* state = bkt.update(state, false).state;
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class BKTEngine {
|
|
69
|
+
private readonly config;
|
|
70
|
+
private readonly skillParams;
|
|
71
|
+
private readonly globalParams;
|
|
72
|
+
constructor(config?: BKTConfig, globalParams?: BKTParameters);
|
|
73
|
+
/**
|
|
74
|
+
* Set parameters for a specific skill
|
|
75
|
+
*/
|
|
76
|
+
setSkillParameters(skillId: SkillId, params: BKTParameters): void;
|
|
77
|
+
/**
|
|
78
|
+
* Get parameters for a skill (falls back to global)
|
|
79
|
+
*/
|
|
80
|
+
getParameters(skillId?: SkillId): BKTParameters;
|
|
81
|
+
/**
|
|
82
|
+
* Initialize BKT state for a skill
|
|
83
|
+
*/
|
|
84
|
+
initializeState(skillId: SkillId): BKTState;
|
|
85
|
+
/**
|
|
86
|
+
* Update BKT state based on an observed response
|
|
87
|
+
*
|
|
88
|
+
* Uses Bayes' theorem to update the mastery probability:
|
|
89
|
+
* - For correct response: P(Lₙ|correct) ∝ P(correct|Lₙ) × P(Lₙ)
|
|
90
|
+
* - For incorrect response: P(Lₙ|incorrect) ∝ P(incorrect|Lₙ) × P(Lₙ)
|
|
91
|
+
*
|
|
92
|
+
* Then applies the learning transition.
|
|
93
|
+
*
|
|
94
|
+
* @param state - Current BKT state
|
|
95
|
+
* @param correct - Whether the response was correct
|
|
96
|
+
* @param skillId - Optional skill ID for skill-specific parameters
|
|
97
|
+
* @returns Updated state and result information
|
|
98
|
+
*/
|
|
99
|
+
update(state: BKTState, correct: boolean, skillId?: SkillId): {
|
|
100
|
+
state: BKTState;
|
|
101
|
+
result: BKTUpdateResult;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Update from multiple responses
|
|
105
|
+
*/
|
|
106
|
+
updateBatch(state: BKTState, responses: boolean[], skillId?: SkillId): {
|
|
107
|
+
state: BKTState;
|
|
108
|
+
results: BKTUpdateResult[];
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Predict the probability of a correct response
|
|
112
|
+
*/
|
|
113
|
+
predict(state: BKTState, skillId?: SkillId): BKTPrediction;
|
|
114
|
+
/**
|
|
115
|
+
* Estimate number of opportunities until mastery
|
|
116
|
+
*
|
|
117
|
+
* Uses a forward simulation assuming consistent correct responses.
|
|
118
|
+
*/
|
|
119
|
+
estimateOpportunitiesToMastery(state: BKTState, skillId?: SkillId, maxOpportunities?: number): number | null;
|
|
120
|
+
/**
|
|
121
|
+
* Check if mastery threshold is met
|
|
122
|
+
*/
|
|
123
|
+
isMastered(state: BKTState): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Convert BKT state to MasteryState for integration with other systems
|
|
126
|
+
*/
|
|
127
|
+
toMasteryState(state: BKTState): Partial<MasteryState>;
|
|
128
|
+
/**
|
|
129
|
+
* Calculate current streak from history
|
|
130
|
+
*/
|
|
131
|
+
private calculateStreak;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Parameter fitting for BKT using grid search
|
|
135
|
+
*
|
|
136
|
+
* Finds optimal BKT parameters for a set of response sequences.
|
|
137
|
+
* Uses grid search with log-likelihood as the objective.
|
|
138
|
+
*/
|
|
139
|
+
export interface BKTFitResult {
|
|
140
|
+
/** Best parameters found */
|
|
141
|
+
params: BKTParameters;
|
|
142
|
+
/** Log-likelihood of the data given the parameters */
|
|
143
|
+
logLikelihood: number;
|
|
144
|
+
/** Number of parameter combinations evaluated */
|
|
145
|
+
evaluations: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Fit BKT parameters to response data
|
|
149
|
+
*
|
|
150
|
+
* @param sequences - Array of response sequences (true = correct)
|
|
151
|
+
* @param gridSize - Number of values to try for each parameter
|
|
152
|
+
* @returns Best fitting parameters
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const sequences = [
|
|
157
|
+
* [false, false, true, true, true],
|
|
158
|
+
* [true, false, true, true, true],
|
|
159
|
+
* [false, true, true, true, true],
|
|
160
|
+
* ];
|
|
161
|
+
*
|
|
162
|
+
* const result = fitBKTParameters(sequences);
|
|
163
|
+
* console.log('Best parameters:', result.params);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare function fitBKTParameters(sequences: boolean[][], gridSize?: number): BKTFitResult;
|
|
167
|
+
/**
|
|
168
|
+
* Calculate log-likelihood of response sequences given BKT parameters
|
|
169
|
+
*/
|
|
170
|
+
export declare function calculateLogLikelihood(sequences: boolean[][], params: BKTParameters): number;
|
|
171
|
+
/**
|
|
172
|
+
* Create a BKT engine with default configuration
|
|
173
|
+
*/
|
|
174
|
+
export declare function createBKTEngine(config?: BKTConfig, params?: BKTParameters): BKTEngine;
|
|
175
|
+
/**
|
|
176
|
+
* Quick mastery estimation using BKT
|
|
177
|
+
*
|
|
178
|
+
* Convenience function for simple use cases.
|
|
179
|
+
*
|
|
180
|
+
* @param responses - Sequence of correct/incorrect responses
|
|
181
|
+
* @param params - BKT parameters (optional, uses defaults)
|
|
182
|
+
* @returns Final mastery probability
|
|
183
|
+
*/
|
|
184
|
+
export declare function estimateMastery(responses: boolean[], params?: BKTParameters): number;
|
|
185
|
+
//# sourceMappingURL=bkt.d.ts.map
|
|
@@ -0,0 +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,CAAC,EAAE,SAAS,EAClB,MAAM,CAAC,EAAE,aAAa,GACrB,SAAS,CAEX;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,OAAO,EAAE,EACpB,MAAM,GAAE,aAA4B,GACnC,MAAM,CAwBR"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assessment Framework
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive assessment capabilities:
|
|
5
|
+
* - Bayesian Knowledge Tracing (BKT) for skill-level mastery
|
|
6
|
+
* - Item Response Theory (IRT) for ability estimation
|
|
7
|
+
* - Unified mastery estimation engine
|
|
8
|
+
* - Adaptive testing with intelligent item selection
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export type { QuestionId, QuestionType, AnswerOption, MatchingPair, Question, QuestionInput, AssessmentId, AssessmentType, SelectionStrategy, TerminationCriteria, Assessment, AssessmentInput, ResponseId, LearnerResponse, AssessmentSession, IRTModel, IRTParameters, IRTAbilityEstimate, IRTConfig, BKTParameters, BKTState, BKTConfig, EvidenceSource, LearningEvidence, EvidenceSummary, ItemSelection, AdaptiveState, AdaptiveConfig, AssessmentResult, DifficultyAdjustment, AssessmentValidation, } from '../types/assessment.js';
|
|
13
|
+
export { createQuestionId, createAssessmentId, createResponseId, BKT_DEFAULTS, } from '../types/assessment.js';
|
|
14
|
+
export { BKTEngine, createBKTEngine, fitBKTParameters, calculateLogLikelihood, estimateMastery, BKT_CONFIG_DEFAULTS, type BKTUpdateResult, type BKTPrediction, type BKTFitResult, } from './bkt.js';
|
|
15
|
+
export { IRTEstimator, createIRTEstimator, calculateProbability, calculateProbabilityDerivative, calculateInformation, calculateTestInformation, calculateStandardError, selectNextItemMFI, abilityToPercentile, abilityToGradeLevel, estimateAbility, IRT_CONFIG_DEFAULTS, type IRTResponse, } from './irt.js';
|
|
16
|
+
export { MasteryEngine, createMasteryEngine, MASTERY_ENGINE_DEFAULTS, type MasteryEngineConfig, type MasteryUpdate, type LearnerMasteryProfile, } from './mastery-engine.js';
|
|
17
|
+
export { AdaptiveEngine, createAdaptiveEngine, createQuestionPool, ADAPTIVE_DEFAULTS, TERMINATION_DEFAULTS, type QuestionPool, type AdaptiveSession, } from './adaptive.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assessment/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,YAAY,EAEV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,aAAa,EAEb,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,eAAe,EAEf,UAAU,EACV,eAAe,EACf,iBAAiB,EAEjB,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,SAAS,EAET,aAAa,EACb,QAAQ,EACR,SAAS,EAET,cAAc,EACd,gBAAgB,EAChB,eAAe,EAEf,aAAa,EACb,aAAa,EACb,cAAc,EAEd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Item Response Theory (IRT)
|
|
3
|
+
*
|
|
4
|
+
* Implements the 1PL (Rasch), 2PL, and 3PL IRT models for:
|
|
5
|
+
* - Calculating probability of correct response
|
|
6
|
+
* - Estimating learner ability (theta)
|
|
7
|
+
* - Calculating item information
|
|
8
|
+
* - Adaptive item selection
|
|
9
|
+
*
|
|
10
|
+
* @see Lord, F.M. (1980). Applications of item response theory to practical testing problems.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import type { IRTParameters, IRTAbilityEstimate, IRTConfig, QuestionId } from '../types/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Default IRT configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare const IRT_CONFIG_DEFAULTS: Required<IRTConfig>;
|
|
19
|
+
/**
|
|
20
|
+
* IRT response data for estimation
|
|
21
|
+
*/
|
|
22
|
+
export interface IRTResponse {
|
|
23
|
+
/** Question ID */
|
|
24
|
+
questionId: QuestionId;
|
|
25
|
+
/** Item parameters */
|
|
26
|
+
params: IRTParameters;
|
|
27
|
+
/** Whether response was correct */
|
|
28
|
+
correct: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Calculate probability of correct response using IRT model
|
|
32
|
+
*
|
|
33
|
+
* 1PL (Rasch): P(θ) = 1 / (1 + exp(-(θ - b)))
|
|
34
|
+
* 2PL: P(θ) = 1 / (1 + exp(-a(θ - b)))
|
|
35
|
+
* 3PL: P(θ) = c + (1 - c) / (1 + exp(-a(θ - b)))
|
|
36
|
+
*
|
|
37
|
+
* @param theta - Ability parameter
|
|
38
|
+
* @param params - Item parameters
|
|
39
|
+
* @returns Probability of correct response (0-1)
|
|
40
|
+
*/
|
|
41
|
+
export declare function calculateProbability(theta: number, params: IRTParameters): number;
|
|
42
|
+
/**
|
|
43
|
+
* Calculate the first derivative of P with respect to theta
|
|
44
|
+
* Used in ability estimation
|
|
45
|
+
*/
|
|
46
|
+
export declare function calculateProbabilityDerivative(theta: number, params: IRTParameters): number;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate Fisher Information for an item at a given ability
|
|
49
|
+
*
|
|
50
|
+
* Information represents how precisely the item measures ability at theta.
|
|
51
|
+
* Higher information = more useful for measuring that ability level.
|
|
52
|
+
*
|
|
53
|
+
* I(θ) = [P'(θ)]² / [P(θ)(1-P(θ))]
|
|
54
|
+
*/
|
|
55
|
+
export declare function calculateInformation(theta: number, params: IRTParameters): number;
|
|
56
|
+
/**
|
|
57
|
+
* Calculate test information (sum of item information)
|
|
58
|
+
*/
|
|
59
|
+
export declare function calculateTestInformation(theta: number, items: IRTParameters[]): number;
|
|
60
|
+
/**
|
|
61
|
+
* Calculate standard error of ability estimate
|
|
62
|
+
* SE(θ) = 1 / √I(θ)
|
|
63
|
+
*/
|
|
64
|
+
export declare function calculateStandardError(theta: number, items: IRTParameters[]): number;
|
|
65
|
+
/**
|
|
66
|
+
* IRT Ability Estimator
|
|
67
|
+
*
|
|
68
|
+
* Estimates learner ability (theta) from response patterns using
|
|
69
|
+
* Maximum Likelihood Estimation (MLE) or Expected A Posteriori (EAP).
|
|
70
|
+
*/
|
|
71
|
+
export declare class IRTEstimator {
|
|
72
|
+
private readonly config;
|
|
73
|
+
constructor(config?: IRTConfig);
|
|
74
|
+
/**
|
|
75
|
+
* Estimate ability using Maximum Likelihood Estimation (MLE)
|
|
76
|
+
*
|
|
77
|
+
* Uses Newton-Raphson iteration to find the theta that maximizes
|
|
78
|
+
* the likelihood of the observed response pattern.
|
|
79
|
+
*/
|
|
80
|
+
estimateMLE(responses: IRTResponse[]): IRTAbilityEstimate;
|
|
81
|
+
/**
|
|
82
|
+
* Estimate ability using Expected A Posteriori (EAP)
|
|
83
|
+
*
|
|
84
|
+
* Uses numerical integration with a prior distribution.
|
|
85
|
+
* More stable than MLE, especially with few responses.
|
|
86
|
+
*/
|
|
87
|
+
estimateEAP(responses: IRTResponse[]): IRTAbilityEstimate;
|
|
88
|
+
/**
|
|
89
|
+
* Estimate ability using Maximum A Posteriori (MAP)
|
|
90
|
+
*
|
|
91
|
+
* Like MLE but includes prior distribution.
|
|
92
|
+
*/
|
|
93
|
+
estimateMAP(responses: IRTResponse[]): IRTAbilityEstimate;
|
|
94
|
+
/**
|
|
95
|
+
* Auto-select best estimation method based on response count
|
|
96
|
+
*/
|
|
97
|
+
estimate(responses: IRTResponse[]): IRTAbilityEstimate;
|
|
98
|
+
/**
|
|
99
|
+
* Calculate log-likelihood derivatives for Newton-Raphson
|
|
100
|
+
*/
|
|
101
|
+
private calculateDerivatives;
|
|
102
|
+
/**
|
|
103
|
+
* Calculate likelihood of response pattern
|
|
104
|
+
*/
|
|
105
|
+
private calculateLikelihood;
|
|
106
|
+
/**
|
|
107
|
+
* Normal PDF for prior
|
|
108
|
+
*/
|
|
109
|
+
private normalPDF;
|
|
110
|
+
/**
|
|
111
|
+
* Build ability estimate result
|
|
112
|
+
*/
|
|
113
|
+
private buildEstimate;
|
|
114
|
+
/**
|
|
115
|
+
* Default estimate when no responses
|
|
116
|
+
*/
|
|
117
|
+
private defaultEstimate;
|
|
118
|
+
/**
|
|
119
|
+
* Handle extreme response patterns
|
|
120
|
+
*/
|
|
121
|
+
private extremeEstimate;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Select next item for adaptive testing using Maximum Fisher Information
|
|
125
|
+
*
|
|
126
|
+
* Selects the item that provides the most information at the current ability estimate.
|
|
127
|
+
*/
|
|
128
|
+
export declare function selectNextItemMFI(currentTheta: number, availableItems: {
|
|
129
|
+
id: QuestionId;
|
|
130
|
+
params: IRTParameters;
|
|
131
|
+
}[], administeredIds: Set<QuestionId>): {
|
|
132
|
+
id: QuestionId;
|
|
133
|
+
params: IRTParameters;
|
|
134
|
+
information: number;
|
|
135
|
+
} | null;
|
|
136
|
+
/**
|
|
137
|
+
* Convert ability (theta) to percentile
|
|
138
|
+
*
|
|
139
|
+
* Assumes standard normal distribution of ability.
|
|
140
|
+
*/
|
|
141
|
+
export declare function abilityToPercentile(theta: number): number;
|
|
142
|
+
/**
|
|
143
|
+
* Convert ability to grade-level equivalent (rough approximation)
|
|
144
|
+
*
|
|
145
|
+
* Maps theta to approximate grade level (K-12 scale).
|
|
146
|
+
*/
|
|
147
|
+
export declare function abilityToGradeLevel(theta: number): number;
|
|
148
|
+
/**
|
|
149
|
+
* Create an IRT estimator
|
|
150
|
+
*/
|
|
151
|
+
export declare function createIRTEstimator(config?: IRTConfig): IRTEstimator;
|
|
152
|
+
/**
|
|
153
|
+
* Quick ability estimation using EAP
|
|
154
|
+
*/
|
|
155
|
+
export declare function estimateAbility(responses: {
|
|
156
|
+
params: IRTParameters;
|
|
157
|
+
correct: boolean;
|
|
158
|
+
}[], config?: IRTConfig): number;
|
|
159
|
+
//# sourceMappingURL=irt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irt.d.ts","sourceRoot":"","sources":["../../../src/assessment/irt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,SAAS,CAKnD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kBAAkB;IAClB,UAAU,EAAE,UAAU,CAA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,OAAO,CAAC,eAAe;CAmBxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE;IAAE,EAAE,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,EAAE,EAC3D,eAAe,EAAE,GAAG,CAAC,UAAU,CAAC,GAC/B;IAAE,EAAE,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAiBvE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWzD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,CAEnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,EACxD,MAAM,CAAC,EAAE,SAAS,GACjB,MAAM,CASR"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mastery Estimation Engine
|
|
3
|
+
*
|
|
4
|
+
* Unified engine for estimating and tracking learner mastery.
|
|
5
|
+
* Combines multiple evidence sources:
|
|
6
|
+
* - Bayesian Knowledge Tracing (BKT) for skill-level mastery
|
|
7
|
+
* - Item Response Theory (IRT) for ability estimation
|
|
8
|
+
* - Response patterns for confidence calibration
|
|
9
|
+
* - Time-based decay for forgetting
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import type { SkillId } from '../types/skill.js';
|
|
14
|
+
import type { BKTParameters, BKTState, IRTParameters, LearningEvidence, EvidenceSource, EvidenceSummary, MasteryState, ResponseRecord } from '../types/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Mastery engine configuration
|
|
17
|
+
*/
|
|
18
|
+
export interface MasteryEngineConfig {
|
|
19
|
+
/** Use BKT for skill-level tracking */
|
|
20
|
+
useBKT?: boolean;
|
|
21
|
+
/** Use IRT for ability estimation */
|
|
22
|
+
useIRT?: boolean;
|
|
23
|
+
/** Apply time-based forgetting */
|
|
24
|
+
applyForgetting?: boolean;
|
|
25
|
+
/** Forgetting rate (per day) */
|
|
26
|
+
forgettingRate?: number;
|
|
27
|
+
/** Mastery threshold */
|
|
28
|
+
masteryThreshold?: number;
|
|
29
|
+
/** BKT parameters */
|
|
30
|
+
bktParams?: BKTParameters;
|
|
31
|
+
/** Weights for evidence sources */
|
|
32
|
+
evidenceWeights?: Partial<Record<EvidenceSource, number>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Default engine configuration
|
|
36
|
+
*/
|
|
37
|
+
export declare const MASTERY_ENGINE_DEFAULTS: Required<MasteryEngineConfig>;
|
|
38
|
+
/**
|
|
39
|
+
* Mastery update event
|
|
40
|
+
*/
|
|
41
|
+
export interface MasteryUpdate {
|
|
42
|
+
/** Skill ID */
|
|
43
|
+
skillId: SkillId;
|
|
44
|
+
/** Previous mastery level */
|
|
45
|
+
previousMastery: number;
|
|
46
|
+
/** New mastery level */
|
|
47
|
+
newMastery: number;
|
|
48
|
+
/** Change in mastery */
|
|
49
|
+
delta: number;
|
|
50
|
+
/** Update reason */
|
|
51
|
+
reason: 'response' | 'evidence' | 'decay' | 'reset';
|
|
52
|
+
/** Timestamp */
|
|
53
|
+
timestamp: Date;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Learner profile for the mastery engine
|
|
57
|
+
*/
|
|
58
|
+
export interface LearnerMasteryProfile {
|
|
59
|
+
/** Learner identifier */
|
|
60
|
+
learnerId: string;
|
|
61
|
+
/** BKT states per skill */
|
|
62
|
+
bktStates: Map<SkillId, BKTState>;
|
|
63
|
+
/** Mastery levels per skill */
|
|
64
|
+
masteryLevels: Map<SkillId, number>;
|
|
65
|
+
/** IRT ability estimate */
|
|
66
|
+
abilityEstimate?: number;
|
|
67
|
+
/** Evidence by skill */
|
|
68
|
+
evidence: Map<SkillId, LearningEvidence[]>;
|
|
69
|
+
/** Response history */
|
|
70
|
+
responseHistory: ResponseRecord[];
|
|
71
|
+
/** Last activity timestamp */
|
|
72
|
+
lastActivity: Date;
|
|
73
|
+
/** Update history */
|
|
74
|
+
updateHistory: MasteryUpdate[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Mastery Estimation Engine
|
|
78
|
+
*
|
|
79
|
+
* Provides a unified interface for tracking learner mastery across skills.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const engine = new MasteryEngine();
|
|
84
|
+
*
|
|
85
|
+
* // Initialize a learner profile
|
|
86
|
+
* const profile = engine.createProfile('learner-1');
|
|
87
|
+
*
|
|
88
|
+
* // Record a response
|
|
89
|
+
* const updated = engine.recordResponse(profile, 'skill-1', true);
|
|
90
|
+
* console.log(`Mastery: ${engine.getMastery(updated, 'skill-1')}`);
|
|
91
|
+
*
|
|
92
|
+
* // Check if skill is mastered
|
|
93
|
+
* console.log(`Mastered: ${engine.isMastered(updated, 'skill-1')}`);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare class MasteryEngine {
|
|
97
|
+
private readonly config;
|
|
98
|
+
private readonly bktEngine;
|
|
99
|
+
private readonly irtEstimator;
|
|
100
|
+
constructor(config?: MasteryEngineConfig);
|
|
101
|
+
/**
|
|
102
|
+
* Create a new learner profile
|
|
103
|
+
*/
|
|
104
|
+
createProfile(learnerId: string): LearnerMasteryProfile;
|
|
105
|
+
/**
|
|
106
|
+
* Get or initialize BKT state for a skill
|
|
107
|
+
*/
|
|
108
|
+
private getOrCreateBKTState;
|
|
109
|
+
/**
|
|
110
|
+
* Record a learner response and update mastery
|
|
111
|
+
*/
|
|
112
|
+
recordResponse(profile: LearnerMasteryProfile, skillId: SkillId, correct: boolean, responseTime?: number, itemParams?: IRTParameters): LearnerMasteryProfile;
|
|
113
|
+
/**
|
|
114
|
+
* Record multiple responses at once
|
|
115
|
+
*/
|
|
116
|
+
recordResponses(profile: LearnerMasteryProfile, responses: Array<{
|
|
117
|
+
skillId: SkillId;
|
|
118
|
+
correct: boolean;
|
|
119
|
+
responseTime?: number;
|
|
120
|
+
}>): LearnerMasteryProfile;
|
|
121
|
+
/**
|
|
122
|
+
* Add learning evidence
|
|
123
|
+
*/
|
|
124
|
+
addEvidence(profile: LearnerMasteryProfile, evidence: LearningEvidence): LearnerMasteryProfile;
|
|
125
|
+
/**
|
|
126
|
+
* Get current mastery level for a skill
|
|
127
|
+
*/
|
|
128
|
+
getMastery(profile: LearnerMasteryProfile, skillId: SkillId): number;
|
|
129
|
+
/**
|
|
130
|
+
* Get mastery for multiple skills
|
|
131
|
+
*/
|
|
132
|
+
getMasteryMap(profile: LearnerMasteryProfile, skillIds: SkillId[]): Map<SkillId, number>;
|
|
133
|
+
/**
|
|
134
|
+
* Check if a skill is mastered
|
|
135
|
+
*/
|
|
136
|
+
isMastered(profile: LearnerMasteryProfile, skillId: SkillId): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Get skills that are mastered
|
|
139
|
+
*/
|
|
140
|
+
getMasteredSkills(profile: LearnerMasteryProfile): SkillId[];
|
|
141
|
+
/**
|
|
142
|
+
* Calculate mastery combining all evidence sources
|
|
143
|
+
*/
|
|
144
|
+
private calculateMastery;
|
|
145
|
+
/**
|
|
146
|
+
* Apply time-based forgetting
|
|
147
|
+
*/
|
|
148
|
+
private applyForgetting;
|
|
149
|
+
/**
|
|
150
|
+
* Update IRT ability estimate
|
|
151
|
+
*/
|
|
152
|
+
private updateAbility;
|
|
153
|
+
/**
|
|
154
|
+
* Reset mastery for a skill
|
|
155
|
+
*/
|
|
156
|
+
resetMastery(profile: LearnerMasteryProfile, skillId: SkillId): LearnerMasteryProfile;
|
|
157
|
+
/**
|
|
158
|
+
* Get evidence summary for a skill
|
|
159
|
+
*/
|
|
160
|
+
getEvidenceSummary(profile: LearnerMasteryProfile, skillId: SkillId): EvidenceSummary | null;
|
|
161
|
+
/**
|
|
162
|
+
* Predict probability of correct response
|
|
163
|
+
*/
|
|
164
|
+
predictCorrect(profile: LearnerMasteryProfile, skillId: SkillId): number;
|
|
165
|
+
/**
|
|
166
|
+
* Estimate opportunities until mastery
|
|
167
|
+
*/
|
|
168
|
+
estimateOpportunitiesToMastery(profile: LearnerMasteryProfile, skillId: SkillId): number | null;
|
|
169
|
+
/**
|
|
170
|
+
* Convert profile to MasteryState map for integration
|
|
171
|
+
*/
|
|
172
|
+
toMasteryStates(profile: LearnerMasteryProfile, skillIds?: SkillId[]): Map<SkillId, MasteryState>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Create a mastery engine with default configuration
|
|
176
|
+
*/
|
|
177
|
+
export declare function createMasteryEngine(config?: MasteryEngineConfig): MasteryEngine;
|
|
178
|
+
//# sourceMappingURL=mastery-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mastery-engine.d.ts","sourceRoot":"","sources":["../../../src/assessment/mastery-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACf,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,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Aa;IAarB;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,GAAG,qBAAqB;IAmBrF;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI;IAmD5F;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;IASxE;;OAEG;IACH,8BAA8B,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,OAAO,GACf,MAAM,GAAG,IAAI;IAehB;;OAEG;IACH,eAAe,CACb,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,GACnB,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC;CAsC9B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAE/E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LearningPathView Component
|
|
3
|
+
*
|
|
4
|
+
* Displays a learning path with progress tracking.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import { type FC } from 'react';
|
|
9
|
+
import type { LearningPathViewProps } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* LearningPathView Component
|
|
12
|
+
*
|
|
13
|
+
* Displays a learning path with progress tracking and step navigation.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { LearningPathView } from 'learngraph/components';
|
|
18
|
+
*
|
|
19
|
+
* function PathToAlgebra() {
|
|
20
|
+
* const { steps } = useLearningPath({
|
|
21
|
+
* targetSkillId: 'algebra-101',
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* return (
|
|
25
|
+
* <LearningPathView
|
|
26
|
+
* steps={steps}
|
|
27
|
+
* targetSkillName="Algebra Basics"
|
|
28
|
+
* viewMode="timeline"
|
|
29
|
+
* onStepClick={(step) => console.log('Selected:', step.skill.name)}
|
|
30
|
+
* onStartStep={(step) => startLesson(step.skill.id)}
|
|
31
|
+
* showProgress
|
|
32
|
+
* showTimeEstimates
|
|
33
|
+
* />
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const LearningPathView: FC<LearningPathViewProps>;
|
|
39
|
+
export default LearningPathView;
|
|
40
|
+
//# sourceMappingURL=LearningPathView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LearningPathView.d.ts","sourceRoot":"","sources":["../../../src/components/LearningPathView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAY,MAAM,YAAY,CAAC;AA+UlE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAgMtD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProgressDashboard Component
|
|
3
|
+
*
|
|
4
|
+
* Dashboard showing learning progress and statistics.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import { type FC } from 'react';
|
|
9
|
+
import type { ProgressDashboardProps } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* ProgressDashboard Component
|
|
12
|
+
*
|
|
13
|
+
* Comprehensive dashboard for tracking learning progress.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { ProgressDashboard } from 'learngraph/components';
|
|
18
|
+
*
|
|
19
|
+
* function Dashboard() {
|
|
20
|
+
* return (
|
|
21
|
+
* <ProgressDashboard
|
|
22
|
+
* stats={{
|
|
23
|
+
* totalSkills: 50,
|
|
24
|
+
* masteredSkills: 15,
|
|
25
|
+
* inProgressSkills: 5,
|
|
26
|
+
* availableSkills: 10,
|
|
27
|
+
* totalLearningTime: 480,
|
|
28
|
+
* averageMastery: 0.72,
|
|
29
|
+
* streakDays: 7,
|
|
30
|
+
* weeklyProgress: 3,
|
|
31
|
+
* }}
|
|
32
|
+
* bloomProgress={[
|
|
33
|
+
* { level: 'remember', total: 10, mastered: 8, percentage: 80 },
|
|
34
|
+
* { level: 'understand', total: 12, mastered: 5, percentage: 42 },
|
|
35
|
+
* // ...
|
|
36
|
+
* ]}
|
|
37
|
+
* recentActivity={activities}
|
|
38
|
+
* dueForReview={reviewSkills}
|
|
39
|
+
* recommendations={recommendedSkills}
|
|
40
|
+
* showDetailedStats
|
|
41
|
+
* showActivityFeed
|
|
42
|
+
* />
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const ProgressDashboard: FC<ProgressDashboardProps>;
|
|
48
|
+
export default ProgressDashboard;
|
|
49
|
+
//# sourceMappingURL=ProgressDashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressDashboard.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EACV,sBAAsB,EAIvB,MAAM,YAAY,CAAC;AA8bpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAuHxD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|