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

1059 timestamp bug #1065

Merged
merged 27 commits into from
Apr 24, 2023
Merged

1059 timestamp bug #1065

merged 27 commits into from
Apr 24, 2023

Conversation

IIaKyJIuH
Copy link
Collaborator

@IIaKyJIuH IIaKyJIuH commented Mar 13, 2023

Solves issue

Comparison of different approaches:
image

@IIaKyJIuH IIaKyJIuH requested a review from aPovidlo March 13, 2023 09:37
@IIaKyJIuH
Copy link
Collaborator Author

В Numpy-стратегии предполагается, что временной 'unit' - это наносекунды, в моём решении тоже так предполагается, то есть сохраняется поведение.

Вопрос такой: нормально ли вообще использовать такой юнит, или это должны быть хотя бы миллисекунды или просто секунды?

@IIaKyJIuH IIaKyJIuH linked an issue Mar 13, 2023 that may be closed by this pull request
@nicl-nno
Copy link
Collaborator

Может сразу снабдить тестом, воспроизврдящим проблему?

@MorrisNein
Copy link
Collaborator

MorrisNein commented Mar 13, 2023

@IIaKyJIuH, мне кажется, что временное разрешение нужно выбирать на основании минимального шага значений в данных.

Возможно, с запасом в десятичный знак для новых данных. Препроцессинг ведь сможет запомнить выбранное преобразование?

Если это сложно реализовать сейчас, можем в рамках этого PR брать самый малый шаг (нс) и не париться. Правда, это не экономно с точки зрения памяти, поэтому можем завести ещё issue на адаптивное преобразование.

@MorrisNein MorrisNein self-requested a review March 13, 2023 10:28
@IIaKyJIuH
Copy link
Collaborator Author

Может сразу снабдить тестом, воспроизврдящим проблему?

Примерно такого вида тесты напрашиваются. Допилю ещё кейсов, надо подумать.

Думаю, может быть стоит поместить тесты в integration?
Стоит ли ещё добавить проверку в NumpyStrategy случай, когда в np.ndarray попадают pd.Timestamp объекты, или это уже совсем нереальный кейс? Обработки такого случая в NumpyStrategy нет, кстати говоря.
Возможно, этот случай в препроцессоре уже обрабатывается, надо будет уточнить.

@nicl-nno
Copy link
Collaborator

Думаю, может быть стоит поместить тесты в integration?

Думаю лучше пусть будут в модульных. Можно их проводить, без эволюции, с predefined model.

@IIaKyJIuH
Copy link
Collaborator Author

@MorrisNein натолкнул меня на мысль, что нужно вообще изменить подход к обработке datetime фичей.
Оставлять их как есть в виде даты плохо, но и переводить во float тоже неинформативно и как будто сложнее. Особенно когда речь про ts задачи.

Вижу смысл покомпонентно отделять дату на часы, дни, месяцы, года...
Вопрос, есть ли смысл добавлять ключ API какой-то для обработки datetime-фичей? Ключ будет означать тип кодирования: просто во float, покомпонентно, или же ещё как-то. Или всегда лучше их отделять на компоненты и кодировать уже категориально?

@aPovidlo
Copy link
Collaborator

@MorrisNein натолкнул меня на мысль, что нужно вообще изменить подход к обработке datetime фичей. Оставлять их как есть в виде даты плохо, но и переводить во float тоже неинформативно и как будто сложнее. Особенно когда речь про ts задачи.

Может для разных задач, по разному предобработать данные?

Вижу смысл покомпонентно отделять дату на часы, дни, месяцы, года... Вопрос, есть ли смысл добавлять ключ API какой-то для обработки datetime-фичей? Ключ будет означать тип кодирования: просто во float, покомпонентно, или же ещё как-то. Или всегда лучше их отделять на компоненты и кодировать уже категориально?

Покомпонентное разделение вполне разумный шаг, но почему категориально? Это же может сказаться на эффективности моделей. Им же с числами легче работать, чем с категориями (если это не катбуст).

@aim-pep8-bot
Copy link

aim-pep8-bot commented Mar 22, 2023

Hello @IIaKyJIuH! 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-04-24 09:00:35 UTC

@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Attention: Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.79%. Comparing base (83a395a) to head (a5cb31c).
Report is 115 commits behind head on master.

Files with missing lines Patch % Lines
fedot/api/api_utils/data_definition.py 75.00% 1 Missing ⚠️
fedot/core/data/data.py 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1065      +/-   ##
==========================================
- Coverage   87.81%   87.79%   -0.03%     
==========================================
  Files         132      132              
  Lines        9355     9372      +17     
