GeoXCP
Geospatial eXplanation Conformal Prediction (GeoXCP) is a powerful framework to measure uncertainty of spatial explanations.
Usage
from GeoConformalizedExplainer import GeoConformalizedExplainer
from xgboost import XGBRegressor
from sklearn.model_selection import train_test_split
import pandas as pd
data = pd.read_csv('...')
X_geo = data[['X1', 'X2', 'X3', 'X4', 'X5']]
y = data['y']
loc = data[['lon', 'lat']]
X_train, X_temp, y_train, y_temp, _, loc_temp = train_test_split(X_geo, y, loc, train_size=0.8, random_state=42)
X_calib, X_test, y_calib, y_test, loc_calib, loc_test = train_test_split(X_geo, y, loc_temp, train_size=0.5, random_state=42)
feature_names = X_geo.columns
# Fit a XGBoost Regressor model
model = XGBRegressor().fit(X_train, y_train)
# Initialize a GeoXCP Explainer
explainer = GeoConformalizedExplainer(prediction_f=model.predict,
x_train=X_train,
x_calib=X_calib,
coord_calib=loc_calib.values,
miscoverage_level=0.1,
band_width=0.3,
feature_names=feature_names)
# Explain the data with uncertainty
results = explainer.uncertainty_aware_explain(x_test=X_test, coord_test=loc_test)
# Make an accuracy summary
results.accuracy_summary()
# Convert the results into GeoPandas GeoDataFrame format
pred_results = results.result_geo
# Plot the shap values with uncertainty for certain location
results.plot_shap_values_with_uncertainty(i=20)
# Plot the spatial distribution of uncertainty
results.plot_geo_uncertainty()
Metadata
Release files for GeoXCP 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geoxcp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for geoxcp-1.0.0-py3-none-any.whl |
Release files / geoxcp-1.0.0-py3-none-any.whl
| Download URL | geoxcp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2937902e834c893d744ed9fe094b6c19476dfc22ab3f396cbb1afa6daa24b62
|
|
BLAKE2b-256 checksum How to use checksums |
ab79fa30de1b3ef822d061a17e2403fd5e49f3366df70d96a6ef2b4b134d4525
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.16
|
Security for GeoXCP 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.