Skip to content

Commit

Permalink
update to detector template, clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
d19fe8 committed Jun 25, 2017
1 parent 20157bb commit 591730d
Show file tree
Hide file tree
Showing 12 changed files with 428 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down Expand Up @@ -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;
Expand Down
38 changes: 34 additions & 4 deletions HTML/Assets/Detectors/Lumilo/Idle/idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
28 changes: 24 additions & 4 deletions HTML/Assets/Detectors/Lumilo/Struggle/struggle__moving_average.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand Down Expand Up @@ -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"
Expand All @@ -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);
}
Expand Down
44 changes: 36 additions & 8 deletions HTML/Assets/Detectors/bkt_models/BKT.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 591730d

Please sign in to comment.