-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chenyangkang
committed
Aug 24, 2023
1 parent
6460043
commit 9f8ba31
Showing
2 changed files
with
84 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,50 @@ | ||
# Quick Start | ||
|
||
## Installation | ||
<!-- ## Installation | ||
``` | ||
pip install birdstem | ||
``` | ||
## test on sample data | ||
``` | ||
import birdstem as bs | ||
``` | ||
``` --> | ||
|
||
|
||
## Fit an AdaSTEM model | ||
```py | ||
from BirdSTEM.model.AdaSTEM import AdaSTEM, AdaSTEMHurdle | ||
from BirdSTEM.model.Hurdle import Hurdle | ||
from xgboost import XGBClassifier, XGBRegressor | ||
|
||
SAVE_DIR = './' | ||
|
||
base_model = Hurdle(classifier=XGBClassifier(tree_method='hist',random_state=42, verbosity = 0, n_jobs=1), | ||
regressor=XGBRegressor(tree_method='hist',random_state=42, verbosity = 0, n_jobs=1)) | ||
|
||
|
||
model = AdaSTEMHurdle(base_model=base_model, | ||
ensemble_fold = 10, | ||
min_ensemble_required= 7, | ||
grid_len_lon_upper_threshold=50, | ||
grid_len_lon_lower_threshold=10, | ||
grid_len_lat_upper_threshold=50, | ||
grid_len_lat_lower_threshold=10, | ||
points_lower_threshold = 50, | ||
temporal_start = 0, temporal_end=1400, temporal_step=100, temporal_bin_interval = 100, | ||
stixel_training_size_threshold = 50, ## important, should be consistent with points_lower_threshold | ||
save_gridding_plot = True, | ||
save_tmp = True, | ||
save_dir=SAVE_DIR, | ||
sample_weights_for_classifier=True) | ||
|
||
## fit | ||
model.fit(X_train,y_train) | ||
|
||
## predict | ||
pred_mean, pred_std = model.predict(X_test) | ||
pred_mean = np.where(pred_mean>0, pred_mean, 0) | ||
eval_metrics = AdaSTEM.eval_STEM_res('hurdle',y_test, pred_mean) | ||
print(eval_metrics) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,52 @@ | ||
# Welcome to MkDocs | ||
# Welcome to BirdSTEM | ||
|
||
For full documentation visit [mkdocs.org](https://www.mkdocs.org). | ||
<!-- For full documentation visit [mkdocs.org](https://www.mkdocs.org). --> | ||
|
||
## Commands | ||
|
||
* `mkdocs new [dir-name]` - Create a new project. | ||
* `mkdocs serve` - Start the live-reloading docs server. | ||
* `mkdocs build` - Build the documentation site. | ||
* `mkdocs -h` - Print help message and exit. | ||
## Installation | ||
|
||
## Project layout | ||
## Fit an AdaSTEM model | ||
```py | ||
from BirdSTEM.model.AdaSTEM import AdaSTEM, AdaSTEMHurdle | ||
from BirdSTEM.model.Hurdle import Hurdle | ||
from xgboost import XGBClassifier, XGBRegressor | ||
|
||
SAVE_DIR = './' | ||
|
||
base_model = Hurdle(classifier=XGBClassifier(tree_method='hist',random_state=42, verbosity = 0, n_jobs=1), | ||
regressor=XGBRegressor(tree_method='hist',random_state=42, verbosity = 0, n_jobs=1)) | ||
|
||
|
||
model = AdaSTEMHurdle(base_model=base_model, | ||
ensemble_fold = 10, | ||
min_ensemble_required= 7, | ||
grid_len_lon_upper_threshold=50, | ||
grid_len_lon_lower_threshold=10, | ||
grid_len_lat_upper_threshold=50, | ||
grid_len_lat_lower_threshold=10, | ||
points_lower_threshold = 50, | ||
temporal_start = 0, temporal_end=1400, temporal_step=100, temporal_bin_interval = 100, | ||
stixel_training_size_threshold = 50, ## important, should be consistent with points_lower_threshold | ||
save_gridding_plot = True, | ||
save_tmp = True, | ||
save_dir=SAVE_DIR, | ||
sample_weights_for_classifier=True) | ||
|
||
## fit | ||
model.fit(X_train,y_train) | ||
|
||
## predict | ||
pred_mean, pred_std = model.predict(X_test) | ||
pred_mean = np.where(pred_mean>0, pred_mean, 0) | ||
eval_metrics = AdaSTEM.eval_STEM_res('hurdle',y_test, pred_mean) | ||
print(eval_metrics) | ||
|
||
``` | ||
|
||
<!-- ## Project layout | ||
mkdocs.yml # The configuration file. | ||
docs/ | ||
index.md # The documentation homepage. | ||
... # Other markdown pages, images and other files. | ||
... # Other markdown pages, images and other files. --> |