elapid.models¶
Classes for training species distribution models.
EnsembleModel
¶
Bases: BaseEstimator
, SDMMixin
Barebones estimator for ensembling multiple model predictions.
Source code in elapid/models.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
|
__init__(models, reducer=EnsembleConfig.reducer)
¶
Create a model ensemble from a set of trained models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
models |
List[BaseEstimator]
|
iterable of models with |
required |
reducer |
str
|
method for reducing/ensembling each model's predictions. select from ['mean', 'median', 'mode'] |
reducer
|
Source code in elapid/models.py
694 695 696 697 698 699 700 701 702 703 |
|
predict(x)
¶
Applies models to a set of covariates or features. Requires each model has been fit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
Returns:
Type | Description |
---|---|
ndarray
|
array-like of shape (n_samples,) with model predictions |
Source code in elapid/models.py
732 733 734 735 736 737 738 739 740 741 742 743 |
|
predict_proba(x)
¶
Compute prediction probability scores for each class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
Returns:
Type | Description |
---|---|
ndarray
|
array-like of shape (n_samples, n_classes) with model predictions |
Source code in elapid/models.py
745 746 747 748 749 750 751 752 753 754 755 756 |
|
reduce(preds)
¶
Reduce multiple model predictions into ensemble prediction/probability scores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
preds |
List[ndarray]
|
list of model predictions from .predict() or .predict_proba() |
required |
Returns:
Type | Description |
---|---|
ndarray
|
array-like of shape (n_samples, n_classes) with model predictions |
Source code in elapid/models.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 |
|
MaxentModel
¶
Bases: BaseEstimator
, SDMMixin
Model estimator for Maxent-style species distribution models.
Source code in elapid/models.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|
__init__(feature_types=MaxentConfig.feature_types, tau=MaxentConfig.tau, transform=MaxentConfig.transform, clamp=MaxentConfig.clamp, scorer=MaxentConfig.scorer, beta_multiplier=MaxentConfig.beta_multiplier, beta_lqp=MaxentConfig.beta_lqp, beta_hinge=MaxentConfig.beta_hinge, beta_threshold=MaxentConfig.beta_lqp, beta_categorical=MaxentConfig.beta_categorical, n_hinge_features=MaxentConfig.n_hinge_features, n_threshold_features=MaxentConfig.n_threshold_features, convergence_tolerance=MaxentConfig.tolerance, use_lambdas=MaxentConfig.use_lambdas, n_lambdas=MaxentConfig.n_lambdas, class_weights=MaxentConfig.class_weights, n_cpus=NCPUS, use_sklearn=FORCE_SKLEARN)
¶
Create a maxent model object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_types |
Union[list, str]
|
maxent feature types to fit. must be in string "lqphta" or list ["linear", "quadratic", "product", "hinge", "threshold", "auto"] |
feature_types
|
tau |
float
|
maxent prevalence value for scaling logistic output |
tau
|
transform |
float
|
maxent model transformation type. select from ["raw", "logistic", "cloglog"]. |
transform
|
clamp |
bool
|
set features to min/max range from training during prediction |
clamp
|
scorer |
str
|
sklearn scoring function for model training |
scorer
|
beta_multiplier |
float
|
scaler for all regularization parameters. higher values drop more coeffiecients |
beta_multiplier
|
beta_lqp |
float
|
linear, quadratic and product feature regularization scaler |
beta_lqp
|
beta_hinge |
float
|
hinge feature regularization scaler |
beta_hinge
|
beta_threshold |
float
|
threshold feature regularization scaler |
beta_lqp
|
beta_categorical |
float
|
categorical feature regularization scaler |
beta_categorical
|
n_hinge_features |
int
|
the number of hinge features to fit in feature transformation |
n_hinge_features
|
n_threshold_features |
int
|
the number of thresholds to fit in feature transformation |
n_threshold_features
|
convergence_tolerance |
float
|
model convergence tolerance level |
tolerance
|
use_lambdas |
str
|
guide for which model lambdas to select (either "best" or "last") |
use_lambdas
|
n_lambdas |
int
|
number of lamba values to fit models with |
n_lambdas
|
class_weights |
Union[str, float]
|
strategy for weighting presence samples.
pass "balanced" to compute the ratio based on sample frequency
or pass a float for the presence:background weight ratio
the R |
class_weights
|
n_cpus |
int
|
threads to use during model training |
NCPUS
|
use_sklearn |
bool
|
force using |
FORCE_SKLEARN
|
Source code in elapid/models.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
fit(x, y, sample_weight=None, categorical=None, labels=None, preprocessor=None)
¶
Trains a maxent model using a set of covariates and presence/background points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array of shape (n_samples, n_features) with covariate data |
required |
y |
ArrayLike
|
array of shape (n_samples,) with binary presence/background (1/0) values |
required |
sample_weight |
ArrayLike
|
array of weights assigned to each sample with shape (n_samples,).
this is modified by the |
None
|
categorical |
List[int]
|
indices for which columns are categorical |
None
|
labels |
list
|
covariate labels. ignored if x is a pandas DataFrame |
None
|
preprocessor |
BaseEstimator
|
an |
None
|
Source code in elapid/models.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|
fit_predict(x, y, categorical=None, labels=None, preprocessor=None)
¶
Trains and applies a model to x/y data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
y |
ArrayLike
|
array-like of shape (n_samples,) with binary presence/background (1/0) values |
required |
categorical |
list
|
column indices indicating which columns are categorical |
None
|
labels |
list
|
Covariate labels. Ignored if x is a pandas DataFrame |
None
|
preprocessor |
BaseEstimator
|
an |
None
|
Returns:
Name | Type | Description |
---|---|---|
predictions |
ArrayLike
|
Array-like of shape (n_samples,) with model predictions |
Source code in elapid/models.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
|
initialize_glmnet_model(lambdas, alpha=1, standardize=False, fit_intercept=True)
¶
Creates the Logistic Regression with elastic net penalty model object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lambdas |
array
|
array of model lambda values. get from elapid.features.compute_lambdas() |
required |
alpha |
float
|
elasticnet mixing parameter. alpha=1 for lasso, alpha=0 for ridge |
1
|
standardize |
bool
|
specify coefficient normalization |
False
|
fit_intercept |
bool
|
include an intercept parameter |
True
|
Source code in elapid/models.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
|
initialize_sklearn_model(C, fit_intercept=True)
¶
Creates an sklearn Logisticregression estimator with L1 penalties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
C |
float
|
the regularization parameter |
required |
fit_intercept |
bool
|
include an intercept parameter |
True
|
Source code in elapid/models.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|
predict(x)
¶
Apply a model to a set of covariates or features. Requires that a model has been fit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
Returns:
Name | Type | Description |
---|---|---|
predictions |
ArrayLike
|
array-like of shape (n_samples,) with model predictions |
Source code in elapid/models.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
|
predict_proba(x)
¶
Compute prediction probability scores for the 0/1 classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
Returns:
Name | Type | Description |
---|---|---|
predictions |
ArrayLike
|
array-like of shape (n_samples, 2) with model predictions |
Source code in elapid/models.py
481 482 483 484 485 486 487 488 489 490 491 492 493 |
|
NicheEnvelopeModel
¶
Bases: BaseEstimator
, SDMMixin
, FeaturesMixin
Model estimator for niche envelope-style models.
Source code in elapid/models.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 |
|
__init__(percentile_range=NicheEnvelopeConfig.percentile_range, overlay=NicheEnvelopeConfig.overlay)
¶
Create a niche envelope model estimator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
percentile_range |
Tuple[float, float]
|
covariate values within this range are flagged as suitable habitat using a narrow range like [10, 90] drops more areas from suitability maps while [0, 100] creates an envelope around the full range of observed covariates at all y==1 locations. |
percentile_range
|
overlay |
str
|
niche envelope overlap type. select from ["average", "intersection", "union"] |
overlay
|
Source code in elapid/models.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
|
fit(x, y, categorical=None, labels=None)
¶
Fits a niche envelope model using a set of covariates and presence/background points.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
y |
ArrayLike
|
array-like of shape (n_samples,) with binary presence/background (1/0) values |
required |
categorical |
list
|
indices for which columns are categorical |
None
|
labels |
list
|
covariate labels. ignored if x is a pandas DataFrame |
None
|
Source code in elapid/models.py
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
|
fit_predict(x, y, categorical=None, labels=None)
¶
Trains and applies a model to x/y data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
y |
ArrayLike
|
array-like of shape (n_samples,) with binary presence/background (1/0) values |
required |
categorical |
list
|
column indices indicating which columns are categorical |
None
|
labels |
list
|
Covariate labels. Ignored if x is a pandas DataFrame |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
array-like of shape (n_samples,) with model predictions |
Source code in elapid/models.py
672 673 674 675 676 677 678 679 680 681 682 683 684 685 |
|
predict(x)
¶
Applies a model to a set of covariates or features. Requires that a model has been fit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
Returns:
Type | Description |
---|---|
ndarray
|
array-like of shape (n_samples,) with model predictions |
Source code in elapid/models.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 |
|
predict_proba(x)
¶
Compute prediction probability scores for the 0/1 classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
array-like of shape (n_samples, n_features) with covariate data |
required |
Returns:
Name | Type | Description |
---|---|---|
predictions |
ArrayLike
|
array-like of shape (n_samples, 2) with model predictions |
Source code in elapid/models.py
658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
SDMMixin
¶
Mixin class for SDM classifiers.
Source code in elapid/models.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
partial_dependence_plot(x, percentiles=(0.025, 0.975), n_bins=50, categorical_features=None, labels=None, **kwargs)
¶
Plot the response of an estimator across the range of feature values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
evaluation features. array-like of shape (n_samples, n_features). used to constrain the range of values to evaluate for each feature. |
required |
percentiles |
tuple
|
lower and upper percentiles used to set the range to plot. |
(0.025, 0.975)
|
n_bins |
int
|
the number of bins spanning the lower-upper percentile range. |
50
|
categorical_features |
tuple
|
a 0-based index of which features are categorical. |
None
|
labels |
list
|
list of band names to label the plots. |
None
|
**kwargs |
additional arguments to pass to |
{}
|
Returns:
Type | Description |
---|---|
Tuple[Figure, Axes]
|
fig, ax: matplotlib subplot figure and axes. |
Source code in elapid/models.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
partial_dependence_scores(x, percentiles=(0.025, 0.975), n_bins=100, categorical_features=[None])
¶
Compute partial dependence scores for each feature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
evaluation features. array-like of shape (n_samples, n_features). used to constrain the range of values to evaluate for each feature. |
required |
percentiles |
tuple
|
lower and upper percentiles used to set the range to plot. |
(0.025, 0.975)
|
n_bins |
int
|
the number of bins spanning the lower-upper percentile range. |
100
|
categorical_features |
tuple
|
a 0-based index of which features are categorical. |
[None]
|
Returns:
Type | Description |
---|---|
Tuple[ndarray, ndarray, ndarray]
|
bins, mean, stdv: the binned feature values and the mean/stdv of responses. |
Source code in elapid/models.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
permutation_importance_plot(x, y, sample_weight=None, n_repeats=10, labels=None, **kwargs)
¶
Create a box plot with bootstrapped permutation importance scores for each covariate.
Permutation importance measures how much a model score decreases when a single feature value is randomly shuffled. This score doesn't reflect the intrinsic predictive value of a feature by itself, but how important feature is for a particular model.
It is often appropriate to compute permuation importance scores using both training and validation sets. Large differences between the two may indicate overfitting.
This implementation does not necessarily match the implementation in Maxent. These scores may be difficult to interpret if there is a high degree of covariance between features or if the model estimator includes any non-linear feature transformations (e.g. 'hinge' features).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
evaluation features. array-like of shape (n_samples, n_features). |
required |
y |
ArrayLike
|
presence/absence labels. array-like of shape (n_samples,). |
required |
sample_weight |
ArrayLike
|
array-like of shape (n_samples,) |
None
|
n_repeats |
int
|
number of permutation iterations. |
10
|
labels |
list
|
list of band names to label the plots. |
None
|
**kwargs |
additional arguments to pass to |
{}
|
Returns:
Type | Description |
---|---|
Tuple[Figure, Axes]
|
fig, ax: matplotlib subplot figure and axes. |
Source code in elapid/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
permutation_importance_scores(x, y, sample_weight=None, n_repeats=10, n_jobs=-1)
¶
Compute a generic feature importance score by modifying feature values and computing the relative change in model performance.
Permutation importance measures how much a model score decreases when a single feature value is randomly shuffled. This score doesn't reflect the intrinsic predictive value of a feature by itself, but how important feature is for a particular model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
test samples. array-like of shape (n_samples, n_features). |
required |
y |
ArrayLike
|
presence/absence labels. array-like of shape (n_samples,). |
required |
sample_weight |
ArrayLike
|
array-like of shape (n_samples,) |
None
|
n_repeats |
int
|
number of permutation iterations. |
10
|
n_jobs |
int
|
number of parallel compute tasks. set to -1 for all cpus. |
-1
|
Returns:
Name | Type | Description |
---|---|---|
importances |
ndarray
|
an array of shape (n_features, n_repeats). |
Source code in elapid/models.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
score(x, y, sample_weight=None)
¶
Return the mean AUC score on the given test data and labels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ArrayLike
|
test samples. array-like of shape (n_samples, n_features). |
required |
y |
ArrayLike
|
presence/absence labels. array-like of shape (n_samples,). |
required |
sample_weight |
ArrayLike
|
array-like of shape (n_samples,) |
None
|
Returns:
Type | Description |
---|---|
float
|
AUC score of |
Source code in elapid/models.py
41 42 43 44 45 46 47 48 49 50 51 52 |
|
estimate_C_from_betas(beta_multiplier)
¶
Convert the maxent-format beta_multiplier to an sklearn-format C regularization parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
beta_multiplier |
float
|
the maxent beta regularization scaler |
required |
Returns:
Type | Description |
---|---|
float
|
a C factor approximating the level of regularization passed to glmnet |
Source code in elapid/models.py
850 851 852 853 854 855 856 857 858 859 |
|
format_occurrence_data(y)
¶
Reads input y data and formats it to consistent 1d array dtypes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ArrayLike
|
array-like of shape (n_samples,) or (n_samples, 1) |
required |
Returns:
Type | Description |
---|---|
ArrayLike
|
formatted uint8 ndarray of shape (n_samples,) |
Raises:
Type | Description |
---|---|
AxisError
|
an array with 2 or more columns is passed |
Source code in elapid/models.py
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 |
|
maxent_alpha(raw)
¶
Compute the sum-to-one alpha maxent model parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raw |
ndarray
|
uncalibrated maxent raw (exponential) model output |
required |
Returns:
Name | Type | Description |
---|---|---|
alpha |
float
|
the output sum-to-one scaling factor |
Source code in elapid/models.py
759 760 761 762 763 764 765 766 767 768 |
|
maxent_cloglog_transform(engma, entropy)
¶
Compute maxent's cumulative log-log suitability score
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engma |
ndarray
|
calibrated maxent linear model output |
required |
entropy |
float
|
the calibrated model entropy score |
required |
Returns:
Type | Description |
---|---|
ndarray
|
the cloglog scores for each sample |
Source code in elapid/models.py
814 815 816 817 818 819 820 821 822 823 824 |
|
maxent_entropy(raw)
¶
Compute the maxent model entropy score for scaling the logistic output
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raw |
ndarray
|
uncalibrated maxent raw (exponential) model output |
required |
Returns:
Name | Type | Description |
---|---|---|
entropy |
float
|
background distribution entropy score |
Source code in elapid/models.py
771 772 773 774 775 776 777 778 779 780 781 |
|
maxent_logistic_transform(engma, entropy, tau=MaxentConfig.tau)
¶
Compute maxent's logistic suitability score
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engma |
ndarray
|
calibrated maxent linear model output |
required |
entropy |
float
|
the calibrated model entropy score |
required |
tau |
float
|
the prevalence scaler. lower values indicate rarer species. |
tau
|
Returns:
Type | Description |
---|---|
ndarray
|
the tau-scaled logistic scores for each sample |
Source code in elapid/models.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
|
maxent_raw_transform(engma)
¶
Compute maxent's raw suitability score
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engma |
ndarray
|
calibrated maxent linear model output |
required |
Returns:
Type | Description |
---|---|
ndarray
|
the log-linear raw scores for each sample |
Source code in elapid/models.py
784 785 786 787 788 789 790 791 792 793 |
|