You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get a KeyError in supervised_classification.py:77 which you seem to have anticipated.
In the block below, **report[pos_label] gives an error if your data file (as the one I got my hands on from you) contains 1's and 0's in the column corresponding to the outcome variable, e.g. political, instead of the actual positive label which the code seems to assume.
classifier.fit(X[train_index], y[train_index])
y_pred=classifier.predict(X[test_index])
report=classification_report(
y[test_index], y_pred, output_dict=True
)
# The positive label is the same as the column name.# But THIS MIGHT CHANGE so beware that then# we have to relax the assumption in the next line.pos_label=outcomerecord= {
"model": model,
"outcome": outcome,
"fold": i_fold,
"accuracy": report["accuracy"],
**report[pos_label],
}
records.append(record)
Looks like an easy fix.
The text was updated successfully, but these errors were encountered:
I get a
KeyError
insupervised_classification.py:77
which you seem to have anticipated.In the block below,
**report[pos_label]
gives an error if your data file (as the one I got my hands on from you) contains 1's and 0's in the column corresponding to the outcome variable, e.g.political
, instead of the actual positive label which the code seems to assume.Looks like an easy fix.
The text was updated successfully, but these errors were encountered: