Conversation
cef2ab3 to
eae5fec
Compare
…keys in config settings
d232c1d to
88e31c5
Compare
…ts, without robustness
…nd scores from dict to dataframe, broken tests
|
@kapil-agnihotri, as discussed today, you can start having a look at the progress of transforming ProMCDA into a library and leave me any comments and suggestions. @mspada, you can also start familiarising yourself with the transformation of ProMCDA. This is not a working version yet. From the commit where I changed the output format of the normalised criteria values and scores to DataFrames (instead of dictionaries) to expose them directly to the user calling the "normalize" and "aggregate" methods, the tests fail and you cannot use the library in the notebook. I am currently working on this. My plan for the next release is to (in no particular order)
In the final version, all tests should run again and we need to proof all the functionalities with test data. |
| MINIMUM = 'minimum' | ||
|
|
||
|
|
||
| class NormalizationNames4Sensitivity(Enum): |
There was a problem hiding this comment.
I would refactor this enum to SensitivityNormalization
| RANK = 'rank' | ||
|
|
||
|
|
||
| class OutputColumnNames4Sensitivity(Enum): |
There was a problem hiding this comment.
I would refactor it to SensitivityOutputColumns
| """ | ||
| Names of output columns in case of sensitivity analysis | ||
| """ | ||
| WS_MINMAX_01 = 'ws-minmax_01' |
There was a problem hiding this comment.
Applies to all the enums from L47 to L59:
Why do they have hyphen- and underscore _ both in values?
I would recommend to use underscore _ for all the values as it would increase readability and also will be as per the standards.
Although they are just output column names, still it would be great to avoid hyphen.
| :rtype: bool | ||
| """ | ||
|
|
||
| keys_of_dict_values = { |
There was a problem hiding this comment.
It would be great to simplify these keys based on ranking service logic and open API specification that we created in the past.
robustness
monte_carlo
Also rename keys based on Open API specification.
|
|
||
| keys_of_dict_values = { | ||
| 'sensitivity': ['sensitivity_on', 'normalization', 'aggregation'], | ||
| 'robustness': ['robustness_on', 'on_single_weights', 'on_all_weights', 'given_weights', 'on_indicators'], |
There was a problem hiding this comment.
Also, it would be preferable to add these keys in enum instead of defining them here otherwise there would be multiple occurrence of these spread in your code.
| Tuple[List[str], None, None, dict]]: | ||
| """ | ||
| Manage polarities and weights based on the specified robustness settings, ensuring that the appropriate adjustments | ||
| and normalizations are applied before returning the necessary data structures. |
There was a problem hiding this comment.
Any doc on return types?
| rand_weight_per_indicator = {} | ||
|
|
||
| # Managing polarities | ||
| if is_robustness_indicators == 0: |
There was a problem hiding this comment.
Again no need for explicit comparison to 0 or 1
mcda/models/ProMCDA.py
Outdated
| self.aggregated_matrix = None | ||
| self.ranked_matrix = None | ||
|
|
||
| def validate_inputs(self) -> Tuple[int, int, list, Union[list, List[list], dict], dict]: |
There was a problem hiding this comment.
I would expect this method to only validate and not to extract values
mcda/models/ProMCDA.py
Outdated
| def run_mcda(self, is_robustness_indicators: int, is_robustness_weights: int, | ||
| weights: Union[list, List[list], dict]): | ||
| """ | ||
| Execute the full ProMCDA process, either with or without uncertainties on the indicators. |
| if method is None or method == NormalizationFunctions.TARGET.value: | ||
| indicators_target_01 = norm.target(feature_range=(0, 1)) | ||
| indicators_target_without_zero = norm.target(feature_range=(0.1, 1)) | ||
| add_normalized_df(indicators_target_01, "target_01") |
There was a problem hiding this comment.
hard coded string you can easily use enums here
|
Continues in #64 |
1 similar comment
|
Continues in #64 |
ProMCDA is refactored to become a library initiated in a Python environment by a few input parameters. There is no need for a configuration file, and intermediary and final calculations are exposed to the user.
ProMCDA is also refactored to be modular and flexible.
The refactoring facilitates the use of an API to call ProMCDA as a service.