Closed samanemami closed 1 year ago
Thansks for this interesting idea! Can you elaborate a bit more on this idea? Preferably with a small example, maybe a use case and which problem you aim to solve?
@erdogant Thank you for your kind reply.
For instance, we estimate the structure with chow-Liu. And of course, these are not the ideal dependencies and edges between the variable, hence we need to optimize the edges and update the following estimated DAG.
How do you want to optimize the edges?
bnlearn
does contain the independence_test
to determine significance. Do you want do this iteratively? Maybe something like the following sequential steps?
Yes, exactly. I want to add a sequential step as you mentioned Is there any method for this matter?
Ah great. Well it is not implemented but the most straightforward manner way is use a while loop.
# Load library
import bnlearn as bn
# Load example
df_raw = bn.import_example(data='titanic')
# Preprocessing raw dataset
dfhot, dfnum = bn.df2onehot(df_raw)
# start with empty blacklist
black_list = []
optimize = True
while optimize:
# Structure learning
model = bn.structure_learning.fit(dfnum, methodtype='cl', black_list= black_list, root_node='Survived', bw_list_method='nodes')
# Plot detected DAG
G = bn.plot(model)
# Compute edge strength using chi-square independence test and remove (prune) the not-signficant edges
model = bn.independence_test(model, dfnum, alpha=0.05, prune=True)
# Remove features from dfnum
black_list.append(remfeat)
# if converged, set optimize =False
Thank you so much @erdogant Great. Do you have any idea regarding the convergence?
After consideration, I would first look at the model graph after pruning using the independence test (thus without the while loop). Another idea would be to look at the structure score to determine which method has best score (and thus best graph). Maybe Chow Liu is not the best choice (?)
Thanks for the ideas @erdogant I used the independence test, but it wasn't promising! Considering another score would be interesting as well, I will try that.
What do you think about the following scenario;
Consider that we only need the idea of DAG
.
With this assumption;
1-We estimate the DAG using one of the approaches.
2-Fit Bayesian Network
on the DAG
.
3- Forward sampling
with Bayesian
.
4- Build the final (ideal) DAG
on the estimated instances from the sampling
.
This is a question rather than an issue. I was wondering if it is possible to update the edges and dag in a Chow-Liu procedure! I could not find any related method if there is one.
Would you please help me with this question?
I appreciate it, Thank you so much in advance.