-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Advanced "A essential in B for C" attributes in decision trees.
- Loading branch information
Showing
6 changed files
with
214 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
use crate::bdt::{BifurcationFunction, Attribute}; | ||
use biodivine_lib_param_bn::symbolic_async_graph::GraphColors; | ||
use crate::bdt::{Attribute, BifurcationFunction}; | ||
use crate::util::functional::Functional; | ||
use biodivine_lib_param_bn::symbolic_async_graph::GraphColors; | ||
use biodivine_lib_std::param_graph::Params; | ||
use std::collections::HashMap; | ||
|
||
impl Attribute { | ||
|
||
/// Apply this attribute to the given bifurcation function, splitting it into two. | ||
pub fn split_function(&self, classes: &BifurcationFunction) -> (BifurcationFunction, BifurcationFunction) { | ||
(Self::restrict(classes, &self.negative), Self::restrict(classes, &self.positive)) | ||
pub fn split_function( | ||
&self, | ||
classes: &BifurcationFunction, | ||
) -> (BifurcationFunction, BifurcationFunction) { | ||
( | ||
Self::restrict(classes, &self.negative), | ||
Self::restrict(classes, &self.positive), | ||
) | ||
} | ||
|
||
/// Restrict given bifurcation function using the specified attribute parameter set. | ||
fn restrict(classes: &BifurcationFunction, attribute: &GraphColors) -> BifurcationFunction { | ||
classes.iter() | ||
.filter_map(|(c,p)| { | ||
classes | ||
.iter() | ||
.filter_map(|(c, p)| { | ||
(c.clone(), attribute.intersect(p)).take_if(|(_, c)| !c.is_empty()) | ||
}) | ||
.collect::<HashMap<_, _>>() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.