==========================================
+ Hits         8215     8228      +13     
- Misses       1140     1144       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@IIaKyJIuH
Copy link
Collaborator Author

Провёл тесты качества на проблемном датасете из issue. Использовал catboost в качестве модели. В 2 из 3 случаев наносекунды по качеству совпадают с миллисекундами (скрин):
image

Почему так - неизвестно. В остальном количестве случаев качество между всеми моделями идентичное. Получается, миллисекунды можно ставить, хуже не будет.

@aPovidlo
Copy link
Collaborator

Почему так - неизвестно. В остальном количестве случаев качество между всеми моделями идентичное. Получается, миллисекунды можно ставить, хуже не будет.

Предположу, что возможно это связанно с фиксированием в RandomStateHandler у кб или подтягиванием одной и той же модели из кеша

@IIaKyJIuH
Copy link
Collaborator Author

Почему так - неизвестно. В остальном количестве случаев качество между всеми моделями идентичное. Получается, миллисекунды можно ставить, хуже не будет.

Предположу, что возможно это связанно с фиксированием в RandomStateHandler у кб или подтягиванием одной и той же модели из кеша

Сид передаю определённый, т.е. он устанавливается воспроизводимый и одинаковый всегда.
Кеш я вообще отключил, так что тут сложнее)

@IIaKyJIuH
Copy link
Collaborator Author

Уже намеревался смёрджить ветку, как вдруг задумался и понял, что контракт на use_input_preprocessing в моих текущих правках не выполняется.
Передавать его глубоко в DataDefiner'ы выглядит неэстетично (уже попробовал), нужно засунуть эту конвертацию в "обязательную предобработку", которая как раз подвязана на тот параметр.

# Convert datetime data to numerical
data.features = np_datetime_to_numeric(data.features)
if data.target is not None:
data.target = np_datetime_to_numeric(data.target) # TODO: А нужно ли конвертировать таргет из даты в число?
Copy link
Collaborator

Choose a reason for hiding this comment

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

А этот вопрос не относится к этому PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Вопрос относится к этому PR.
Кажется, что кейс с датами в таргете редкий, но вероятен же?

fedot/core/data/data.py Outdated Show resolved Hide resolved
@IIaKyJIuH IIaKyJIuH merged commit aa39918 into master Apr 24, 2023
@IIaKyJIuH IIaKyJIuH deleted the 1059-timestamp-bug branch April 24, 2023 10:19
GrigoriJasnovidov added a commit to GrigoriJasnovidov/FEDOT that referenced this pull request Aug 17, 2023
deleted redundant files

corrected typos

simplifeid code

remove redundant

correct pep8 issues

add example

add mutations

correct visualization fiting process

improve visualization

add partial in solver.py

add example in .py format

examples/confidence_intervals

move prediction intervals in core/pipelines

delete old examples

add unit tests

