Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs #38

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/A_brief_introduction/A_brief_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ In the [demo](https://chenyangkang.github.io/stemflow/Examples/01.AdaSTEM_demo.h
In the first case, the classifier and regressor "talk" to each other in each separate stixel (hereafter, "hurdle in Ada"); In the second case, the classifiers and regressors form two "unions" separately, and these two unions only "talk" to each other at the final combination, instead of in each stixel (hereafter, "Ada in hurdle"). In [Johnston (2015)](https://esajournals.onlinelibrary.wiley.com/doi/full/10.1890/14-1826.1) the first method was used. See section "[Hurdle in AdaSTEM or AdaSTEM in hurdle?](https://chenyangkang.github.io/stemflow/Examples/05.Hurdle_in_ada_or_ada_in_hurdle.html)" for further comparisons.

## Choose the gird size
User can define the size of the stixels (spatial temporal grids) in terms of space and time. Larger stixel promotes generalizability but loses precision in fine resolution; Smaller stixel may have better predictability in the exact area but reduced ability of extrapolation for points outside the stixel. See section [Optimizing stixel size](https://chenyangkang.github.io/stemflow/Examples/07.Optimizing_stixel_size.html) for discussion about selecting gridding parameters.
User can define the size of the stixels (spatial temporal grids) in terms of space and time. Larger stixel promotes generalizability but loses precision in fine resolution; Smaller stixel may have better predictability in the exact area but reduced ability of extrapolation for points outside the stixel. See section [Optimizing stixel size](https://chenyangkang.github.io/stemflow/Examples/07.Optimizing_stixel_size.html) for discussion about selecting gridding parameters and [Tips for spatiotemporal indexing](https://chenyangkang.github.io/stemflow/Tips/Tips_for_spatiotemporal_indexing.html).

## A simple demo
In the demo, we first split the training data using temporal sliding windows with a size of 50 day of year (DOY) and step of 20 DOY (`temporal_start = 1`, `temporal_end=366`, `temporal_step=20`, `temporal_bin_interval=50`). For each temporal slice, a spatial gridding is applied, where we force the stixel to be split into smaller 1/4 pieces if the edge is larger than 25 units (measured in longitude and latitude, `grid_len_upper_threshold=25`), and stop splitting to prevent the edge length being chunked below 5 units (`grid_len_lower_threshold=5`) or containing less than 50 checklists (`points_lower_threshold=50`). Model fitting is run using 1 core (`njobs=1`).
Expand Down
14 changes: 14 additions & 0 deletions docs/Examples/04.SphereAdaSTEM_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46406,6 +46406,20 @@
"model.gridding_plot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Sphere Gridding](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.png)\n",
"\n",
"Here for an interactive plot [Interactive spherical gridding plot](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.html)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
Expand Down
2 changes: 1 addition & 1 deletion docs/Tips/Tips_for_spatiotemporal_indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ model = SphereAdaSTEMRegressor(

See [SphereAdaSTEM demo](https://chenyangkang.github.io/stemflow/Examples/04.SphereAdaSTEM_demo.html) and [Interactive spherical gridding plot](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.html).

![Sphere Gridding](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.png)
![Sphere Gridding](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.png){: style="display: block; margin: auto; width: 50%;"}

-----
## References:
Expand Down
Binary file modified docs/assets/Untitled-1.psd
Binary file not shown.
Binary file modified docs/assets/logo_with_words.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Here, each color shows an ensemble generated during model fitting. In each of th

If you use `SphereAdaSTEM` module, the gridding plot is a `plotly` generated interactive object by default:

![Sphere Gridding](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.png)
![Sphere Gridding](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.png){: style="display: block; margin: auto; width: 50%;"}

See [SphereAdaSTEM demo](https://chenyangkang.github.io/stemflow/Examples/04.SphereAdaSTEM_demo.html) and [Interactive spherical gridding plot](https://chenyangkang.github.io/stemflow/assets/Sphere_gridding.html).

Expand Down
3 changes: 1 addition & 2 deletions stemflow/model/SphereAdaSTEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,7 @@ def __init__(
plot_empty,
)

def predict(self, *args, **kwargs):
return AdaSTEMClassifier().predict(*args, **kwargs)
self.predict = MethodType(AdaSTEMClassifier.predict, self)


class SphereAdaSTEMRegressor(SphereAdaSTEM):
Expand Down
6 changes: 3 additions & 3 deletions stemflow/utils/sphere_quadtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def get_ensemble_sphere_quadtree(
x, y, z = lonlat_cartesian_3D_transformer.transform(
sub_data["longitude"], sub_data["latitude"], radius=radius
)
sub_data["x_3D"] = x
sub_data["y_3D"] = y
sub_data["z_3D"] = z
sub_data.loc[:, "x_3D"] = x
sub_data.loc[:, "y_3D"] = y
sub_data.loc[:, "z_3D"] = z

QT_obj = Sphere_QTree(
grid_len_upper_threshold=grid_len_upper_threshold,
Expand Down
Loading