From 591730d86f06703d1d58c64eff89b066a21ac1d1 Mon Sep 17 00:00:00 2001 From: Ken Holstein Date: Sun, 25 Jun 2017 13:24:25 -0400 Subject: [PATCH] update to detector template, clean up --- .../Critical_Struggle/critical_struggle.js | 43 +++++++++++++-- HTML/Assets/Detectors/Lumilo/Idle/idle.js | 38 ++++++++++++-- .../invisible_hand_raise.js | 43 +++++++++++++-- .../Struggle/struggle__moving_average.js | 28 ++++++++-- .../student_doing_well__moving_average.js | 18 +++++-- HTML/Assets/Detectors/bkt_models/BKT.js | 44 +++++++++++++--- HTML/Assets/Detectors/currentAttemptCount.js | 52 ++++++++++++++++--- .../lynnette_error_category_frequency.js | 44 ++++++++++++++-- .../Detectors/help_models/help_model.js | 41 +++++++++++++-- .../help_models/help_model_try_if_low.js | 43 ++++++++++++--- HTML/Assets/Detectors/stagnation.js | 45 +++++++++++++--- HTML/Assets/detector_template.js | 51 ++++++++++++++++-- 12 files changed, 428 insertions(+), 62 deletions(-) diff --git a/HTML/Assets/Detectors/Lumilo/Critical_Struggle/critical_struggle.js b/HTML/Assets/Detectors/Lumilo/Critical_Struggle/critical_struggle.js index 17cad5c..7a16951 100644 --- a/HTML/Assets/Detectors/Lumilo/Critical_Struggle/critical_struggle.js +++ b/HTML/Assets/Detectors/Lumilo/Critical_Struggle/critical_struggle.js @@ -15,8 +15,22 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = "" +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + + +//declare and/or initialize any other custom global variables for this detector here +// +// +// +// +// function frustrated_for_a_while(){ @@ -111,20 +125,41 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = false; // // - detectorForget = false; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break; diff --git a/HTML/Assets/Detectors/Lumilo/Idle/idle.js b/HTML/Assets/Detectors/Lumilo/Idle/idle.js index 2c65c71..d755b3a 100644 --- a/HTML/Assets/Detectors/Lumilo/Idle/idle.js +++ b/HTML/Assets/Detectors/Lumilo/Idle/idle.js @@ -15,8 +15,17 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = ""; +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + + +//declare and/or initialize any other custom global variables for this detector here var timerId var timerId2 var timerId3 @@ -127,20 +136,41 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = true; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break; diff --git a/HTML/Assets/Detectors/Lumilo/Invisible_Hand_Raise/invisible_hand_raise.js b/HTML/Assets/Detectors/Lumilo/Invisible_Hand_Raise/invisible_hand_raise.js index 544d65c..db4c81c 100644 --- a/HTML/Assets/Detectors/Lumilo/Invisible_Hand_Raise/invisible_hand_raise.js +++ b/HTML/Assets/Detectors/Lumilo/Invisible_Hand_Raise/invisible_hand_raise.js @@ -15,8 +15,22 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = "" +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + + +//declare and/or initialize any other custom global variables for this detector here +// +// +// +// +// function receive_transaction( e ){ //e is the data of the transaction from mailer from transaction assembler @@ -85,20 +99,41 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = true; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break; diff --git a/HTML/Assets/Detectors/Lumilo/Struggle/struggle__moving_average.js b/HTML/Assets/Detectors/Lumilo/Struggle/struggle__moving_average.js index f674d7f..c3c9bf0 100644 --- a/HTML/Assets/Detectors/Lumilo/Struggle/struggle__moving_average.js +++ b/HTML/Assets/Detectors/Lumilo/Struggle/struggle__moving_average.js @@ -15,14 +15,19 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = "" + +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +var attemptWindow; + +//declare and/or initialize any other custom global variables for this detector here var attemptCorrect; var windowSize = 7; var threshold = 1; -var attemptWindow = Array.apply(null, Array(windowSize)).map(Number.prototype.valueOf,1); var timerId; var timerId2; var timerId3; var timerId4; var timerId5; + function receive_transaction( e ){ //e is the data of the transaction from mailer from transaction assembler @@ -135,7 +140,7 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" @@ -144,11 +149,26 @@ self.onmessage = function ( e ) { // // detectorForget = false; + // + // if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + attemptWindow = Array.apply(null, Array(windowSize)).map(Number.prototype.valueOf,1); + } + else{ + attemptWindow = JSON.parse(detector_output.history); + } + break; default: break; diff --git a/HTML/Assets/Detectors/Lumilo/Student_Doing_Well/student_doing_well__moving_average.js b/HTML/Assets/Detectors/Lumilo/Student_Doing_Well/student_doing_well__moving_average.js index 0bd0118..2943e48 100644 --- a/HTML/Assets/Detectors/Lumilo/Student_Doing_Well/student_doing_well__moving_average.js +++ b/HTML/Assets/Detectors/Lumilo/Student_Doing_Well/student_doing_well__moving_average.js @@ -15,12 +15,15 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = "" +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +var attemptWindow; + +//declare and/or initialize any other custom global variables for this detector here var attemptCorrect; var windowSize = 7; var threshold = 6; -var attemptWindow; function receive_transaction( e ){ @@ -88,7 +91,7 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" @@ -97,12 +100,19 @@ self.onmessage = function ( e ) { // // detectorForget = false; + // + // if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // if (detector_output.history == "" || detector_output.history == null){ attemptWindow = Array.apply(null, Array(windowSize)).map(Number.prototype.valueOf,0); } diff --git a/HTML/Assets/Detectors/bkt_models/BKT.js b/HTML/Assets/Detectors/bkt_models/BKT.js index f46e2eb..55dbdcc 100644 --- a/HTML/Assets/Detectors/bkt_models/BKT.js +++ b/HTML/Assets/Detectors/bkt_models/BKT.js @@ -15,13 +15,17 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = ""; -var BKTparams = {p_transit: 0.2, - p_slip: 0.1, - p_guess: 0.2, - p_know: 0.3}; + +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +var BKTparams; + +//declare and/or initialize any other custom global variables for this detector here... var pastSteps = {}; +// +//[optional] single out TUNABLE PARAMETERS below +// function clone(obj) { var copy; @@ -152,20 +156,44 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = false; // // - detectorForget = false; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + BKTparams = {p_transit: 0.2, + p_slip: 0.1, + p_guess: 0.2, + p_know: 0.3}; + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + BKTparams = JSON.parse(detector_output.history); + } + break; default: break; diff --git a/HTML/Assets/Detectors/currentAttemptCount.js b/HTML/Assets/Detectors/currentAttemptCount.js index 99a8ed5..44f7058 100644 --- a/HTML/Assets/Detectors/currentAttemptCount.js +++ b/HTML/Assets/Detectors/currentAttemptCount.js @@ -12,16 +12,30 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = "" +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + +//declare and/or initialize any other custom global variables for this detector here... +// +// +// +// +// +//[optional] single out TUNABLE PARAMETERS below +// +// +// +// function receive_transaction( e ){ //e is the data of the transaction from mailer from transaction assembler - //TEST CODE - console.log("in detector1 with data:"); - console.log(e.data); - //set conditions under which transaction should be processed //(i.e., to update internal state and history, without //necessarily updating external state and history) @@ -81,20 +95,42 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = true; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + + break; default: break; diff --git a/HTML/Assets/Detectors/error_categorizers/lynnette_error_category_frequency.js b/HTML/Assets/Detectors/error_categorizers/lynnette_error_category_frequency.js index 97876ca..757c5f5 100644 --- a/HTML/Assets/Detectors/error_categorizers/lynnette_error_category_frequency.js +++ b/HTML/Assets/Detectors/error_categorizers/lynnette_error_category_frequency.js @@ -17,7 +17,16 @@ var detector_output = {name: variableName, }; var mailer; -//custom global variables for this detector +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + +//declare and/or initialize any other custom global variables for this detector here... var prevStep = ""; var prevEq = ""; var currRow = 1; @@ -25,9 +34,13 @@ var currLeftCorrect = 0; var currRightCorrect = 0; var currLeft = "_______"; var currRight = "_______"; +// +//[optional] single out TUNABLE PARAMETERS below +// + // set canonicalization output mode (current example modes: "trackChanges", "changeBasedCanonicalize", canonicalize) + var outputMode = "canonicalize"; + -//set canonicalization output mode (current example modes: "trackChanges", "changeBasedCanonicalize", canonicalize) -var outputMode = "canonicalize"; function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); @@ -281,20 +294,41 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = false; // // - detectorForget = false; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break; diff --git a/HTML/Assets/Detectors/help_models/help_model.js b/HTML/Assets/Detectors/help_models/help_model.js index 9a5b420..e93f00f 100644 --- a/HTML/Assets/Detectors/help_models/help_model.js +++ b/HTML/Assets/Detectors/help_models/help_model.js @@ -15,21 +15,31 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = ""; + +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + +//declare and/or initialize any other custom global variables for this detector here... var help_variables = {"lastAction": "null", "lastActionTime": "", "seenAllHints": {}, "lastHintLength": "", "lastSenseOfWhatToDo": false }; -//TUNABLE PARAMETERS +//[optional] single out TUNABLE PARAMETERS below var errorThreshold = 3; //currently arbitrary var newStepThreshold = 3; //currently arbitrary var familiarityThreshold = 0.4; var senseOfWhatToDoThreshold = 0.6; var hintIsHelpfulPlaceholder = true; //currently a dummy value (assumption that hint is always helpful...) + //non-controversial function lastActionIsHint(e){ if (help_variables.lastAction == "hint"){return true;} @@ -253,20 +263,41 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = true; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break; diff --git a/HTML/Assets/Detectors/help_models/help_model_try_if_low.js b/HTML/Assets/Detectors/help_models/help_model_try_if_low.js index 2357ecd..41da796 100644 --- a/HTML/Assets/Detectors/help_models/help_model_try_if_low.js +++ b/HTML/Assets/Detectors/help_models/help_model_try_if_low.js @@ -15,22 +15,32 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = ""; +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + + +//declare and/or initialize any other custom global variables for this detector here... var help_variables = {"lastAction": "null", "lastActionTime": "", "seenAllHints": {}, "lastHintLength": "", "lastSenseOfWhatToDo": false }; - -//TUNABLE PARAMETERS +// +//[optional] single out TUNABLE PARAMETERS below var errorThreshold = 3; //currently arbitrary var newStepThreshold = 3; //currently arbitrary var familiarityThreshold = 0.4; var senseOfWhatToDoThreshold = 0.6; var hintIsHelpfulPlaceholder = true; //currently a dummy value (assumption that hint is always helpful...) + //non-controversial function lastActionIsHint(e){ if (help_variables.lastAction == "hint"){return true;} @@ -293,20 +303,41 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = true; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break; diff --git a/HTML/Assets/Detectors/stagnation.js b/HTML/Assets/Detectors/stagnation.js index 7e205f1..293d657 100644 --- a/HTML/Assets/Detectors/stagnation.js +++ b/HTML/Assets/Detectors/stagnation.js @@ -12,10 +12,21 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var timerId -var timerId2 -var timerId3 + +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + +//declare and/or initialize any other custom global variables for this detector here... +var timerId; var timerId2; var timerId3; +// +//[optional] single out TUNABLE PARAMETERS below +// function receive_transaction( e ){ @@ -94,20 +105,42 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = true; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + + break; default: break; diff --git a/HTML/Assets/detector_template.js b/HTML/Assets/detector_template.js index 41d6078..6dd0ae7 100644 --- a/HTML/Assets/detector_template.js +++ b/HTML/Assets/detector_template.js @@ -15,8 +15,29 @@ var detector_output = {name: variableName, }; var mailer; -//initialize any custom global variables for this detector here -var prevStep = "" + +//declare any custom global variables that will be initialized +//based on "remembered" values across problem boundaries, here +// (initialize these at the bottom of this file, inside of self.onmessage) +// +// +// +// +// + + +//declare and/or initialize any other custom global variables for this detector here... +// +// +// +// +// +//[optional] single out TUNABLE PARAMETERS below +// +// +// +// + function receive_transaction( e ){ //e is the data of the transaction from mailer from transaction assembler @@ -81,20 +102,42 @@ self.onmessage = function ( e ) { } } - //optional: Below, specify conditions under which a detector + + //optional: In "detectorForget", specify conditions under which a detector //should NOT remember their most recent value and history (using the variable "detectorForget"). //(e.g., setting the condition to "true" will mean that the detector // will always be reset between problems... and setting the condition to "false" // means that the detector will never be reset between problems) // + detectorForget = false; // // - detectorForget = true; if (detectorForget){ detector_output.history = ""; detector_output.value = 0; } + + + //optional: If any global variables are based on remembered values across problem boundaries, + // these initializations should be written here + // + // + if (detector_output.history == "" || detector_output.history == null){ + //in the event that the detector history is empty, + //initialize variables to your desired 'default' values + // + // + } + else{ + //if the detector history is not empty, you can access it via: + // JSON.parse(detector_output.history); + //...and initialize your variables to your desired values, based on + //this history + // + // + } + break; default: break;