Refactoring of ApiParams and ApiMetrics (aimclub#1041)

* WIP refactor ApiParams

* Remove explicit ApiParams initialization

* Move all params initialization to ApiParams

* Minor changes

* Remove _divide_params

* WIP create ApiParamsBuilder

* Add ApiParamsBuilder

* Minor

* Rename history_folder to history_dir

* Remove train_data from ApiParams

* Fixes after rebase

* Move obtain_metric to ApiMetrics

* Fix plot_pareto

* Fix Fedot.tune

* Refactor Fedot.get_metrics

* Fix Fedot.tune

* Fix metric names

* Fixes after rebase

* Remove ApiParamsBuilder

* Structure parameters in Fedot docstring

* Refactor init_composer_requirements

* Refactor init_optimizer_params

* Refactor init_optimizer_params

* Fix docstrings

* Add tests for ApiParamsRepository

* Minors

* Fix test_api_params

* Review fixes

* Review fixes

* Review fixes

Hotfix of pipeline import export example (aimclub#1064)

meta rules  (aimclub#1057)

* initial assumption

* final architecture

* add meta rules

* minor

* simplify

* add meta rule

* fix with cv folds

* minors

* fix types

* minor

* golem fixes

* add log messages

* pep8

* remove log file

Fix initial assumptions as list of pipelines (aimclub#1070)

`Fedot(..., initial_assumption=...)` is expected to get a sequence of pipelines and pass them as initial graphs to an optimizer via composer.

Moreover, FEDOT itself generates more than one initial assumption by default.

As the result of this bug, composer passed only one of the initial assumptions to an optimizer.

This PR fixes the bug and adds the corresponding test.

tests fix (aimclub#1073)

* remove some assumptions

* update requirements

* fix pep8

* update to golem

Docs updated, badges added (aimclub#1072)

* Docs updated, badges added

* Mirror workflow fix

Improve API documentation (aimclub#1067)

- Moved type hints from method headers to corresponding parameters.

- Allowed referencing GOLEM objects in FEDOT documentation.

- Replaced all url links to documentation pages with sphinx references - it fixed some broken links.

- FEDOT now uses its own directory for cache, instead of using GOLEM folder.

- Documented `**composer_tuner_params` of `Fedot` with type hints and default values.

All parameters with no usage examples are placed to the separate issue aimclub#1076

minor meta fix (aimclub#1078)

* minor fix

* indent fix

* minor

Add catboost to default initial assumptions (aimclub#1081)

* add catboost to default initial assumptions for classification

* restrict mutating loss function in CatBoost

* evaluate f1 as expected in the example

* pep8

F1 averaging fix (aimclub#1083)

Minor logging fix (aimclub#1082)

* fix print instead of logging for memory consumption

1059 timestamp bug (aimclub#1065)

879 FEDOT features (aimclub#1075)

describe framework's features

add example for surrogate optimizer (aimclub#1085)

Example with surrogate optimizer was added. External parameters field was removed from api (now we should use partial)

related pull request in GOLEM aimclub/GOLEM#82

has_one_root fix (aimclub#1091)

* has_one_root fix

* test fix

Remove outdated test handled in thegolem (aimclub#1101)

358 Reduce execution time for unit tests (aimclub#1098)

Update RTD benchmarks tabular data page (aimclub#1099)

* +csv support

Golem update requirements (aimclub#1088)

* Upd RemoveType in Advisor (golem sync)

* Upd requirements.txt for stable GOLEM

* Fix few imports

Add ts bench (aimclub#1104)

Add results from ts benchmark

Release 0.7.1 and test workflow updates (aimclub#1105)

* Upd release version

* Add pre-release tests actions on 'release' branch; Disable auto-publish

* Upd GOLEM version

* Remove manual-build.yml (dup of integration-build.yml)

* Add integration tests badge to README

* Revert "Upd GOLEM version" (for PR in master)

This reverts commit 257ff16.

Hotfix some integration tests for release 071 (aimclub#1107)

* Fix integration test of ApiParams

* Fix integration test of composition_time

* Fix integration test of metocean_forecasting

* Fix integration test of nemo_multiple.py

* Workaround for sqlite exception raised in tests

* pep8 fixes

* fix different seed in quality imporvement tests

* simplify condition

* remove test that barely tested anything

* fix condition

* remove seed from example

* fix typo

parallel cache files test fix (aimclub#1109)

Add IOptTuner (aimclub#1102)

* Refactor search space

* Fix ParametersChanges

* Redact tuner builder

* PEP 8

* Fix examples and correct tuning docs

* Add IOpt example to docs

* Add simple IOpt example

* Fix integration tests (6 steal not work)

* Fix integration test test_tuner_builder_with_custom_params (6 steal not work)

* Fix pep8

* Add tuners comparison in docs

* Update golem version in requirements

* Fix warn_requirements

* Fix warn_requirements

* Fix table in tuning docs

* Fix credit_scoring_problem_multiobj.py

* Fix extra requirements

* Edit docs

* Fix table in docs

* Change requirements

* Test requirements

* Set stable branch

+ h2o benchmark's tabular data values  (aimclub#1106)

* +h2o vals

* change csv to html

* specified table uuid

* change max values style

* add df to html converter

---------

Co-authored-by: nicl-nno <nicl.nno@gmail.com>

Added results for multimodal benchmark into FEDOT.docs (aimclub#1115)

* - added results for multimodal benchmark

...

add docstrings and type hints

add prediction intervals unit test

simplified solvers code

correct pep issues

add class defining PredictionIntervals params

fix MutationStrength import issue

correct test_data path

update imports

updated unit tests

correct type-hint

small corrections

take short ts for unit test

update pred_int test

change ql_models to 'max' in pred_ints test

update params for ql method

...

update example

update tests

add base_quantiles visualization

fix import get_base_quantiles

update examples and deleted ql from tests

update

pep

pep issues

pep

pep

update requirements.txt
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.

Bug: Timestamp cause crush in Preprocessing
5 participants