Set more parameters as user-specified constants.

master
junos 2023-05-18 18:06:32 +02:00
parent cad28c3fe8
commit b756ed5feb
1 changed files with 9 additions and 6 deletions

View File

@ -73,18 +73,21 @@ model_input["target"].value_counts()
# %% jupyter={"outputs_hidden": false, "source_hidden": false}
# bins = [-10, 0, 10] # bins for z-scored targets
bins = [-1, 0, 4] # bins for stressfulness (0-4) target
BINS = [-1, 0, 4] # bins for stressfulness (0-4) target
print("BINS: ", BINS)
model_input["target"], edges = pd.cut(
model_input.target, bins=bins, labels=["low", "high"], retbins=True, right=True
model_input.target, bins=BINS, labels=["low", "high"], retbins=True, right=True
) # ['low', 'medium', 'high']
model_input["target"].value_counts(), edges
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"]
print(model_input["target"].value_counts())
model_input["target"] = (
model_input["target"].astype(str).apply(lambda x: 0 if x == "low" else 1)
)
model_input["target"].value_counts()
# %% jupyter={"outputs_hidden": false, "source_hidden": false}
# UnderSampling
if UNDERSAMPLING: