public static TreeScore NumericHypothesisTest(DAG dag, AST.Range rangeNode, AST.Address functionNode, FunctionOutput <string>[] boots, string initial_output, bool weighted, double significance) { // this function's input cells var input_cells = rangeNode.Addresses(); var inputs_sz = input_cells.Count(); // scores var input_exclusion_scores = new TreeScore(); // convert to numeric var numeric_boots = ConvertToNumericOutput(boots); // sort var sorted_num_boots = SortBootstraps(numeric_boots); // for each excluded index, test whether the original input // falls outside our bootstrap confidence bounds for (int i = 0; i < inputs_sz; i++) { // default weight int weight = 1; // add weight to score if test fails AST.Address xtree = input_cells[i]; if (weighted) { // the weight of the function value of interest weight = dag.getWeight(functionNode); } double outlieriness = RejectNullHypothesis(sorted_num_boots, initial_output, i, significance); if (outlieriness != 0.0) { // get the xth indexed input in input_rng i if (input_exclusion_scores.ContainsKey(xtree)) { input_exclusion_scores[xtree] += (int)(weight * outlieriness); } else { input_exclusion_scores.Add(xtree, (int)(weight * outlieriness)); } } else { // we need to at least add the value to the tree if (!input_exclusion_scores.ContainsKey(xtree)) { input_exclusion_scores.Add(xtree, 0); } } } return(input_exclusion_scores); }
public void threadPoolCallback(Object threadContext) { // perform hypothesis tests hypothesisTests(); // OK to dealloc fields; this object lives on because it is // needed for job control _bs = null; _initial_outputs = null; _input = null; _outputs = null; // notify _mre.Set(); }
public static TreeScore StringHypothesisTest(DAG dag, AST.Range rangeNode, AST.Address functionNode, FunctionOutput <string>[] boots, string initial_output, bool weighted, double significance) { // this function's input cells var input_cells = rangeNode.Addresses(); // scores var iexc_scores = new TreeScore(); var inputs_sz = input_cells.Count(); // exclude each index, in turn for (int i = 0; i < inputs_sz; i++) { // default weight int weight = 1; // add weight to score if test fails AST.Address xtree = input_cells[i]; if (weighted) { // the weight of the function value of interest weight = dag.getWeight(functionNode); } if (RejectNullHypothesis(boots, initial_output, i, significance)) { if (iexc_scores.ContainsKey(xtree)) { iexc_scores[xtree] += weight; } else { iexc_scores.Add(xtree, weight); } } else { // we need to at least add the value to the tree if (!iexc_scores.ContainsKey(xtree)) { iexc_scores.Add(xtree, 0); } } } return(iexc_scores); }
private TreeScore _score; // dict of exclusion scores for each input CELL TreeNode public DataDebugJob( DAG dag, FunctionOutput <String>[][] bs, Dictionary <AST.Address, string> initial_outputs, AST.Range input, AST.Address[] output_arr, bool weighted, double significance, ManualResetEvent mre) { _dag = dag; _bs = bs; _initial_outputs = initial_outputs; _input = input; _outputs = output_arr; _weighted = weighted; _significance = significance; _mre = mre; _score = new TreeScore(); }
public DataDebugJob( DAG dag, FunctionOutput<String>[][] bs, Dictionary<AST.Address, string> initial_outputs, AST.Range input, AST.Address[] output_arr, bool weighted, double significance, ManualResetEvent mre) { _dag = dag; _bs = bs; _initial_outputs = initial_outputs; _input = input; _outputs = output_arr; _weighted = weighted; _significance = significance; _mre = mre; _score = new TreeScore(); }