Skip to content

Commit

Permalink
Aug 24
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyangkang committed Aug 24, 2023
1 parent 6460043 commit 9f8ba31
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 10 deletions.
43 changes: 41 additions & 2 deletions docs/QuickStart.md
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)

```
51 changes: 43 additions & 8 deletions docs/index.md
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. -->

0 comments on commit 9f8ba31

Please sign in to comment.