Plotting Learning Curve for FLAML model using scikit-learn pipeline and Yellowbrick

15 views
Skip to first unread message

Daniel Brami

unread,
Sep 23, 2022, 2:15:48 AM9/23/22
to Yellowbrick
Hi all,
I have been banging my head against a wall for two days now trying to plot proper learning curves as described here:

Plotting an ROC curve works successfully using following code:
'''from yellowbrick.classifier import ROCAUC
from yellowbrick.contrib.wrapper import wrap

model = wrap(pipeline)
visualizer = ROCAUC(model)
visualizer.fit(X_train, y_train)
visualizer.score(X_test, y_test)
visualizer.show()'''

but my learning curve code does not work:

from yellowbrick.model_selection import LearningCurve

# Create the learning curve visualizer
#cv = StratifiedKFold(n_splits=12)
sizes = np.linspace(0.3, 1.0, 10)

# Instantiate the classification model and visualizer
#model = MultinomialNB()
visualizer = LearningCurve(
    model, scoring='f1_weighted', train_sizes=sizes)

# error section
visualizer.fit(X, y)        # Fit the data to the visualizer
visualizer.show()           # Finalize and render the figure

--------------------------------------------------------------------------- Empty Traceback (most recent call last) File ~/miniconda3/envs/ML/lib/python3.10/site-packages/joblib/parallel.py:862, in Parallel.dispatch_one_batch(self, iterator) 861 try: --> 862 tasks = self._ready_batches.get(block=False) 863 except queue.Empty: 864 # slice the iterator n_jobs * batchsize items at a time. If the 865 # slice returns less than that, then the current batchsize puts (...) 868 # accordingly to distribute evenly the last items between all 869 # workers.
...
   1569 return_train_score=True, 1570 error_score=error_score, 1571 return_times=return_times, 1572 ) 1573 for train, test in train_test_proportions 1574 ) 1575 results = _aggregate_score_dicts(results) 1576 train_scores = results["train_scores"].reshape(-1, n_unique_ticks).T File ~/miniconda3/envs/ML/lib/python3.10/site-packages/sklearn/base.py:88, in clone(estimator, safe) 86 for name, param in new_object_params.items(): 87 new_object_params[name] = clone(param, safe=False) ---> 88 new_object = klass(**new_object_params) 89 params_set = new_object.get_params(deep=False) 91 # quick sanity check of the parameters of the clone TypeError: ContribEstimator.__init__() got an unexpected keyword argument 'memory' 

Please help!

PS: how do you enable code formatting in this message? I can repost using markdown

Reply all
Reply to author
Forward
0 new messages