pip install py-geodetector
A quick example of geodetector usage is given in the ./example.ipynb.
from py_geodetector import load_example_data, GeoDetector
# load example data
df = load_example_data()
gd = GeoDetector(df)
# factor detect
factor_df = gd.factor_dector()
# interaction detect
interaction_df = gd.interaction_detector()
# or you can generate the interaction relationship as the same time
interaction_df, interaction_relationship_df = gd.interaction_detector(relationship=True)
# ecological detect
ecological_df = gd.ecological_detector()
# risk detect
risk_result = gd.risk_detector()
# plot
gd.plot(value_fontsize=14, tick_fontsize=16, colorbar_fontsize=14);
This is the visualization of the results of interactive detection. The interactive detection results are visualized by heat map, and the red text indicates that the ecological detection results show a significant difference.
@article{wang2010geographical,
title={Geographical detectors-based health risk assessment and its application in the neural tube defects study of the Heshun Region, China},
author={Wang, Jin-Feng and Li, Xin-Hu and Christakos, George and Liao, Yi-Lan and Zhang, Tin and Gu, Xue and Zheng, Xiao-Ying},
journal={International Journal of Geographical Information Science},
volume={24},
number={1},
pages={107-127},
year={2010},
publisher={Taylor \& Francis}
}