(problem_type)
| 3711 | |
| 3712 | @pytest.mark.parametrize('problem_type', ['binclass', 'multiclass', 'regression']) |
| 3713 | def test_cv_with_text(problem_type): |
| 3714 | cats_words = ['Meow', 'Kitten', 'Paw', 'Tail', 'Purring', 'Crouch', 'Whisker'] |
| 3715 | dogs_words = ['Puppy', 'Whelp', 'Woof', 'Tail', 'Paw', 'Snarl', 'Barking'] |
| 3716 | words = [cats_words, dogs_words] |
| 3717 | np.random.seed(1) |
| 3718 | labels = np.random.choice(2, 1000) |
| 3719 | texts = [[' '.join(np.random.choice(words[label], 3, replace=False))] for label in labels] |
| 3720 | data_pool = Pool(data=texts, label=labels, text_features=[0]) |
| 3721 | train_dir_prefix = test_output_path('') |
| 3722 | params = { |
| 3723 | 'loss_function': { |
| 3724 | 'binclass': 'Logloss', |
| 3725 | 'multiclass': 'MultiClass', |
| 3726 | 'regression': 'RMSE' |
| 3727 | }[problem_type], |
| 3728 | 'iterations': 10, |
| 3729 | 'random_seed': 42, |
| 3730 | 'learning_rate': 0.5, |
| 3731 | 'train_dir': os.path.join(train_dir_prefix, 'catboost_info') |
| 3732 | } |
| 3733 | result = cv(iterations=10, pool=data_pool, params=params, fold_count=3).round(decimals=3) |
| 3734 | |
| 3735 | preds_path = test_output_path(CV_CSV_PATH) |
| 3736 | result.to_csv(preds_path) |
| 3737 | return local_canonical_file(preds_path) |
| 3738 | |
| 3739 | |
| 3740 | def test_cv_with_save_snapshot(task_type): |
nothing calls this directly
no test coverage detected