In a rasa_nlu function they are calling GridSearchCV.fit ()
with clf.fit ()
and it generates some Warnings that I would like to capture and modify for know what drives them:
Fitting 2 folds for each of 6 candidates, totalling 12 fits
/home/mike/Programming/Rasa/myflaskapp/rasaenv/lib/python3.5/site-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
/home/mike/Programming/Rasa/myflaskapp/rasaenv/lib/python3.5/site-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
/home/mike/Programming/Rasa/myflaskapp/rasaenv/lib/python3.5/site-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
/home/mike/Programming/Rasa/myflaskapp/rasaenv/lib/python3.5/site-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
/home/mike/Programming/Rasa/myflaskapp/rasaenv/lib/python3.5/site-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
/home/mike/Programming/Rasa/myflaskapp/rasaenv/lib/python3.5/site-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
'precision', 'predicted', average, warn_for)
[Parallel(n_jobs=1)]: Done 12 out of 12 | elapsed: 0.1s finished
This is how GridSearchCV
is built:
cv_splits = self._num_cv_splits(y) #Quando eu imprimi, ele me deu "2", eu esperava algo mais relacionado aos rótulos
GridSearchCV(SVC(C=1,
probability=True,
class_weight='balanced'),
param_grid=tuned_parameters,
n_jobs=num_threads,
cv=cv_splits,
scoring='f1_weighted',
verbose=1)
Where e
are the labels that have been converted into numbers
y: [1 0 2 1 1 1 1 1 1 0 0 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
3 3]
labels: ['greet', 'goodbye', 'inform', 'greet', 'greet', 'greet', 'greet', 'greet', 'greet', 'goodbye', 'goodbye', 'goodbye', 'goodbye', 'goodbye', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'inform', 'laughing', 'laughing']
Ideally, I'd like to know which one triggered the Warnings. I know that this link can help. However, I still could not get the tags.
Update
When I tried to get the source, I still could not find a way to catch the warning:
fit_result = self.clf.fit (X, y)
y_pred = self.clf.predict (X)
print ("set (y) -set (y_pred): \ n", conjunto (y) -set (y_pred))
But this gives me an empty set set()
It is also necessary to use .predict (X)
? Is it different from clf.fit ()
results?