mloda 0.3.3__py3-none-any.whl → 0.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mloda/__init__.py +17 -0
- {mloda_core → mloda/core}/abstract_plugins/components/base_artifact.py +2 -2
- {mloda_core → mloda/core}/abstract_plugins/components/base_validator.py +13 -0
- {mloda_core → mloda/core}/abstract_plugins/components/data_access_collection.py +1 -1
- {mloda_core → mloda/core}/abstract_plugins/components/data_types.py +39 -0
- {mloda_core → mloda/core}/abstract_plugins/components/feature.py +39 -33
- {mloda_core → mloda/core}/abstract_plugins/components/feature_chainer/feature_chain_parser.py +19 -19
- mloda/core/abstract_plugins/components/feature_chainer/feature_chain_parser_mixin.py +197 -0
- {mloda_core → mloda/core}/abstract_plugins/components/feature_collection.py +6 -6
- {mloda_core → mloda/core}/abstract_plugins/components/feature_group_version.py +8 -8
- {mloda_core → mloda/core}/abstract_plugins/components/feature_set.py +18 -24
- {mloda_core → mloda/core}/abstract_plugins/components/framework_transformer/cfw_transformer.py +2 -2
- {mloda_core → mloda/core}/abstract_plugins/components/index/add_index_feature.py +4 -4
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/api/api_input_data.py +3 -3
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/api/api_input_data_collection.py +2 -2
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/api/base_api_data.py +1 -1
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/base_input_data.py +6 -6
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/creator/data_creator.py +3 -3
- mloda/core/abstract_plugins/components/link.py +437 -0
- {mloda_core → mloda/core}/abstract_plugins/components/match_data/match_data.py +3 -3
- {mloda_core → mloda/core}/abstract_plugins/components/merge/base_merge_engine.py +2 -2
- {mloda_core → mloda/core}/abstract_plugins/components/options.py +12 -36
- {mloda_core → mloda/core}/abstract_plugins/components/parallelization_modes.py +1 -1
- {mloda_core → mloda/core}/abstract_plugins/components/plugin_option/plugin_collector.py +14 -14
- mloda/core/abstract_plugins/components/validators/datatype_validator.py +96 -0
- mloda/core/abstract_plugins/components/validators/feature_set_validator.py +38 -0
- mloda/core/abstract_plugins/components/validators/feature_validator.py +23 -0
- mloda/core/abstract_plugins/components/validators/link_validator.py +79 -0
- mloda/core/abstract_plugins/components/validators/options_validator.py +57 -0
- mloda_core/abstract_plugins/compute_frame_work.py → mloda/core/abstract_plugins/compute_framework.py +45 -37
- mloda_core/abstract_plugins/abstract_feature_group.py → mloda/core/abstract_plugins/feature_group.py +56 -33
- mloda/core/abstract_plugins/function_extender.py +78 -0
- mloda/core/api/plugin_docs.py +220 -0
- mloda/core/api/plugin_info.py +32 -0
- {mloda_core → mloda/core}/api/prepare/setup_compute_framework.py +11 -11
- {mloda_core → mloda/core}/api/request.py +42 -33
- {mloda_core → mloda/core}/core/cfw_manager.py +8 -8
- {mloda_core → mloda/core}/core/engine.py +47 -47
- {mloda_core → mloda/core}/core/step/abstract_step.py +7 -7
- {mloda_core → mloda/core}/core/step/feature_group_step.py +12 -12
- {mloda_core → mloda/core}/core/step/join_step.py +14 -14
- {mloda_core → mloda/core}/core/step/transform_frame_work_step.py +16 -16
- {mloda_core → mloda/core}/filter/filter_engine.py +1 -1
- {mloda_core → mloda/core}/filter/filter_type_enum.py +1 -1
- {mloda_core → mloda/core}/filter/global_filter.py +23 -23
- {mloda_core → mloda/core}/filter/single_filter.py +6 -6
- {mloda_core → mloda/core}/prepare/accessible_plugins.py +15 -18
- {mloda_core → mloda/core}/prepare/execution_plan.py +65 -39
- {mloda_core → mloda/core}/prepare/graph/build_graph.py +6 -6
- {mloda_core → mloda/core}/prepare/graph/graph.py +1 -1
- {mloda_core → mloda/core}/prepare/graph/properties.py +5 -5
- {mloda_core → mloda/core}/prepare/identify_feature_group.py +12 -14
- {mloda_core → mloda/core}/prepare/joinstep_collection.py +3 -3
- {mloda_core → mloda/core}/prepare/resolve_compute_frameworks.py +6 -6
- {mloda_core → mloda/core}/prepare/resolve_graph.py +11 -11
- {mloda_core → mloda/core}/prepare/resolve_links.py +11 -31
- mloda/core/prepare/validators/resolve_link_validator.py +32 -0
- mloda/core/runtime/compute_framework_executor.py +271 -0
- mloda/core/runtime/data_lifecycle_manager.py +160 -0
- mloda/core/runtime/flight/__init__.py +0 -0
- {mloda_core → mloda/core}/runtime/flight/runner_flight_server.py +1 -1
- mloda/core/runtime/run.py +317 -0
- mloda/core/runtime/worker/__init__.py +0 -0
- {mloda_core → mloda/core}/runtime/worker/multiprocessing_worker.py +15 -10
- {mloda_core → mloda/core}/runtime/worker/thread_worker.py +2 -2
- mloda/core/runtime/worker_manager.py +96 -0
- mloda/provider/__init__.py +101 -0
- mloda/steward/__init__.py +25 -0
- mloda/user/__init__.py +57 -0
- {mloda-0.3.3.dist-info → mloda-0.4.1.dist-info}/METADATA +24 -31
- mloda-0.4.1.dist-info/RECORD +248 -0
- {mloda-0.3.3.dist-info → mloda-0.4.1.dist-info}/top_level.txt +1 -1
- mloda_plugins/compute_framework/base_implementations/duckdb/duckdb_filter_engine.py +2 -2
- mloda_plugins/compute_framework/base_implementations/duckdb/duckdb_framework.py +15 -13
- mloda_plugins/compute_framework/base_implementations/duckdb/duckdb_merge_engine.py +3 -3
- mloda_plugins/compute_framework/base_implementations/duckdb/duckdb_pyarrow_transformer.py +1 -1
- mloda_plugins/compute_framework/base_implementations/iceberg/iceberg_filter_engine.py +2 -2
- mloda_plugins/compute_framework/base_implementations/iceberg/iceberg_framework.py +12 -10
- mloda_plugins/compute_framework/base_implementations/iceberg/iceberg_pyarrow_transformer.py +1 -1
- mloda_plugins/compute_framework/base_implementations/pandas/dataframe.py +18 -16
- mloda_plugins/compute_framework/base_implementations/pandas/pandas_filter_engine.py +36 -13
- mloda_plugins/compute_framework/base_implementations/pandas/pandas_merge_engine.py +7 -7
- mloda_plugins/compute_framework/base_implementations/pandas/pandaspyarrowtransformer.py +1 -1
- mloda_plugins/compute_framework/base_implementations/polars/dataframe.py +16 -14
- mloda_plugins/compute_framework/base_implementations/polars/lazy_dataframe.py +13 -12
- mloda_plugins/compute_framework/base_implementations/polars/polars_filter_engine.py +2 -2
- mloda_plugins/compute_framework/base_implementations/polars/polars_lazy_pyarrow_transformer.py +1 -1
- mloda_plugins/compute_framework/base_implementations/polars/polars_merge_engine.py +3 -3
- mloda_plugins/compute_framework/base_implementations/polars/polars_pyarrow_transformer.py +1 -1
- mloda_plugins/compute_framework/base_implementations/pyarrow/pyarrow_filter_engine.py +2 -2
- mloda_plugins/compute_framework/base_implementations/pyarrow/pyarrow_merge_engine.py +3 -3
- mloda_plugins/compute_framework/base_implementations/pyarrow/table.py +12 -11
- mloda_plugins/compute_framework/base_implementations/python_dict/python_dict_filter_engine.py +2 -2
- mloda_plugins/compute_framework/base_implementations/python_dict/python_dict_framework.py +11 -9
- mloda_plugins/compute_framework/base_implementations/python_dict/python_dict_merge_engine.py +3 -3
- mloda_plugins/compute_framework/base_implementations/python_dict/python_dict_pyarrow_transformer.py +1 -1
- mloda_plugins/compute_framework/base_implementations/spark/spark_filter_engine.py +2 -2
- mloda_plugins/compute_framework/base_implementations/spark/spark_framework.py +17 -15
- mloda_plugins/compute_framework/base_implementations/spark/spark_merge_engine.py +2 -3
- mloda_plugins/compute_framework/base_implementations/spark/spark_pyarrow_transformer.py +1 -1
- mloda_plugins/config/feature/loader.py +2 -2
- mloda_plugins/feature_group/experimental/aggregated_feature_group/base.py +45 -64
- mloda_plugins/feature_group/experimental/aggregated_feature_group/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/aggregated_feature_group/polars_lazy.py +2 -2
- mloda_plugins/feature_group/experimental/aggregated_feature_group/pyarrow.py +2 -2
- mloda_plugins/feature_group/experimental/clustering/base.py +67 -97
- mloda_plugins/feature_group/experimental/clustering/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/data_quality/missing_value/base.py +58 -82
- mloda_plugins/feature_group/experimental/data_quality/missing_value/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/data_quality/missing_value/pyarrow.py +2 -2
- mloda_plugins/feature_group/experimental/data_quality/missing_value/python_dict.py +2 -2
- mloda_plugins/feature_group/experimental/default_options_key.py +16 -19
- mloda_plugins/feature_group/experimental/dimensionality_reduction/base.py +81 -96
- mloda_plugins/feature_group/experimental/dimensionality_reduction/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/dynamic_feature_group_factory/dynamic_feature_group_factory.py +24 -24
- mloda_plugins/feature_group/experimental/forecasting/base.py +108 -106
- mloda_plugins/feature_group/experimental/forecasting/forecasting_artifact.py +2 -2
- mloda_plugins/feature_group/experimental/forecasting/pandas.py +15 -15
- mloda_plugins/feature_group/experimental/geo_distance/base.py +52 -44
- mloda_plugins/feature_group/experimental/geo_distance/pandas.py +2 -3
- mloda_plugins/feature_group/experimental/llm/cli.py +4 -4
- mloda_plugins/feature_group/experimental/llm/cli_features/refactor_git_cached.py +19 -19
- mloda_plugins/feature_group/experimental/llm/installed_packages_feature_group.py +8 -8
- mloda_plugins/feature_group/experimental/llm/list_directory_feature_group.py +5 -5
- mloda_plugins/feature_group/experimental/llm/llm_api/claude.py +3 -3
- mloda_plugins/feature_group/experimental/llm/llm_api/gemini.py +3 -3
- mloda_plugins/feature_group/experimental/llm/llm_api/llm_base_request.py +5 -5
- mloda_plugins/feature_group/experimental/llm/llm_api/openai.py +3 -3
- mloda_plugins/feature_group/experimental/llm/llm_api/request_loop.py +6 -6
- mloda_plugins/feature_group/experimental/llm/llm_file_selector.py +10 -10
- mloda_plugins/feature_group/experimental/llm/tools/tool_collection.py +1 -1
- mloda_plugins/feature_group/experimental/node_centrality/base.py +46 -74
- mloda_plugins/feature_group/experimental/node_centrality/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/sklearn/encoding/base.py +53 -53
- mloda_plugins/feature_group/experimental/sklearn/encoding/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/sklearn/pipeline/base.py +52 -39
- mloda_plugins/feature_group/experimental/sklearn/pipeline/pandas.py +3 -4
- mloda_plugins/feature_group/experimental/sklearn/scaling/base.py +44 -60
- mloda_plugins/feature_group/experimental/sklearn/scaling/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/sklearn/sklearn_artifact.py +2 -3
- mloda_plugins/feature_group/experimental/source_input_feature.py +15 -15
- mloda_plugins/feature_group/experimental/text_cleaning/base.py +38 -63
- mloda_plugins/feature_group/experimental/text_cleaning/pandas.py +2 -2
- mloda_plugins/feature_group/experimental/text_cleaning/python_dict.py +2 -2
- mloda_plugins/feature_group/experimental/time_window/base.py +108 -95
- mloda_plugins/feature_group/experimental/time_window/pandas.py +13 -13
- mloda_plugins/feature_group/experimental/time_window/pyarrow.py +12 -12
- mloda_plugins/feature_group/input_data/api_data/api_data.py +9 -11
- mloda_plugins/feature_group/input_data/read_context_files.py +7 -7
- mloda_plugins/feature_group/input_data/read_db.py +7 -9
- mloda_plugins/feature_group/input_data/read_db_feature.py +4 -4
- mloda_plugins/feature_group/input_data/read_dbs/sqlite.py +23 -13
- mloda_plugins/feature_group/input_data/read_file.py +8 -8
- mloda_plugins/feature_group/input_data/read_file_feature.py +4 -4
- mloda_plugins/feature_group/input_data/read_files/csv.py +6 -6
- mloda_plugins/feature_group/input_data/read_files/feather.py +5 -5
- mloda_plugins/feature_group/input_data/read_files/json.py +5 -5
- mloda_plugins/feature_group/input_data/read_files/orc.py +5 -5
- mloda_plugins/feature_group/input_data/read_files/parquet.py +5 -5
- mloda_plugins/feature_group/input_data/read_files/text_file_reader.py +5 -5
- mloda_plugins/function_extender/base_implementations/otel/otel_extender.py +4 -4
- mloda-0.3.3.dist-info/RECORD +0 -230
- mloda_core/abstract_plugins/components/link.py +0 -286
- mloda_core/abstract_plugins/function_extender.py +0 -34
- mloda_core/runtime/run.py +0 -617
- {mloda_core → mloda/core}/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/domain.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/feature_chainer/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/feature_name.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/framework_transformer/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/framework_transformer/base_transformer.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/hashable_dict.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/index/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/index/index.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/api/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/input_data/creator/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/match_data/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/merge/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/plugin_option/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/components/utils.py +0 -0
- {mloda_core/abstract_plugins/plugin_loader → mloda/core/abstract_plugins/components/validators}/__init__.py +0 -0
- {mloda_core/api → mloda/core/abstract_plugins/plugin_loader}/__init__.py +0 -0
- {mloda_core → mloda/core}/abstract_plugins/plugin_loader/plugin_loader.py +0 -0
- {mloda_core/api/prepare → mloda/core/api}/__init__.py +0 -0
- {mloda_core/core → mloda/core/api/prepare}/__init__.py +0 -0
- {mloda_core/core/step → mloda/core/core}/__init__.py +0 -0
- {mloda_core/filter → mloda/core/core/step}/__init__.py +0 -0
- {mloda_core/prepare → mloda/core/filter}/__init__.py +0 -0
- {mloda_core → mloda/core}/filter/filter_parameter.py +0 -0
- {mloda_core/prepare/graph → mloda/core/prepare}/__init__.py +0 -0
- {mloda_core/runtime → mloda/core/prepare/graph}/__init__.py +0 -0
- {mloda_core/runtime/flight → mloda/core/prepare/validators}/__init__.py +0 -0
- {mloda_core/runtime/worker → mloda/core/runtime}/__init__.py +0 -0
- {mloda_core → mloda/core}/runtime/flight/flight_server.py +0 -0
- {mloda-0.3.3.dist-info → mloda-0.4.1.dist-info}/WHEEL +0 -0
- {mloda-0.3.3.dist-info → mloda-0.4.1.dist-info}/entry_points.txt +0 -0
- {mloda-0.3.3.dist-info → mloda-0.4.1.dist-info}/licenses/LICENSE.TXT +0 -0
- {mloda-0.3.3.dist-info → mloda-0.4.1.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
from typing import Any, Optional, Set, Type, Union
|
|
2
2
|
from uuid import UUID, uuid4
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from mloda.core.abstract_plugins.components.framework_transformer.cfw_transformer import (
|
|
5
5
|
ComputeFrameworkTransformer,
|
|
6
6
|
)
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
7
|
+
from mloda.core.abstract_plugins.compute_framework import ComputeFramework
|
|
8
|
+
from mloda.core.core.cfw_manager import CfwManager
|
|
9
|
+
from mloda.core.core.step.abstract_step import Step
|
|
10
|
+
from mloda.core.abstract_plugins.feature_group import FeatureGroup
|
|
11
|
+
from mloda.core.runtime.flight.flight_server import FlightServer
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class TransformFrameworkStep(Step):
|
|
15
15
|
def __init__(
|
|
16
16
|
self,
|
|
17
|
-
from_framework: Type[
|
|
18
|
-
to_framework: Type[
|
|
17
|
+
from_framework: Type[ComputeFramework],
|
|
18
|
+
to_framework: Type[ComputeFramework],
|
|
19
19
|
required_uuids: Set[UUID],
|
|
20
|
-
from_feature_group: Type[
|
|
21
|
-
to_feature_group: Type[
|
|
20
|
+
from_feature_group: Type[FeatureGroup],
|
|
21
|
+
to_feature_group: Type[FeatureGroup],
|
|
22
22
|
link_id: Optional[UUID] = None,
|
|
23
23
|
right_framework_uuids: Set[UUID] = set(),
|
|
24
24
|
) -> None:
|
|
@@ -57,8 +57,8 @@ class TransformFrameworkStep(Step):
|
|
|
57
57
|
def execute(
|
|
58
58
|
self,
|
|
59
59
|
cfw_register: CfwManager,
|
|
60
|
-
cfw:
|
|
61
|
-
from_cfw: Optional[Union[
|
|
60
|
+
cfw: ComputeFramework,
|
|
61
|
+
from_cfw: Optional[Union[ComputeFramework, UUID]] = None,
|
|
62
62
|
data: Optional[Any] = None,
|
|
63
63
|
) -> Optional[Any]:
|
|
64
64
|
self.location = cfw_register.get_location()
|
|
@@ -79,7 +79,7 @@ class TransformFrameworkStep(Step):
|
|
|
79
79
|
return data
|
|
80
80
|
return None
|
|
81
81
|
|
|
82
|
-
def get_column_names(self, cfw_register: CfwManager, from_cfw: Union[
|
|
82
|
+
def get_column_names(self, cfw_register: CfwManager, from_cfw: Union[ComputeFramework, UUID]) -> Set[str]:
|
|
83
83
|
if self.location and isinstance(from_cfw, UUID):
|
|
84
84
|
return cfw_register.get_column_names(from_cfw)
|
|
85
85
|
|
|
@@ -88,7 +88,7 @@ class TransformFrameworkStep(Step):
|
|
|
88
88
|
|
|
89
89
|
return from_cfw.get_column_names()
|
|
90
90
|
|
|
91
|
-
def get_data(self, cfw: Union[
|
|
91
|
+
def get_data(self, cfw: Union[ComputeFramework, UUID]) -> Any:
|
|
92
92
|
"""
|
|
93
93
|
This method is used to get the data from the compute framework.
|
|
94
94
|
If we are using multiprocessing, we use flightserver to transport the data.
|
|
@@ -104,10 +104,10 @@ class TransformFrameworkStep(Step):
|
|
|
104
104
|
|
|
105
105
|
return cfw.get_data()
|
|
106
106
|
|
|
107
|
-
def set_data(self, cfw:
|
|
107
|
+
def set_data(self, cfw: ComputeFramework, data: Any) -> None:
|
|
108
108
|
cfw.set_data(data)
|
|
109
109
|
|
|
110
|
-
def transform(self, cfw:
|
|
110
|
+
def transform(self, cfw: ComputeFramework, data: Any, feature_names: Set[str]) -> Any:
|
|
111
111
|
if self.equal_frameworks():
|
|
112
112
|
return data
|
|
113
113
|
|
|
@@ -2,14 +2,14 @@ from copy import deepcopy
|
|
|
2
2
|
from datetime import datetime, timezone
|
|
3
3
|
from typing import Any, Dict, Optional, Set, Tuple, Type, Union
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
5
|
+
from mloda.core.abstract_plugins.feature_group import FeatureGroup
|
|
6
|
+
from mloda.core.abstract_plugins.components.domain import Domain
|
|
7
|
+
from mloda.core.abstract_plugins.components.feature_name import FeatureName
|
|
8
|
+
from mloda.core.abstract_plugins.components.options import Options
|
|
9
|
+
from mloda.core.abstract_plugins.components.data_access_collection import DataAccessCollection
|
|
10
|
+
from mloda.core.abstract_plugins.components.feature import Feature
|
|
11
|
+
from mloda.core.filter.filter_type_enum import FilterType
|
|
12
|
+
from mloda.core.filter.single_filter import SingleFilter
|
|
13
13
|
from mloda_plugins.feature_group.experimental.default_options_key import DefaultOptionKeys
|
|
14
14
|
|
|
15
15
|
|
|
@@ -33,10 +33,10 @@ class GlobalFilter:
|
|
|
33
33
|
and features in the context of a data processing pipeline.
|
|
34
34
|
"""
|
|
35
35
|
self.filters: Set[SingleFilter] = set()
|
|
36
|
-
self.collection: Dict[Tuple[Type[
|
|
36
|
+
self.collection: Dict[Tuple[Type[FeatureGroup], FeatureName], Set[SingleFilter]] = {}
|
|
37
37
|
|
|
38
38
|
def add_filter(
|
|
39
|
-
self, filter_feature: Union[Feature, str], filter_type: Union[str,
|
|
39
|
+
self, filter_feature: Union[Feature, str], filter_type: Union[str, FilterType], parameter: Dict[str, Any]
|
|
40
40
|
) -> None:
|
|
41
41
|
"""
|
|
42
42
|
Adds a `SingleFilter` to the `filters` set based on the provided feature, filter type, and parameters.
|
|
@@ -45,8 +45,8 @@ class GlobalFilter:
|
|
|
45
45
|
- filter_feature: The feature or its name used for filtering. It can be a string or a `Feature` object.
|
|
46
46
|
To identify if a filter is used, we need to check if the feature is part of the feature group.
|
|
47
47
|
During this process, we enrich the filter feature with the options of the feature.
|
|
48
|
-
- filter_type: The type of filtering operation (e.g., equals, greater than). It can be a string or a `
|
|
49
|
-
This filter_type does not need to match the
|
|
48
|
+
- filter_type: The type of filtering operation (e.g., equals, greater than). It can be a string or a `FilterType`.
|
|
49
|
+
This filter_type does not need to match the FilterType, but it should be a string that is meaningful in the concrete
|
|
50
50
|
Featuregroup implementation.
|
|
51
51
|
- parameter: A dictionary of filter-specific options.
|
|
52
52
|
"""
|
|
@@ -55,7 +55,7 @@ class GlobalFilter:
|
|
|
55
55
|
|
|
56
56
|
def add_filter_to_collection(
|
|
57
57
|
self,
|
|
58
|
-
feature_group: Type[
|
|
58
|
+
feature_group: Type[FeatureGroup],
|
|
59
59
|
filtered_feature_name: FeatureName,
|
|
60
60
|
single_filter: SingleFilter,
|
|
61
61
|
) -> None:
|
|
@@ -69,7 +69,7 @@ class GlobalFilter:
|
|
|
69
69
|
|
|
70
70
|
def identity_matched_filters(
|
|
71
71
|
self,
|
|
72
|
-
feature_group: Type[
|
|
72
|
+
feature_group: Type[FeatureGroup],
|
|
73
73
|
feat: Feature,
|
|
74
74
|
data_access_collection: Optional[DataAccessCollection] = None,
|
|
75
75
|
) -> Set[SingleFilter]:
|
|
@@ -115,7 +115,7 @@ class GlobalFilter:
|
|
|
115
115
|
|
|
116
116
|
def criteria(
|
|
117
117
|
self,
|
|
118
|
-
feature_group: Type[
|
|
118
|
+
feature_group: Type[FeatureGroup],
|
|
119
119
|
filter: SingleFilter,
|
|
120
120
|
data_access_collection: Optional[DataAccessCollection] = None,
|
|
121
121
|
) -> bool:
|
|
@@ -124,7 +124,7 @@ class GlobalFilter:
|
|
|
124
124
|
)
|
|
125
125
|
|
|
126
126
|
def domain(
|
|
127
|
-
self, filter: SingleFilter, feature_domain: Union[None, Domain], feature_group: Type[
|
|
127
|
+
self, filter: SingleFilter, feature_domain: Union[None, Domain], feature_group: Type[FeatureGroup]
|
|
128
128
|
) -> bool:
|
|
129
129
|
# We have matched already the feature group and the feature.
|
|
130
130
|
# Thus, we take the feature group domain if the feature domain is not set.
|
|
@@ -176,8 +176,8 @@ class GlobalFilter:
|
|
|
176
176
|
valid_from: Optional[datetime] = None,
|
|
177
177
|
valid_to: Optional[datetime] = None,
|
|
178
178
|
max_exclusive: bool = True,
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
event_time_column: Union[str, Feature] = DefaultOptionKeys.reference_time,
|
|
180
|
+
validity_time_column: Union[str, Feature] = DefaultOptionKeys.time_travel,
|
|
181
181
|
) -> None:
|
|
182
182
|
"""
|
|
183
183
|
Adds time-based filters (`event_from`, `event_to`) and optionally time-travel filters (`valid_from`, `valid_to`).
|
|
@@ -197,21 +197,21 @@ class GlobalFilter:
|
|
|
197
197
|
- valid_from (Optional[datetime]): Start of the validity period (optional, with timezone).
|
|
198
198
|
- valid_to (Optional[datetime]): End of the validity period (optional, with timezone).
|
|
199
199
|
- max_exclusive (bool): If True, the `event_to` and `valid_to` values are treated as exclusive.
|
|
200
|
-
-
|
|
201
|
-
-
|
|
200
|
+
- event_time_column: the column name for the event time filter. Default is DefaultOptionKeys.reference_time.
|
|
201
|
+
- validity_time_column: the column name for the validity time filter. Default is DefaultOptionKeys.time_travel.
|
|
202
202
|
|
|
203
203
|
The `single_filters` created will be converted to UTC as ISO 8601 formatted strings to ensure consistency
|
|
204
204
|
across time zones and avoid ambiguity when comparing or processing time-based data.
|
|
205
205
|
"""
|
|
206
206
|
|
|
207
|
-
self._add_range_filter(
|
|
207
|
+
self._add_range_filter(event_time_column, event_from, event_to, max_exclusive)
|
|
208
208
|
|
|
209
209
|
# validate that both valid_from and valid_to are provided together
|
|
210
210
|
if (valid_from is not None and valid_to is None) or (valid_from is None and valid_to is not None):
|
|
211
211
|
raise ValueError("Both `valid_from` and `valid_to` must be provided together, or neither should be.")
|
|
212
212
|
|
|
213
213
|
if valid_from and valid_to:
|
|
214
|
-
self._add_range_filter(
|
|
214
|
+
self._add_range_filter(validity_time_column, valid_from, valid_to, max_exclusive)
|
|
215
215
|
|
|
216
216
|
def _add_range_filter(
|
|
217
217
|
self, filter_feature: Union[str, Feature], time_from: datetime, time_to: datetime, max_exclusive: bool
|
|
@@ -219,7 +219,7 @@ class GlobalFilter:
|
|
|
219
219
|
_time_from = self._check_and_convert_time_info(time_from)
|
|
220
220
|
_time_to = self._check_and_convert_time_info(time_to)
|
|
221
221
|
self.add_filter(
|
|
222
|
-
filter_feature,
|
|
222
|
+
filter_feature, FilterType.range, {"min": _time_from, "max": _time_to, "max_exclusive": max_exclusive}
|
|
223
223
|
)
|
|
224
224
|
|
|
225
225
|
def _check_and_convert_time_info(self, time_with_tz: datetime) -> str:
|
|
@@ -2,8 +2,8 @@ from typing import Any, Dict, Union
|
|
|
2
2
|
import uuid
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
5
|
+
from mloda.core.filter.filter_type_enum import FilterType
|
|
6
|
+
from mloda.core.filter.filter_parameter import FilterParameterImpl
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class SingleFilter:
|
|
@@ -14,7 +14,7 @@ class SingleFilter:
|
|
|
14
14
|
def __init__(
|
|
15
15
|
self,
|
|
16
16
|
filter_feature: Union[str, Any], # Union[str, Feature]
|
|
17
|
-
filter_type: Union[str,
|
|
17
|
+
filter_type: Union[str, FilterType],
|
|
18
18
|
parameter: Dict[str, Any],
|
|
19
19
|
) -> None:
|
|
20
20
|
"""
|
|
@@ -31,11 +31,11 @@ class SingleFilter:
|
|
|
31
31
|
|
|
32
32
|
self.uuid = uuid.uuid4()
|
|
33
33
|
|
|
34
|
-
def handle_filter_type(self, filter_type: Union[str,
|
|
34
|
+
def handle_filter_type(self, filter_type: Union[str, FilterType]) -> str:
|
|
35
35
|
if not filter_type:
|
|
36
36
|
raise ValueError(f"Filter type evaluates to false {filter_type}.")
|
|
37
37
|
|
|
38
|
-
if isinstance(filter_type,
|
|
38
|
+
if isinstance(filter_type, FilterType):
|
|
39
39
|
return filter_type.value
|
|
40
40
|
elif isinstance(filter_type, str):
|
|
41
41
|
return filter_type
|
|
@@ -43,7 +43,7 @@ class SingleFilter:
|
|
|
43
43
|
raise ValueError(f"Wrong type of Filter. {filter_type}")
|
|
44
44
|
|
|
45
45
|
def handle_filter_feature(self, filter_feature: Union[str, Any]) -> Any: # Union[str, Feature]
|
|
46
|
-
from
|
|
46
|
+
from mloda.core.abstract_plugins.components.feature import Feature
|
|
47
47
|
|
|
48
48
|
if isinstance(filter_feature, Feature):
|
|
49
49
|
return filter_feature
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
from copy import deepcopy
|
|
2
2
|
from typing import Optional, Set, Type
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from mloda_core.abstract_plugins.compute_frame_work import ComputeFrameWork
|
|
3
|
+
from mloda.core.abstract_plugins.components.plugin_option.plugin_collector import PluginCollector
|
|
4
|
+
from mloda.core.abstract_plugins.compute_framework import ComputeFramework
|
|
6
5
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
6
|
+
from mloda.core.abstract_plugins.feature_group import FeatureGroup
|
|
7
|
+
from mloda.core.abstract_plugins.components.utils import get_all_subclasses
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
FeatureGroupEnvironmentMapping = dict[Type[
|
|
10
|
+
FeatureGroupEnvironmentMapping = dict[Type[FeatureGroup], Set[Type[ComputeFramework]]]
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class PreFilterPlugins:
|
|
15
14
|
def __init__(
|
|
16
15
|
self,
|
|
17
|
-
compute_frameworks: Set[Type[
|
|
18
|
-
plugin_collector: Optional[
|
|
16
|
+
compute_frameworks: Set[Type[ComputeFramework]],
|
|
17
|
+
plugin_collector: Optional[PluginCollector] = None,
|
|
19
18
|
) -> None:
|
|
20
19
|
feature_groups = self._set_feature_groups(plugin_collector)
|
|
21
20
|
compute_frameworks = self._set_compute_frameworks(compute_frameworks)
|
|
@@ -27,9 +26,7 @@ class PreFilterPlugins:
|
|
|
27
26
|
def get_accessible_plugins(self) -> FeatureGroupEnvironmentMapping:
|
|
28
27
|
return self.accessible_plugins
|
|
29
28
|
|
|
30
|
-
def _set_feature_groups(
|
|
31
|
-
self, plugin_collector: Optional[PlugInCollector] = None
|
|
32
|
-
) -> Set[Type[AbstractFeatureGroup]]:
|
|
29
|
+
def _set_feature_groups(self, plugin_collector: Optional[PluginCollector] = None) -> Set[Type[FeatureGroup]]:
|
|
33
30
|
accessible_feature_groups = self.get_featuregroup_subclasses()
|
|
34
31
|
|
|
35
32
|
if plugin_collector:
|
|
@@ -43,12 +40,12 @@ class PreFilterPlugins:
|
|
|
43
40
|
|
|
44
41
|
def _set_compute_frameworks(
|
|
45
42
|
self,
|
|
46
|
-
compute_frameworks: Set[Type[
|
|
47
|
-
) -> Set[Type[
|
|
43
|
+
compute_frameworks: Set[Type[ComputeFramework]],
|
|
44
|
+
) -> Set[Type[ComputeFramework]]:
|
|
48
45
|
return compute_frameworks.intersection(self.get_cfw_subclasses())
|
|
49
46
|
|
|
50
47
|
def resolve_feature_group_compute_framework_limitations(
|
|
51
|
-
self, feature_groups: Set[Type[
|
|
48
|
+
self, feature_groups: Set[Type[FeatureGroup]], compute_frameworks: Set[Type[ComputeFramework]]
|
|
52
49
|
) -> FeatureGroupEnvironmentMapping:
|
|
53
50
|
accessible_plugins: FeatureGroupEnvironmentMapping = {}
|
|
54
51
|
for feature_group in feature_groups:
|
|
@@ -62,11 +59,11 @@ class PreFilterPlugins:
|
|
|
62
59
|
return accessible_plugins
|
|
63
60
|
|
|
64
61
|
@staticmethod
|
|
65
|
-
def get_cfw_subclasses() -> Set[Type[
|
|
66
|
-
all_subclasses = get_all_subclasses(
|
|
62
|
+
def get_cfw_subclasses() -> Set[Type[ComputeFramework]]:
|
|
63
|
+
all_subclasses = get_all_subclasses(ComputeFramework)
|
|
67
64
|
available_subclasses = {cls for cls in all_subclasses if cls.is_available()}
|
|
68
65
|
return available_subclasses
|
|
69
66
|
|
|
70
67
|
@staticmethod
|
|
71
|
-
def get_featuregroup_subclasses() -> Set[Type[
|
|
72
|
-
return get_all_subclasses(
|
|
68
|
+
def get_featuregroup_subclasses() -> Set[Type[FeatureGroup]]:
|
|
69
|
+
return get_all_subclasses(FeatureGroup)
|
|
@@ -2,27 +2,27 @@ from copy import copy, deepcopy
|
|
|
2
2
|
from typing import Any, Generator, List, Optional, Set, Tuple, Type, Dict, Union
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from mloda.core.abstract_plugins.components.index.index import Index
|
|
6
6
|
|
|
7
|
-
from
|
|
7
|
+
from mloda.core.abstract_plugins.components.input_data.api.api_input_data_collection import (
|
|
8
8
|
ApiInputDataCollection,
|
|
9
9
|
)
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
10
|
+
from mloda.core.abstract_plugins.components.input_data.api.base_api_data import BaseApiData
|
|
11
|
+
from mloda.core.abstract_plugins.components.input_data.api.api_input_data import ApiInputData
|
|
12
|
+
from mloda.core.abstract_plugins.compute_framework import ComputeFramework
|
|
13
|
+
from mloda.core.filter.global_filter import GlobalFilter
|
|
14
|
+
from mloda.core.filter.single_filter import SingleFilter
|
|
15
|
+
from mloda.core.prepare.joinstep_collection import JoinStepCollection
|
|
16
|
+
from mloda.core.prepare.graph.graph import Graph
|
|
17
|
+
from mloda.core.prepare.resolve_graph import PlannedQueue
|
|
18
|
+
from mloda.core.prepare.resolve_links import LinkFrameworkTrekker, LinkTrekker
|
|
19
|
+
from mloda.core.core.step.feature_group_step import FeatureGroupStep
|
|
20
|
+
from mloda.core.core.step.join_step import JoinStep
|
|
21
|
+
from mloda.core.core.step.transform_frame_work_step import TransformFrameworkStep
|
|
22
|
+
from mloda.core.abstract_plugins.feature_group import FeatureGroup
|
|
23
|
+
from mloda.core.abstract_plugins.components.feature import Feature
|
|
24
|
+
from mloda.core.abstract_plugins.components.feature_set import FeatureSet
|
|
25
|
+
from mloda.core.abstract_plugins.components.link import JoinType, Link
|
|
26
26
|
from collections import defaultdict
|
|
27
27
|
import logging
|
|
28
28
|
|
|
@@ -69,7 +69,7 @@ class ExecutionPlan:
|
|
|
69
69
|
pre_execution_plan.append(element)
|
|
70
70
|
continue
|
|
71
71
|
|
|
72
|
-
elif issubclass(element[0],
|
|
72
|
+
elif issubclass(element[0], FeatureGroup):
|
|
73
73
|
if not isinstance(element[1], set):
|
|
74
74
|
raise ValueError(f"Element {element} is not a valid element.")
|
|
75
75
|
|
|
@@ -481,7 +481,7 @@ class ExecutionPlan:
|
|
|
481
481
|
|
|
482
482
|
def find_fg_per_uuid(
|
|
483
483
|
self, pre_execution_plan: List[Union[LinkFrameworkTrekker, FeatureGroupStep]], uuid: UUID
|
|
484
|
-
) -> Type[
|
|
484
|
+
) -> Type[FeatureGroup]:
|
|
485
485
|
"""
|
|
486
486
|
This function finds the feature group per UUID in the pre_execution_plan.
|
|
487
487
|
|
|
@@ -587,7 +587,7 @@ class ExecutionPlan:
|
|
|
587
587
|
def is_valid_join_step(
|
|
588
588
|
self,
|
|
589
589
|
link_fw: LinkFrameworkTrekker,
|
|
590
|
-
children_fw: type[
|
|
590
|
+
children_fw: type[ComputeFramework],
|
|
591
591
|
children_uuid: UUID,
|
|
592
592
|
graph: Graph,
|
|
593
593
|
) -> bool | Tuple[Set[UUID], Set[UUID]]:
|
|
@@ -676,7 +676,7 @@ class ExecutionPlan:
|
|
|
676
676
|
def case_link_equal_feature_groups(
|
|
677
677
|
self,
|
|
678
678
|
link_fw: LinkFrameworkTrekker,
|
|
679
|
-
children_fw: type[
|
|
679
|
+
children_fw: type[ComputeFramework],
|
|
680
680
|
children_uuid: UUID,
|
|
681
681
|
graph: Graph,
|
|
682
682
|
) -> bool | Tuple[Set[UUID], Set[UUID]]:
|
|
@@ -724,8 +724,8 @@ class ExecutionPlan:
|
|
|
724
724
|
if link_fw[1] != graph.nodes[uuid].feature.get_compute_framework():
|
|
725
725
|
continue
|
|
726
726
|
|
|
727
|
-
if link_fw[0].
|
|
728
|
-
if not self.check_pointer(link_fw[0].
|
|
727
|
+
if link_fw[0].self_left_alias is not None:
|
|
728
|
+
if not self.check_pointer(link_fw[0].self_left_alias, link_fw, graph, uuid):
|
|
729
729
|
continue
|
|
730
730
|
|
|
731
731
|
# loop over all other feature set collections
|
|
@@ -737,9 +737,9 @@ class ExecutionPlan:
|
|
|
737
737
|
if link_fw[2] != graph.nodes[_uuid].feature.get_compute_framework():
|
|
738
738
|
continue
|
|
739
739
|
|
|
740
|
-
if link_fw[0].
|
|
740
|
+
if link_fw[0].self_right_alias is not None:
|
|
741
741
|
if not self.check_pointer(
|
|
742
|
-
link_fw[0].
|
|
742
|
+
link_fw[0].self_right_alias,
|
|
743
743
|
link_fw,
|
|
744
744
|
graph,
|
|
745
745
|
_uuid,
|
|
@@ -775,11 +775,11 @@ class ExecutionPlan:
|
|
|
775
775
|
def check_pointer(
|
|
776
776
|
self, pointer_dict: Dict[str, Any], link_fw: LinkFrameworkTrekker, graph: Graph, uuid: UUID
|
|
777
777
|
) -> bool:
|
|
778
|
-
if link_fw[0].
|
|
779
|
-
raise ValueError("This should not happen. If one
|
|
778
|
+
if link_fw[0].self_right_alias is None:
|
|
779
|
+
raise ValueError("This should not happen. If one alias is set, the other should be set as well.")
|
|
780
780
|
|
|
781
|
-
if link_fw[0].
|
|
782
|
-
raise ValueError("This should not happen. If one
|
|
781
|
+
if link_fw[0].self_left_alias is None:
|
|
782
|
+
raise ValueError("This should not happen. If one alias is set, the other should be set as well.")
|
|
783
783
|
|
|
784
784
|
for k, v in graph.nodes[uuid].feature.options.items():
|
|
785
785
|
for _k, _v in pointer_dict.items():
|
|
@@ -806,7 +806,7 @@ class ExecutionPlan:
|
|
|
806
806
|
|
|
807
807
|
def run_feature_group(
|
|
808
808
|
self,
|
|
809
|
-
feature_group_features: Tuple[Type[
|
|
809
|
+
feature_group_features: Tuple[Type[FeatureGroup], Set[Feature]],
|
|
810
810
|
parent_to_children_mapping: Dict[UUID, Set[UUID]],
|
|
811
811
|
pre_required_uuids: Set[UUID],
|
|
812
812
|
) -> Dict[int, FeatureGroupStep]:
|
|
@@ -853,7 +853,7 @@ class ExecutionPlan:
|
|
|
853
853
|
return fg_steps
|
|
854
854
|
|
|
855
855
|
def prepare_api_input_data(
|
|
856
|
-
self, feature_group: Type[
|
|
856
|
+
self, feature_group: Type[FeatureGroup], feature_set: FeatureSet
|
|
857
857
|
) -> Union[bool, BaseApiData]:
|
|
858
858
|
if not isinstance(feature_group.input_data(), ApiInputData):
|
|
859
859
|
return False
|
|
@@ -879,15 +879,13 @@ class ExecutionPlan:
|
|
|
879
879
|
|
|
880
880
|
return matching_cls_initialized
|
|
881
881
|
|
|
882
|
-
def add_artifact_to_feature_set(self, feature_group: Type[
|
|
882
|
+
def add_artifact_to_feature_set(self, feature_group: Type[FeatureGroup], feature_set: FeatureSet) -> None:
|
|
883
883
|
if feature_group.artifact() is None:
|
|
884
884
|
return
|
|
885
885
|
|
|
886
886
|
feature_set.add_artifact_name()
|
|
887
887
|
|
|
888
|
-
def add_single_filters_to_feature_set(
|
|
889
|
-
self, feature_group: Type[AbstractFeatureGroup], feature_set: FeatureSet
|
|
890
|
-
) -> None:
|
|
888
|
+
def add_single_filters_to_feature_set(self, feature_group: Type[FeatureGroup], feature_set: FeatureSet) -> None:
|
|
891
889
|
if self.global_filter is None:
|
|
892
890
|
return
|
|
893
891
|
|
|
@@ -957,11 +955,39 @@ class ExecutionPlan:
|
|
|
957
955
|
return new_set
|
|
958
956
|
|
|
959
957
|
def group_features_by_compute_framework_and_options(self, features: Set[Feature]) -> Dict[int, Set[Feature]]:
|
|
958
|
+
"""Group features by compute framework, options, and data type.
|
|
959
|
+
|
|
960
|
+
Features with data_type=None are "lenient" - they join existing groups
|
|
961
|
+
with matching base properties (options + compute_frameworks).
|
|
962
|
+
This allows index columns (which have no explicit type) to stay grouped
|
|
963
|
+
with typed features from the same FeatureGroup.
|
|
964
|
+
"""
|
|
960
965
|
hash_collector: Dict[int, Set[Feature]] = defaultdict(set)
|
|
966
|
+
none_typed_features: list[Feature] = []
|
|
961
967
|
|
|
962
|
-
#
|
|
968
|
+
# First pass: group features with explicit data_type
|
|
963
969
|
for feature in features:
|
|
964
|
-
|
|
965
|
-
|
|
970
|
+
if feature.data_type is None:
|
|
971
|
+
none_typed_features.append(feature)
|
|
972
|
+
else:
|
|
973
|
+
f_hash = feature.has_similarity_properties()
|
|
974
|
+
hash_collector[f_hash].add(feature)
|
|
975
|
+
|
|
976
|
+
# Second pass: assign None-typed features to existing groups with matching base hash
|
|
977
|
+
for feature in none_typed_features:
|
|
978
|
+
base_hash = feature.base_similarity_properties()
|
|
979
|
+
assigned = False
|
|
980
|
+
|
|
981
|
+
# Find an existing group with matching base properties
|
|
982
|
+
for existing_hash, group in hash_collector.items():
|
|
983
|
+
any_feature = next(iter(group))
|
|
984
|
+
if any_feature.base_similarity_properties() == base_hash:
|
|
985
|
+
hash_collector[existing_hash].add(feature)
|
|
986
|
+
assigned = True
|
|
987
|
+
break
|
|
988
|
+
|
|
989
|
+
if not assigned:
|
|
990
|
+
# No matching typed group found, create a new group for this None-typed feature
|
|
991
|
+
hash_collector[base_hash].add(feature)
|
|
966
992
|
|
|
967
993
|
return hash_collector
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
from typing import Dict, Set, Type
|
|
2
2
|
from uuid import UUID
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
3
|
+
from mloda.core.prepare.graph.graph import Graph
|
|
4
|
+
from mloda.core.prepare.graph.properties import EdgeProperties, NodeProperties
|
|
5
|
+
from mloda.core.abstract_plugins.feature_group import FeatureGroup
|
|
6
|
+
from mloda.core.abstract_plugins.components.feature import Feature
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class BuildGraph:
|
|
10
10
|
def __init__(
|
|
11
11
|
self,
|
|
12
12
|
feature_link_parents: Dict[UUID, Set[UUID]],
|
|
13
|
-
feature_group_collection: Dict[Type[
|
|
13
|
+
feature_group_collection: Dict[Type[FeatureGroup], Set[Feature]],
|
|
14
14
|
) -> None:
|
|
15
15
|
self._graph = Graph()
|
|
16
16
|
self.feature_link_parents = feature_link_parents
|
|
@@ -29,7 +29,7 @@ class BuildGraph:
|
|
|
29
29
|
self.graph.add_edge(parent, child, self._create_edge_properties(parent, child))
|
|
30
30
|
|
|
31
31
|
def _create_property_mapping(
|
|
32
|
-
self, feature_group_collection: Dict[Type[
|
|
32
|
+
self, feature_group_collection: Dict[Type[FeatureGroup], Set[Feature]]
|
|
33
33
|
) -> Dict[UUID, NodeProperties]:
|
|
34
34
|
"""
|
|
35
35
|
Creates a flattened mapping of feature UUIDs to NodeProperties.
|
|
@@ -3,7 +3,7 @@ from copy import copy
|
|
|
3
3
|
from typing import DefaultDict, Dict, List, Set
|
|
4
4
|
from uuid import UUID
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from mloda.core.prepare.graph.properties import EdgeProperties, NodeProperties
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Graph:
|
|
@@ -2,12 +2,12 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import Type
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
5
|
+
from mloda.core.abstract_plugins.feature_group import FeatureGroup
|
|
6
|
+
from mloda.core.abstract_plugins.components.feature import Feature
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class NodeProperties:
|
|
10
|
-
def __init__(self, feature: Feature, feature_group_class: Type[
|
|
10
|
+
def __init__(self, feature: Feature, feature_group_class: Type[FeatureGroup]) -> None:
|
|
11
11
|
self.feature = feature
|
|
12
12
|
self.feature_group_class = feature_group_class
|
|
13
13
|
self.name = feature.name
|
|
@@ -19,8 +19,8 @@ class NodeProperties:
|
|
|
19
19
|
class EdgeProperties:
|
|
20
20
|
def __init__(
|
|
21
21
|
self,
|
|
22
|
-
parent_feature_group_class: Type[
|
|
23
|
-
child_feature_group_class: Type[
|
|
22
|
+
parent_feature_group_class: Type[FeatureGroup],
|
|
23
|
+
child_feature_group_class: Type[FeatureGroup],
|
|
24
24
|
) -> None:
|
|
25
25
|
self.parent_feature_group_class = parent_feature_group_class
|
|
26
26
|
self.child_feature_group_class = child_feature_group_class
|