elapid.types¶
Custom maxent and typing data types.
to_iterable(var)
¶
Checks and converts variables to an iterable type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var |
Any
|
the input variable to check and convert. |
required |
Returns:
Type | Description |
---|---|
list
|
|
Source code in elapid/types.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
validate_boolean(var)
¶
Evaluates whether an argument is boolean True/False
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var |
Any
|
the input argument to validate |
required |
Returns:
Name | Type | Description |
---|---|---|
var |
bool
|
the value if it passes validation |
Raises:
Type | Description |
---|---|
AssertionError
|
|
Source code in elapid/types.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
validate_feature_types(features)
¶
Ensures the feature classes passed are maxent-legible
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features |
Union[str, list]
|
List or string that must be in ["linear", "quadratic", "product", "hinge", "threshold", "auto"] or string "lqphta" |
required |
Returns:
Name | Type | Description |
---|---|---|
valid_features |
list
|
List of formatted valid feature values |
Source code in elapid/types.py
23 24 25 26 27 28 29 30 31 32 33 34 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 |
|
validate_numeric_scalar(var)
¶
Evaluates whether an argument is a single numeric value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var |
Any
|
the input argument to validate |
required |
Returns:
Name | Type | Description |
---|---|---|
var |
bool
|
the value if it passes validation |
Raises:
Type | Description |
---|---|
AssertionError
|
|
Source code in elapid/types.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|