deseasion.backend.models.processing_models module
- class deseasion.backend.models.processing_models.ContinuousRule(rule='', default_values=[], **kwargs)
Bases:
PrefDefaultValues
Used to create a geo-data containing continuous values from a rule
- cut_to_extent
- data_generator
- data_generator_id
- default_values
- id
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- rule
- class deseasion.backend.models.processing_models.DefaultValue(**kwargs)
Bases:
BaseModelMixin
,Model
- attribute
- attribute_id
- model
- model_id
- value
- class deseasion.backend.models.processing_models.DiscreteCategory(name, **kwargs)
Bases:
ModelMixin
,Model
Model for creating data using discrete values (categories).
- id
- name
- position
- preference_model
- preference_model_id
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- type
- class deseasion.backend.models.processing_models.DiscreteModel(cut_to_extent=True, name='', **kwargs)
Bases:
ProcessingModel
- categories
- cut_to_extent
- data_generator
- data_generator_id
- id
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.DiscreteRules(categories=[], **kwargs)
Bases:
DiscreteModel
Used to create a geo-data containing discrete values (ie. categories) from rules.
- categories
- cut_to_extent
- data_generator
- data_generator_id
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- id
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.DiscreteRulesCategory(rules=[], **kwargs)
Bases:
DiscreteCategory
- evaluate_data(data, stats=None)
- id
- name
- position
- preference_model
- preference_model_id
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- rules
- type
- class deseasion.backend.models.processing_models.DissolveAdjacentModel(cut_to_extent=True, name='', **kwargs)
Bases:
ProcessingModel
- cut_to_extent
- data_generator
- data_generator_id
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- id
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.GeoBuffer(radius=None, **kwargs)
Bases:
ProcessingModel
Model to create a buffer around the geometry.
- cut_to_extent
- data_generator
- data_generator_id
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- id
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- radius
- class deseasion.backend.models.processing_models.KeepOverlap(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- average = 4
- max = 2
- min = 1
- sum = 3
- class deseasion.backend.models.processing_models.MRSort(criteria=[], categories=[], **kwargs)
Bases:
DiscreteModel
Used to create a geo-data using the MR-Sort algorithm.
- Attributes:
- categories (list): The categories for the sorting algorithm.
Best category first.
- majority_threshold (float): The cut threshold for the concordance
condition. At least half the sum of the criteria weights.
- categories
- check_category(attributes)
Execute the MR-Sort algorithm on the attributes.
- Args:
attributes (list): List of (‘name’, ‘attribute’, value).
- Raises:
- AttributeError: If the attribute (‘name’, ‘attribute’) does not
correspond to any criterion.
- compute_weights(attributes, profile_index, criteria_lookup=None)
Compute weights where feature is better than profile.
- Parameters:
attributes – list of (data name, attribute name, value)
profile_index – index of profile to compare to
criteria_lookup – dict mapping (data name, attribute name) to criteria, computed if absent
- Returns:
weights for attributes where feature is better than profile indexed by (data name, attribute name)
- criteria
- cut_to_extent
- data_generator
- data_generator_id
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- id
- inference_alternatives
- init_criteria()
- majority_threshold
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- validate_criteria(key, criterion)
Verify that the criterion references an input_data.
- class deseasion.backend.models.processing_models.MRSortCriterion(mrsort=None, profiles=[], weight=0, maximize=True, **kwargs)
Bases:
BaseModelMixin
,Model
Contain the criterion data for the MR-Sort algorithm.
- Attributes:
- profiles: The values for the profiles of the categories.
Worst value first.
- weight (float):
The weight of the criterion in the algorithm.
- maximize (bool):
Preference direction (maximize if True, minimize if False). Default: True.
- attribute
- attribute_id
- inference_values
- is_better(value, profile_index)
Check if the value is better than the profile for the given index.
- Args:
value (number): The value to check. profile_index (int): Index of the profile in the profiles list.
- maximize
- mrsort
- mrsort_id
- profiles
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- weight
- class deseasion.backend.models.processing_models.MergeOverlapModel(keep_overlap=KeepOverlap.max, **kwargs)
Bases:
ProcessingModel
- cut_to_extent
- data_generator
- data_generator_id
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- get_overlap_value(values)
Return the overlap value filtered through the overlap function.
- Args:
values: A list of the values.
- id
- keep_overlap
- model_type
- name
- process_overlap(entity)
Decompose the overlapping attributes, and keep the chosen value (all, worse or best)
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.ModelType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- categories_rule = 1
- continuous_rule = 2
- dissolve_adjacent = 7
- geo_buffer = 3
- merge_overlap = 6
- mrsort = 4
- weighted_sum = 5
- zone_proposition = 8
- class deseasion.backend.models.processing_models.PrefDefaultValues(cut_to_extent=True, name='', **kwargs)
Bases:
ProcessingModel
- cut_to_extent
- data_generator
- data_generator_id
- default_values
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- get_default_value(attribute)
Returns the default value for the attribute.
- Returns:
The default value if it exists, or None otherwise
- id
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.ProcessingModel(cut_to_extent=True, name='', **kwargs)
Bases:
ModelMixin
,Model
- cut_to_extent
- data_generator
- data_generator_id
- explain(feature: Feature) dict
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- get_used_input_attributes() list[DataAttribute]
Get list of used input attributes in a model definition.
- Returns:
- id
- property input_data
- model_type
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.WeightedSum(operands=None, **kwargs)
Bases:
PrefDefaultValues
- cut_to_extent
- data_generator
- data_generator_id
- default_values
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- id
- model_type
- name
- operands
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- class deseasion.backend.models.processing_models.WeightedSumOperand(**kwargs)
Bases:
ModelMixin
,Model
- attribute
- attribute_id
- id
- model
- model_id
- weight
- class deseasion.backend.models.processing_models.ZonePropositionGenerator(geo_size=0, size=80, mutation=0.02, children=60, filter_clusters=True, iterations=None, duration=None, **kwargs)
Bases:
ProcessingModel
- children
- cut_to_extent
- data_generator
- data_generator_id
- duration
- explain(feature)
Explain feature wrt the model.
- Parameters:
feature – feature computed by the model
- Returns:
explanation as a dict
- filter_clusters
- ga_params()
- geo_size
- id
- iterations
- model_type
- mutation
- name
- query: t.ClassVar[Query]
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- size