added code

This commit is contained in:
2025-09-10 10:37:55 +02:00
parent 36901c736d
commit c78a68de80
199 changed files with 3561 additions and 22579 deletions
+40 -15
View File
@@ -7,6 +7,7 @@ from torch import nn
import numpy as np
from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler
from torch.nn import BCEWithLogitsLoss, MSELoss
from torch.optim.lr_scheduler import OneCycleLR
from torch.optim import AdamW
@@ -24,6 +25,10 @@ feature_config = {
"$gt": constants.MEASUREMENTS_PER_DAY * 10,
"$lt": constants.MEASUREMENTS_PER_DAY * 150
},
"duration_in_days": {
"$gt": 10,
"$lt": 150,
},
"ends_at": {
"$exists": True,
"$ne": None
@@ -49,6 +54,21 @@ feature_config = {
"static_categorical_features": [
],
"static_continuous_features": [
{
"name": "user_age",
"fn": get_user_age,
"scaler": RobustScaler
},
{
"name": "user_age",
"fn": get_user_height,
"scaler": RobustScaler
},
{
"name": "user_weight",
"fn": get_user_weight,
"scaler": RobustScaler
},
{
"name": "average_cycle_length",
"fn": get_cycle_length_stats,
@@ -133,35 +153,40 @@ feature_config = {
},
],
"target_features": [
# {
# "name": "fertility_probability",
# "fn": partial(get_fertility_probability, shift=0),
# "scaler": MinMaxScaler,
# "accumulation_fn": np.max
# },
# {
# "name": "ov_over_probability",
# "fn": partial(get_ov_over_probability, shift=0),
# "scaler": MinMaxScaler,
# "accumulation_fn": np.max
# },
{
"name": "fertility_probability",
"fn": partial(get_fertility_probability, shift=0),
"scaler": MinMaxScaler,
"accumulation_fn": np.max,
"loss_fn": MSELoss,
},
{
"name": "ov_over_probability",
"fn": partial(get_ov_over_probability, shift=0),
"scaler": MinMaxScaler,
"accumulation_fn": np.max,
"loss_fn": BCEWithLogitsLoss,
},
{
"name": "days_relative_to_ov",
"fn": get_days_relative_to_ov,
"scaler": RobustScaler,
"accumulation_fn": np.max
"accumulation_fn": np.max,
"loss_fn": MSELoss,
},
{
"name": "ov_day",
"fn": get_ov_day,
"scaler": RobustScaler,
"accumulation_fn": np.max
"accumulation_fn": np.max,
"loss_fn": MSELoss,
},
{
"name": "is_biphasic",
"fn": get_is_biphasic,
"scaler": MinMaxScaler,
"accumulation_fn": np.max
"accumulation_fn": np.max,
"loss_fn": BCEWithLogitsLoss
}
]
}