Skip to content

[BUG] catboost with ohe #938

Closed
1 task done
martins0n opened this issue Sep 14, 2022 · 0 comments · Fixed by #957
Closed
1 task done

[BUG] catboost with ohe #938

martins0n opened this issue Sep 14, 2022 · 0 comments · Fixed by #957
Assignees
Labels
bug Something isn't working

Comments

@martins0n
Copy link
Contributor

🐛 Bug Report

sklearn.OneHotEncoder make float vectors by default. ( __init__(..., dtype=np.float64, ...))
Catboost can't work with float based categoricals

Expected behavior

It should work

How To Reproduce

from etna import transforms
from etna.datasets import TSDataset
from etna.datasets import generate_ar_df
from etna.transforms import SegmentEncoderTransform, OneHotEncoderTransform, DateFlagsTransform

from etna_utils.receipts.backtest import backtest

df = generate_ar_df(periods=100, start_time="2021-01-01", n_segments=10)

ts = TSDataset.to_dataset(df)
ts = TSDataset(ts, freq="D")


config = {'_target_': 'etna.pipeline.Pipeline',
 'horizon': 3,
 'model': {'_target_': 'etna.models.CatBoostModelMultiSegment',
  'iterations': 200,
  'depth': 7,
  'learning_rate': 0.14258190425468625,
  'l2_leaf_reg': 1.682549076309009,
  'border_count': 512,
  'loss_function': 'MAE',
  'thread_count': 1},
 'transforms': [{'_target_': 'etna.transforms.StandardScalerTransform',
   'in_column': 'target'},
  {'_target_': 'etna.transforms.DateFlagsTransform',
   'out_column': 'date_flag',
   'week_number_in_month': True},
  {'_target_': 'etna.transforms.FourierTransform',
   'order': 10,
   'period': 365.25},
  {'_target_': 'etna.transforms.FourierTransform', 'order': 5, 'period': 30.5},
  {'_target_': 'etna.transforms.SegmentEncoderTransform'},
  {'_target_': 'etna.transforms.OneHotEncoderTransform',
   'in_column': 'date_flag_day_number_in_month'}]}

aggregated_metrics, metrics, forecast, _ = backtest(
    ts, config, {},
    backtest_config={"n_folds": 20, "metrics": [{"_target_": "etna.metrics.SMAPE"}, {"_target_": "etna.metrics.MAE"}]},
)

Environment

No response

Additional context

No response

Checklist

  • Bug appears at the latest library version
@martins0n martins0n added the bug Something isn't working label Sep 14, 2022
@martins0n martins0n moved this to Specification in etna board Sep 14, 2022
@martins0n martins0n moved this from Specification to Backlog in etna board Sep 14, 2022
@martins0n martins0n moved this from Backlog to Todo in etna board Sep 19, 2022
@Mr-Geekman Mr-Geekman self-assigned this Sep 23, 2022
@Mr-Geekman Mr-Geekman moved this from Todo to In Progress in etna board Sep 23, 2022
@Mr-Geekman Mr-Geekman moved this from In Progress to In Review in etna board Sep 26, 2022
Repository owner moved this from In Review to Done in etna board Sep 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants