for k, values in numeric_acc.items():
if not values:
continue
- mean = np.mean(values)
- aggregated_info[k] = mean
+ aggregated_info[k] = np.mean(values)
if len(values) > 1:
try:
- aggregated_info[f"{k}_std"] = np.std(values)
+ aggregated_info[f"{k}_std"] = np.std(values, ddof=1)
except Exception:
pass
try:
self.logger.record("info/n_envs", int(len(infos_list)))
except Exception:
- pass
+ try:
+ self.logger.record(
+ "info/n_envs", int(len(infos_list)), exclude=("tensorboard",)
+ )
+ except Exception:
+ pass
if filtered_values > 0:
try:
category, {}
).get(metric)
if isinstance(value, (int, float)) and count and count > 0:
- mean = float(value) / float(count)
- self.logger.record(f"{category}/{metric}_mean", mean)
+ self.logger.record(
+ f"{category}/{metric}_mean", float(value) / float(count)
+ )
except Exception:
try:
count = aggregated_tensorboard_metric_counts.get(
category, {}
).get(metric)
if isinstance(value, (int, float)) and count and count > 0:
- mean = float(value) / float(count)
self.logger.record(
f"{category}/{metric}_mean",
- mean,
+ float(value) / float(count),
exclude=("tensorboard",),
)
except Exception:
else:
progress_done = 0.0
progress_remaining = 1.0 - progress_done
- self.logger.record("train/progress_done", progress_done)
- self.logger.record("train/progress_remaining", progress_remaining)
+ try:
+ self.logger.record("train/progress_done", progress_done)
+ self.logger.record("train/progress_remaining", progress_remaining)
+ except Exception:
+ try:
+ self.logger.record(
+ "train/progress_done",
+ progress_done,
+ exclude=("tensorboard",),
+ )
+ self.logger.record(
+ "train/progress_remaining",
+ progress_remaining,
+ exclude=("tensorboard",),
+ )
+ except Exception:
+ pass
except Exception:
progress_remaining = 1.0
if callable(lr):
lr = lr(progress_remaining)
if isinstance(lr, (int, float)) and np.isfinite(lr):
- self.logger.record("train/learning_rate", float(lr))
+ try:
+ self.logger.record("train/learning_rate", float(lr))
+ except Exception:
+ try:
+ self.logger.record(
+ "train/learning_rate",
+ float(lr),
+ exclude=("tensorboard",),
+ )
+ except Exception:
+ pass
except Exception:
pass
if callable(cr):
cr = cr(progress_remaining)
if isinstance(cr, (int, float)) and np.isfinite(cr):
- self.logger.record("train/clip_range", float(cr))
+ try:
+ self.logger.record("train/clip_range", float(cr))
+ except Exception:
+ try:
+ self.logger.record(
+ "train/clip_range",
+ float(cr),
+ exclude=("tensorboard",),
+ )
+ except Exception:
+ pass
except Exception:
pass
dataframe: pd.DataFrame, window: int = 20, std_factor: float = 1.0
) -> tuple[pd.Series, pd.Series, pd.Series]:
vwap = qtpylib.rolling_vwap(dataframe, window=window)
- rolling_std = vwap.rolling(window=window, min_periods=window).std()
+ rolling_std = vwap.rolling(window=window, min_periods=window).std(ddof=1)
vwap_low = vwap - (rolling_std * std_factor)
vwap_high = vwap + (rolling_std * std_factor)
return vwap_low, vwap, vwap_high