iSDM.model module¶
A module for preparing all environmental layers used for fitting a model, into a single dataframe, of a convenient format.
-
class
iSDM.model.Algorithm¶ Bases:
enum.Enum
-
class
iSDM.model.Evaluation¶ Bases:
enum.Enum
-
class
iSDM.model.Model(pixel_size, raster_data=None, **kwargs)¶ Bases:
objectA class for encapsulating the data preparation functionality for fitting a model. Makes sure all layers are at a consistent resolution, global scale. Constructs the “base” dataframe and allows adding environmental layers data to this dataframe incrementally.
Variables: - pixel_size – The size of the pixel in degrees, i.e., the resolution to use for rasterizing.
- x_res – The number of pixels in the global-scale raster, along the x-axis.
- y_res – The number of pixels in the global-scale raster, along the x-axis.
- base_layer (RasterEnvironmentalLayer) – A “base” raster environmental layer to use for deducing the world coordinates used as index in the base dataframe. All burned pixels (value==1) will be converted to global-scale latitude/longitude coordinates (the index).
- base_dataframe (pandas.DataFrame) – A base dataframe containing latitude/longitude columns as an index. Further environmental layers added to the model will be merged with this base dataframe. Therefore, it is expected to contain all the necessary latitude/longitude combinations that may show up in any further environmental layers. If raster_data is not provided as a base(see below), then all world coordinates (at a particular resolution) are taken into account.
-
add_environmental_layer(layer, discard_threshold=None, discard_nodata_value=True)¶ Adds an environmental layer (Raster or Vector) by converting its values to latitude/longitude decimals, and merging with the base dataframe. If the added layer is already raster, the first band is expected to contain all the (pixel) data values. The resolution of the provided raster needs to match the Model resolution. The pixels are then converted to world coordinates, and merged with the base dataframe. If the environmental layer is vector, then it is first rasterized, and the logic proceeds the same way as with a raster layer.
Parameters: - layer (EnvironmentalLayer) – The environmental layer to be added to the model dataframe.
- discard_threshold (int) – Optional pixel value to use for discarding layer pixels below a certain value, before adding the layer.
- discard_nodata_value (bool) – Optionally filter out “nodata” pixel values from the raster, when converting the layer pixels to world coordinates.
-
cross_validate(percentage, random_seed)¶
-
evaluate_performance(method=<Evaluation.ROC: 1>, **kwargs)¶
-
fit()¶
-
get_base_dataframe()¶