MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / test_helper

Function test_helper

ciphercore-base/src/ops/auc.rs:204–225  ·  view source on GitHub ↗
(y_true: Vec<i64>, y_pred: Vec<i64>)

Source from the content-addressed store, hash-verified

202 use crate::graphs::util::simple_context;
203
204 fn test_helper(y_true: Vec<i64>, y_pred: Vec<i64>) -> Result<f64> {
205 let array_t = array_type(vec![y_true.len() as u64], INT64);
206 let c = simple_context(|g| {
207 let y_true = g.input(array_t.clone())?;
208 let y_pred = g.input(array_t)?;
209 g.custom_op(
210 CustomOperation::new(AucScore {
211 fp: FixedPrecisionConfig::default(),
212 }),
213 vec![y_true, y_pred],
214 )
215 })?;
216 let mapped_c = run_instantiation_pass(c)?;
217 let result = random_evaluate(
218 mapped_c.get_context().get_main_graph()?,
219 vec![
220 Value::from_flattened_array(&y_true, INT64)?,
221 Value::from_flattened_array(&y_pred, INT64)?,
222 ],
223 )?;
224 Ok(result.to_i64(INT64)? as f64 / FixedPrecisionConfig::default().denominator_f64())
225 }
226
227 #[test]
228 fn test_auc_simple_case() -> Result<()> {

Callers 3

test_auc_simple_caseFunction · 0.70
test_auc_large_arrayFunction · 0.70

Calls 11

simple_contextFunction · 0.85
run_instantiation_passFunction · 0.85
random_evaluateFunction · 0.85
cloneMethod · 0.80
to_i64Method · 0.80
denominator_f64Method · 0.80
array_typeFunction · 0.50
inputMethod · 0.45
custom_opMethod · 0.45
get_main_graphMethod · 0.45
get_contextMethod · 0.45

Tested by

no test coverage detected