Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix params setting #1121

Merged
merged 5 commits into from
Jul 28, 2023
Merged

Fix params setting #1121

merged 5 commits into from
Jul 28, 2023

Conversation

YamLyubov
Copy link
Collaborator

@YamLyubov YamLyubov commented Jul 21, 2023

Setting of 'nested_space' parameters for node while tuning was not working correctly. While tuning new parameters were at first set for OptGraph and then OptGraph was restored to Pipeline. While restoring, pipeline nodes were created from scratch and new parameters were passed through the constructor of the Node class. That is why 'nested_space' parameters were not processed as they should.

Also examples/simple/multitask_classification_regression_api.py was removed as the functionality is no longer supported.

@aim-pep8-bot
Copy link

aim-pep8-bot commented Jul 21, 2023

Hello @YamLyubov! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2023-07-28 11:11:25 UTC

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #1121 (8c053df) into master (07edf3e) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1121      +/-   ##
==========================================
+ Coverage   78.54%   78.57%   +0.02%     
==========================================
  Files         131      131              
  Lines        9323     9321       -2     
==========================================
+ Hits         7323     7324       +1     
+ Misses       2000     1997       -3     
Files Changed Coverage Δ
fedot/core/pipelines/node.py 94.88% <100.00%> (+1.62%) ⬆️
fedot/core/utils.py 54.79% <100.00%> (+0.62%) ⬆️

... and 3 files with indirect coverage changes

@gkirgizov gkirgizov self-requested a review July 26, 2023 11:01
Comment on lines +113 to +125
@pytest.mark.parametrize('params, expected_params', [(DEFAULT_PARAMS_STUB, {"family": "gaussian", "link": "identity"}),
({}, {"family": "gaussian", "link": "identity"}),
({NESTED_PARAMS_LABEL: {'family': 'gaussian', 'link': 'log'}},
{'family': 'gaussian', 'link': 'log'}),
({'family': 'inverse_gaussian', 'link': 'inverse_power'},
{'family': 'inverse_gaussian', 'link': 'inverse_power'})])
def test_init_and_set_pipeline_node_with_params(params, expected_params):
node = PipelineNode(content={'name': 'glm', 'params': params})
assert node.parameters == expected_params

node = PipelineNode('glm')
node.parameters = params
assert node.parameters == expected_params
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А есть какой-нибудь тест с реальным тюнингом на вложенные параметры?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, тест есть . Подправила его, потому что он предыдущую ошибку не находил)

fedot/core/pipelines/node.py Show resolved Hide resolved
Comment on lines -75 to -77
self._parameters = OperationParameters.from_operation_type(operation.operation_type, **params)
super().__init__(content={'name': operation,
'params': self._parameters.to_dict()}, nodes_from=nodes_from)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не очень понял, в чем тут проблема. Вроде и там и там параметры передаются без изменений. В чем тонкость?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как выше написала смысл в том, чтобы пропустить поступающие параметры через parameters.setter, который верно обработает параметры

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Теперь понял. Оставь, пожалуйста, коммент о необходимости setter, а то из кода это неочевидно

@YamLyubov YamLyubov merged commit c1d2f33 into master Jul 28, 2023
5 checks passed
@YamLyubov YamLyubov deleted the fix-nested-params branch July 28, 2023 11:22
kasyanovse pushed a commit that referenced this pull request Jul 31, 2023
* Fix params setting

* Minor

* PEP 8

* Correct test

* Add comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants