Hi!
My implementations passed all the tests so far, but when I run this cell:
treatment_model, best_hyperparam_treat = holdout_grid_search(RandomForestClassifier,
X_treat_train, y_treat_train,
X_treat_val, y_treat_val, hyperparams)
I get the following error:
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
dict_keys(['n_estimators', 'max_depth', 'min_samples_leaf', 'random_state'])
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-85-ebddece39f65> in <module>()
2 treatment_model, best_hyperparam_treat = holdout_grid_search(RandomForestClassifier,
3 X_treat_train, y_treat_train,
----> 4 X_treat_val, y_treat_val, hyperparams)
<ipython-input-83-04fc2f5d43af> in holdout_grid_search(clf, X_train_hp, y_train_hp, X_val_hp, y_val_hp, hyperparam, verbose)
67
68 # Evaluate the model's performance using the regular concordance index
---> 69 estimator_score = concordance_index(y_val_hp, preds)
70
71 # if the model's c-index is better than the previous best:
/opt/conda/lib/python3.6/site-packages/lifelines/utils/concordance.py in concordance_index(event_times, predicted_scores, event_observed)
52 """
53 event_times, predicted_scores, event_observed = _preprocess_scoring_data(
---> 54 event_times, predicted_scores, event_observed
55 )
56 num_correct, num_tied, num_pairs = _concordance_summary_statistics(event_times, predicted_scores, event_observed)
/opt/conda/lib/python3.6/site-packages/lifelines/utils/concordance.py in _preprocess_scoring_data(event_times, predicted_scores, event_observed)
255 raise ValueError("Event times and predictions must have the same shape")
256 if event_times.ndim != 1:
--> 257 raise ValueError("Event times can only be 1-dimensional: (n,)")
258
259 if event_observed is None:
ValueError: Event times can only be 1-dimensional: (n,)
Any tips on how to solve this?
Thanks!