Better handling of "medium" category.

master
junos 2023-05-19 01:10:30 +02:00
parent 8a9595c615
commit 70232949c3
1 changed files with 7 additions and 3 deletions

View File

@ -82,11 +82,15 @@ print(model_input["target"].value_counts())
REMOVE_MEDIUM = True
if ("medium" in model_input["target"]) and REMOVE_MEDIUM:
model_input = model_input[model_input["target"] != "medium"]
model_input["target"] = (
model_input["target"].astype(str).apply(lambda x: 0 if x == "low" else 1)
)
else:
model_input["target"] = model_input["target"].map(
{"low": 0, "medium": 1, "high": 2}
)
print(model_input["target"].value_counts())
model_input["target"] = (
model_input["target"].astype(str).apply(lambda x: 0 if x == "low" else 1)
)
# %% jupyter={"outputs_hidden": false, "source_hidden": false}
# UnderSampling