Skip to content

OrthoForest spend days working without result #562

@juandavidgutier

Description

@juandavidgutier

Hello everyone,

I am running OrthoForest from DoWhy but it is running for days without result. I get this message:

"2022-01-16 20:57:41.811540: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2022-01-16 20:57:41.811571: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine."

Any idea how to solve it?

Here is the dataset:
new_incidence_sd_BC_test2_ml.csv

This is my code:

`

importing required libraries

import os, warnings, random
import dowhy
import econml
from dowhy import CausalModel
import pandas as pd
import numpy as np

data = pd.read_csv("new_incidence_sd_BC_test2_ml.csv")
#data_inf = data_inf.astype({"treatment":'bool'}, copy=False)
data = data.dropna()

#data['treatment'] = data['treatment']*1000000000 #micrograms
data_inf = data.drop(['X2','X3','X4'], axis=1)
data_inf.head()

#Step 1: Modeling the causal mechanism
#model with acumm PM2.5 as treatment, GEI and Temperatura(W) as common causes, Rainfall_accum2s as instrument
model_inf=CausalModel(
data = data_inf,
treatment=['treatment'],
outcome='y',
instruments=['Z1', 'Z2'],
common_causes=['W1', 'W2'],
#common_causes=data_inf[['W1','W2']].to_numpy().reshape(-1, 2),
#effect_modifiers=Xs.split('+'),
effect_modifiers= ['X1'],
graph= "digraph {W1->treatment;W1->y;W2->treatment;W2->y;Z1->treatment;Z2->treatment;W2->W1;treatment->y;X1->y;}"
)

#view model
model_inf.view_model()

#Step 2: Identifying effects
identified_estimand = model_inf.identify_effect(proceed_when_unidentifiable=True)
print(identified_estimand)

#Step 3: Estimation of the effect
#with OrthoForest
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.linear_model import LassoCV
from econml.orf import DMLOrthoForest
from econml.sklearn_extensions.linear_model import WeightedLassoCVWrapper

#step 3: Estimation of the effect
orf_estimate_bd = model_inf.estimate_effect(identified_estimand,
#test_significance=True,
confidence_intervals=True,
method_name="backdoor.econml.orf.DMLOrthoForest",
method_params={
'init_params': {'n_trees':250,
'min_leaf_size':20,
'max_depth':10,
#'bootstrap':True,
'lambda_reg':0.01,
'random_state':123,
'model_Y':GradientBoostingRegressor(),
'model_T': GradientBoostingRegressor(),
'model_T_final':None, #WeightedLassoCVWrapper(cv=3),
'model_Y_final':None,}, #WeightedLassoCVWrapper(cv=3),
'fit_params': {}
})

print(orf_estimate_bd)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions