Open hnasko opened 9 months ago
Hi @hnasko ,
It is possible to extract the posterior of the weights. Please refer to the getting_started notebook section 2.5 where this is discussed:
If you used the default Hamiltonian method then this code should retrieve the posterior samples averaged:
tf.reduce_mean(ci.model.components_by_name['SparseLinearRegression/'].params_to_weights(
ci.model_samples['SparseLinearRegression/_global_scale_variance'],
ci.model_samples['SparseLinearRegression/_global_scale_noncentered'],
ci.model_samples['SparseLinearRegression/_local_scale_variances'],
ci.model_samples['SparseLinearRegression/_local_scales_noncentered'],
ci.model_samples['SparseLinearRegression/_weights_noncentered'],
), axis=0)
Let me know if this solves for you.
Hi, thank you all your efforts in developing this library
Previously, we used Google's initial R library,
CausalImpact
, for causal inference. Now, we're in search of a good substitute for it in Python, and this library seems like an excellent option. In the initial R library, there is functionality to extract posterior inclusion probabilities of predictors from the trained model. We use these probabilities as additional descriptive statistics to fine-tune the model and exclude certain predictors from the control group.I'm curious if there's an approach to extract these posterior inclusion probabilities of predictors in
tfcausalimpact
. Your guidance on this matter would be immensely helpful.Just R code to demonstrate what exactly I mean: