Improve removal of "medium" class.

master
junos 2023-05-31 22:46:49 +02:00
parent 112d968715
commit db06584ddd
1 changed files with 3 additions and 2 deletions

View File

@ -102,8 +102,9 @@ model_input["target"], edges = pd.cut(
) # ['low', 'medium', 'high'] ) # ['low', 'medium', 'high']
print(model_input["target"].value_counts()) print(model_input["target"].value_counts())
REMOVE_MEDIUM = True REMOVE_MEDIUM = True
if ("medium" in model_input["target"]) and REMOVE_MEDIUM: if REMOVE_MEDIUM:
model_input = model_input[model_input["target"] != "medium"] if "medium" in model_input["target"]:
model_input = model_input[model_input["target"] != "medium"]
model_input["target"] = ( model_input["target"] = (
model_input["target"].astype(str).apply(lambda x: 0 if x == "low" else 1) model_input["target"].astype(str).apply(lambda x: 0 if x == "low" else 1)
) )