def min_max_pred(
pred_df: pd.DataFrame, fit_live_predictions_candles: int, label_period_candles: int
-):
+) -> tuple[float, float]:
beta = 10.0
extrema = pred_df.tail(label_period_candles)["&s-extrema"]
min_pred = smooth_min(extrema, beta=beta)
def __min_max_pred(
pred_df: pd.DataFrame, fit_live_predictions_candles: int, label_period_candles: int
-):
+) -> tuple[float, float]:
pred_df_sorted = (
pred_df.select_dtypes(exclude=["object"])
.copy()
fit_live_predictions_candles,
candles_step,
params,
-):
+) -> float:
min_train_window: int = 600
max_train_window: int = (
len(X) if len(X) > min_train_window else (min_train_window + len(X))
return error
-def hp_objective(trial, X, y, train_weights, X_test, y_test, test_weights, params):
+def hp_objective(
+ trial, X, y, train_weights, X_test, y_test, test_weights, params
+) -> float:
study_params = {
"n_estimators": trial.suggest_int("n_estimators", 100, 800),
"num_leaves": trial.suggest_int("num_leaves", 2, 256),
return allowed.sub("_", path)
-def smooth_max(series, beta=1.0):
+def smooth_max(series: pd.Series, beta=1.0) -> float:
return np.log(np.sum(np.exp(beta * series))) / beta
-def smooth_min(series, beta=1.0):
+def smooth_min(series: pd.Series, beta=1.0) -> float:
return -np.log(np.sum(np.exp(-beta * series))) / beta
def min_max_pred(
pred_df: pd.DataFrame, fit_live_predictions_candles: int, label_period_candles: int
-):
+) -> tuple[float, float]:
beta = 10.0
extrema = pred_df.tail(label_period_candles)["&s-extrema"]
min_pred = smooth_min(extrema, beta=beta)
def __min_max_pred(
pred_df: pd.DataFrame, fit_live_predictions_candles: int, label_period_candles: int
-):
+) -> tuple[float, float]:
pred_df_sorted = (
pred_df.select_dtypes(exclude=["object"])
.copy()
fit_live_predictions_candles,
candles_step,
params,
-):
+) -> float:
min_train_window: int = 600
max_train_window: int = (
len(X) if len(X) > min_train_window else (min_train_window + len(X))
return error
-def hp_objective(trial, X, y, train_weights, X_test, y_test, test_weights, params):
+def hp_objective(
+ trial, X, y, train_weights, X_test, y_test, test_weights, params
+) -> float:
study_params = {
"n_estimators": trial.suggest_int("n_estimators", 100, 800),
"learning_rate": trial.suggest_float("learning_rate", 1e-3, 0.3, log=True),
return allowed.sub("_", path)
-def smooth_max(series, beta=1.0):
+def smooth_max(series: pd.Series, beta=1.0) -> float:
return np.log(np.sum(np.exp(beta * series))) / beta
-def smooth_min(series, beta=1.0):
+def smooth_min(series: pd.Series, beta=1.0) -> float:
return -np.log(np.sum(np.exp(-beta * series))) / beta