... | @@ -71,9 +71,11 @@ sample = bn.sample(5000, parall_count=5) |
... | @@ -71,9 +71,11 @@ sample = bn.sample(5000, parall_count=5) |
|
|
|
|
|
### Sampling with K2 + GMM + logit nodes example
|
|
### Sampling with K2 + GMM + logit nodes example
|
|
|
|
|
|
|
|
To sample using K2 with GMM and logit nodes the following code can be used:
|
|
|
|
|
|
~~~python
|
|
~~~python
|
|
train, validation = train_test_split(data, test_size=0.1)
|
|
train, validation = train_test_split(data, test_size=0.1)
|
|
bn = Nets.HybridBN(has_logit=True, use_mixture=False)
|
|
bn = Nets.HybridBN(has_logit=True, use_mixture=True)
|
|
bn.add_nodes(info)
|
|
bn.add_nodes(info)
|
|
bn.add_edges(discretized_data, scoring_function=('K2',K2Score))
|
|
bn.add_edges(discretized_data, scoring_function=('K2',K2Score))
|
|
bn.fit_parameters(train)
|
|
bn.fit_parameters(train)
|
... | @@ -89,6 +91,23 @@ sample = bn.sample(5000, parall_count=5) |
... | @@ -89,6 +91,23 @@ sample = bn.sample(5000, parall_count=5) |
|
|
|
|
|
### K2 with initial structure sampling
|
|
### K2 with initial structure sampling
|
|
|
|
|
|
|
|
To sample using K2 and initial structure the following code can be used:
|
|
|
|
|
|
|
|
~~~python
|
|
|
|
params = {'init_nodes': ['Tectonic regime', 'Period', 'Lithology', 'Structural setting', 'Gross','Netpay', 'Porosity','Permeability', 'Depth'],
|
|
|
|
'init_edges':[('Period', 'Permeability'), ('Structural setting', 'Netpay'), ('Gross', 'Permeability')],}
|
|
|
|
|
|
|
|
train, validation = train_test_split(data, test_size=0.1)
|
|
|
|
bn = Nets.HybridBN(has_logit=True, use_mixture=True)
|
|
|
|
bn.add_nodes(info)
|
|
|
|
bn.add_edges(discretized_data, scoring_function=('K2',K2Score), params=params)
|
|
|
|
bn.fit_parameters(train)
|
|
|
|
# prediction
|
|
|
|
val_pred = bn.predict(validation.iloc[:,:8], 5)
|
|
|
|
# sampling
|
|
|
|
sample = bn.sample(5000, parall_count=5)
|
|
|
|
~~~
|
|
|
|
|
|
<img width="489" alt="K2 + initial geo" src="https://user-images.githubusercontent.com/86363785/188191568-7d3d6ea5-3e41-458b-b472-321575080c93.png">
|
|
<img width="489" alt="K2 + initial geo" src="https://user-images.githubusercontent.com/86363785/188191568-7d3d6ea5-3e41-458b-b472-321575080c93.png">
|
|
|
|
|
|
![geo_k2_expert](https://user-images.githubusercontent.com/86363785/188129863-b8777153-eb31-4e8f-b8bf-b87e7c959035.png)
|
|
![geo_k2_expert](https://user-images.githubusercontent.com/86363785/188129863-b8777153-eb31-4e8f-b8bf-b87e7c959035.png)
|
... | | ... | |