From 5044a88b6d993f9101532b670bc7548459ce0a39 Mon Sep 17 00:00:00 2001 From: AlessandroBregoli Date: Thu, 14 Apr 2022 09:09:11 +0200 Subject: [PATCH] refactor --- src/structure_learning/mod.rs | 2 +- src/structure_learning/score_based_algorithm.rs | 2 +- tests/structure_learning.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/structure_learning/mod.rs b/src/structure_learning/mod.rs index d72862d..a335101 100644 --- a/src/structure_learning/mod.rs +++ b/src/structure_learning/mod.rs @@ -4,7 +4,7 @@ use crate::network; use crate::tools; pub trait StructureLearningAlgorithm { - fn call(&self, net: T, dataset: &tools::Dataset) -> T + fn fit(&self, net: T, dataset: &tools::Dataset) -> T where T: network::Network; } diff --git a/src/structure_learning/score_based_algorithm.rs b/src/structure_learning/score_based_algorithm.rs index ed54092..63620fe 100644 --- a/src/structure_learning/score_based_algorithm.rs +++ b/src/structure_learning/score_based_algorithm.rs @@ -19,7 +19,7 @@ impl HillClimbing { } impl StructureLearningAlgorithm for HillClimbing { - fn call(&self, net: T, dataset: &tools::Dataset) -> T + fn fit(&self, net: T, dataset: &tools::Dataset) -> T where T: network::Network, { diff --git a/tests/structure_learning.rs b/tests/structure_learning.rs index e0e6d9b..4ce89a3 100644 --- a/tests/structure_learning.rs +++ b/tests/structure_learning.rs @@ -87,7 +87,7 @@ fn learn_ternary_net_2_nodes (sl: T) { let data = trajectory_generator(&net, 100, 20.0, Some(6347747169756259),); - let net = sl.call(net, &data); + let net = sl.fit(net, &data); assert_eq!(BTreeSet::from_iter(vec![n1]), net.get_parent_set(n2)); assert_eq!(BTreeSet::new(), net.get_parent_set(n1)); } @@ -164,7 +164,7 @@ fn learn_mixed_discrete_net_3_nodes (sl: T) { let data = trajectory_generator(&net, 300, 30.0, Some(6347747169756259),); - let net = sl.call(net, &data); + let net = sl.fit(net, &data); assert_eq!(BTreeSet::new(), net.get_parent_set(n1)); assert_eq!(BTreeSet::from_iter(vec![n1]), net.get_parent_set(n2));