Module contents
Stage 5 of 8Research 110 min

Debugging PPO and measuring which details matter

Instrument PPO diagnostics, investigate deliberately induced failures, and measure implementation details with a multi-seed ablation informed by published studies.

After this lesson you can

  • Record PPO diagnostics and define healthy operating ranges for each.
  • Induce known failures and recognize their diagnostic signatures.
  • Design and run an implementation-detail ablation with five seeds.
  • Report effects using IQM and intervals and compare them with the literature.

Before you start

A return does not tell the whole story

A curve can fall because the policy changed abruptly, the critic stopped fitting its target, or a modification changed data scale. Seed variation can also lower it. What should you observe before touching another hyperparameter? Use signals measured at defined times together with an experiment changing one factor at a time.

This lesson instruments the previous lesson’s PPO, induces known failures and compares variants on Hopper and HalfCheetah. A signature is a pattern observed under a specific intervention, not an infallible cause identifier. The goal is to formulate and rule out hypotheses, not memorize one reference value for all environments.

What each diagnostic measures

With observations and actions stored by the old policy, define d=log⁡πnew(a∣s)−log⁡πold(a∣s)d=\log\pi_{\mathrm{new}}(a\mid s)-\log\pi_{\mathrm{old}}(a\mid s) and r=edr=e^d. Two per-sample old-to-new policy KL estimators are

k1=−d,k3=ed−1−d.k_1=-d,\qquad k_3=e^d-1-d.

Assume normalized common-support distributions with finite expectations at each state, and a new policy fixed relative to the actions used for estimation. Sampling actions from the old policy gives Eold[r]=1\mathbb E_{\mathrm{old}}[r]=1, so both estimate DKL(πold∥πnew)D_{\mathrm{KL}}(\pi_{\mathrm{old}}\Vert\pi_{\mathrm{new}}) conditional on sampled states. The first estimator’s expectation is the KL definition; the second adds E[r]−1=0\mathbb E[r]-1=0. This equality concerns expectations, not each batch. If the new policy was fitted using those same actions, it depends on them and this argument does not establish unbiasedness: post-update means on reused rollout are empirical diagnostics. Independent action evaluation with fixed policies restores the conditional calculation’s assumptions. A finite mean of k1k_1 can be negative; k3k_3 is nonnegative samplewise because ed≥1+de^d\ge 1+d.

Direction matters: reversing old and new yields a different KL. Timing matters too: ratios measured before updating with the same observations and actions should equal one; after several epochs they may be larger. A last-minibatch mean must not be called a full-batch mean. To avoid cancellation near zero, calculate k3k_3 as expm1(d) - d; for extremely large ratios even the exponential can overflow and should be investigated, not hidden.

A variance counterexample

Nonnegativity of k3k_3 does not imply uniformly lower variance. For a given state let old policy be N(0,1)N(0,1) and new policy N(μ,1)N(\mu,1) with fixed μ\mu. If x∼N(0,1)x\sim N(0,1), then d=μx−μ2/2d=\mu x-\mu^2/2 and both expectations are μ2/2\mu^2/2. Exact variances are

Var⁡(k1)=μ2,Var⁡(k3)=eμ2−1−μ2.\operatorname{Var}(k_1)=\mu^2,\qquad \operatorname{Var}(k_3)=e^{\mu^2}-1-\mu^2.

The second identity uses E[ed]=1\mathbb E[e^d]=1, E[e2d]=eμ2\mathbb E[e^{2d}]=e^{\mu^2} and Cov⁡(ed,d)=μ2\operatorname{Cov}(e^d,d)=\mu^2. For small separation k3k_3 can have less variance; as separation grows it can have much more. The cell calculates formulas and compares a simulated sample under this explicit model. Simulation is a mathematical check, not a PPO run.

[ ]Two estimators for known GaussiansBrowser
import numpy as np

rng = np.random.default_rng(2048)
x = rng.normal(size=100000)
for mu in (.5, 2.):
    d = mu * x - mu**2 / 2
    k1 = -d
    k3 = np.expm1(d) - d
    print('mu', mu, 'KL exacta', round(mu**2 / 2, 6),
          'varianzas exactas', round(mu**2, 6), round(np.expm1(mu**2) - mu**2, 6))
    print('muestra: medias', round(float(k1.mean()), 6), round(float(k3.mean()), 6),
          'varianzas', round(float(k1.var()), 6), round(float(k3.var()), 6))

Finite-sample means and variances need not equal expectations exactly. An exponential transformation can produce highly variable tails; increasing a single action sample does not replace independent training runs.

Clipped fraction, critic and entropy

Usual clipped fraction is the proportion of samples satisfying ∣r−1∣>ϵ|r-1|>\epsilon. It does not exactly count zeroed gradients: positive advantage plateaus at the upper edge and negative at the lower. A low value alone does not prove policy health; it can accompany tiny learning rate, near-zero advantages or an incorrect ratio. High fraction and rising KL warn of observed change but do not automatically identify cause.

Explained variance is 1−Var⁡(y−y^)/Var⁡(y)1-\operatorname{Var}(y-\hat y)/\operatorname{Var}(y) for positive-variance targets yy. It can be negative and is undefined when target variance is zero. High explained variance can coexist with large mean error: a constant prediction shift changes MSE but not residual variance. The value target also comes from rollout and previous critic; a good score against it does not automatically verify true value or actor performance.

For a diagonal Gaussian, differential entropy sums log⁡σi+12log⁡(2πe)\log\sigma_i+\tfrac12\log(2\pi e) over dimensions. Here it is entropy of latent action before environment clipping. It may be negative because it is differential entropy; sign alone is not an error. A decline can signal lost exploration, but effects depend on action scale and task. Compare per-dimension deviations too: a sum can hide one component collapsing.

Gradient norm before clipping indicates signal size reaching the optimizer; the post-clipping norm indicates what was delivered after the bound. With Adam that bound does not guarantee policy distance. Record actor and critic norms separately to diagnose contributions, and state whether global norm is computed before or after gradient accumulation and clipping. Also retain learning rate, value loss, raw evaluation return, batch size and seeds.

There is no universally healthy range for these signals. One practice is to fix thresholds or changes triggering inspection in a particular implementation and compare against control runs. Thresholds are not theorems: the same number can mean different things depending on batch size, measurement time, reward scale and epoch count.

Some consistency checks do not depend on a performance threshold. For finite log densities and an unchanged policy, ratios with identical inputs and actions are one, both KL estimators zero, and fraction outside a positive-width band zero. A measured proportion must lie in [0,1][0,1]. With positive target variance and finite computations, explained variance cannot exceed one although it can be arbitrarily negative. Gradient norm is nonnegative. If these conditions fail, inspect computation or definition before interpreting training.

A practical operating range answers a question, such as an acceptable rate of policy change under fixed batch, epoch count and action scale. Fix a target KL in advance and decide to stop epochs when the full-batch estimate exceeds it, knowing the rule is approximate and an after-the-fact check does not undo steps already taken. Recalibrate if measurement changes. A signal within the chosen range does not guarantee good return either: metrics describe optimization, not directly task completion.

Intervene without confusing causes

For diagnosis, freeze a control configuration and change one factor at a time. The following interventions ask distinct questions:

InterventionQuestionWhat the name alone cannot establish
High learning rateHow does policy change with larger optimizer steps?That every high KL necessarily has this cause.
Unnormalized advantagesWhat happens when retaining original advantage scale?That normalization always helps every task.
Reversed actor signIs the negative of the correct objective minimized?That falling return proves a sign error.
Bootstrap zeroed at truncationWhat is lost when an external limit is treated as genuine termination?That the effect is large when truncations are rare.

Control and failures must save the same measurements on the same evaluation schedule. One modification can produce a weak or overlapping signature: honestly report when the diagnostic does not distinguish cases under that protocol. A sign or mask unit test may be more conclusive than inferring a bug from noisy curves.

InteractiveFive runs under suspicion

Hopper-v5, training seed 0. Each point is a recorded measurement. The vertical scale for each signal is shared across the five cases. The vertical line marks the selected update. For r = new π / old π, the approximate KL is the mean of r − 1 − log r. Diagnostics use the full batch after optimization, and the gradient norm is the minibatch average before clipping. The out-of-band fraction counts ratios outside the clipping interval.

Approx. KL, mean(r − 1 − log r)
1.386e-62.30094.60180200000 steps
Fraction outside the clipping band
0.00000.43700.87400200000 steps
Explained variance
−10.0410−4.52100.99890200000 steps
Latent policy entropy
2.46893.37194.27490200000 steps
Gradient norm before clipping
0.04543.94367.84190200000 steps
Squared value error
9.557e-42.70045.39990200000 steps
2000 steps
Approx. KL, mean(r − 1 − log r)3.334e-3
Fraction outside the clipping band0.0300
Explained variance8.404e-3
Latent policy entropy4.2510
Gradient norm before clipping0.6570
Squared value error1.2189
Compare six signals for each case, move the selected update and propose an intervention before checking it. Choose a common scale for comparison or individual scales for detail. Data come from actual training and are stored rounded to five significant digits; readouts may show fewer. Values and protocol can be reproduced at the end of the lesson. One curve need not identify one cause.

After trying the panel, compare hypotheses with this catalog for the displayed seed. Extremes are calculated from displayed points, not all individual transitions. The cell retains maxima and final entropy from those same series.

[ ]Summary of observed Hopper signaturesBrowser
firmas = {
    'control': {'kl_max': 0.012939, 'clip_max': 0.162, 'entropia_final': 4.008},
    'tasa alta': {'kl_max': 0.019236, 'clip_max': 0.269, 'entropia_final': 2.4689},
    'ventajas sin normalizar': {'kl_max': 0.010286, 'clip_max': 0.1455, 'entropia_final': 4.0937},
    'signo invertido': {'kl_max': 4.6018, 'clip_max': 0.874, 'entropia_final': 4.0645},
    'sin bootstrap al truncar': {'kl_max': 0.012939, 'clip_max': 0.162, 'entropia_final': 4.008},
}
for nombre, valores in firmas.items():
    print(nombre, valores)

High learning rate records a larger maximum KL and lower final entropy than this seed’s control. Without advantage normalization, maximum clipped fraction is instead lower than control: its absence need not produce a larger signal. Reversed sign shows a much larger KL peak here. Finally incorrect bootstrap matches control because the failure never activates. These describe specific runs, not an infallible classifier for other seeds or environments.

Context matters too. In both HalfCheetah-v5 runs with training seed 0, the time limit did produce truncations, unlike Hopper cases A and E. The next cell collects their cumulative counts and final-update explained variance. Although that figure differs between policies, target variance also changed: it does not show one policy is better or every difference comes solely from bootstrap. Performance evaluation needs the sweep’s held-out seeds and returns.

[ ]Truncations and critic in HalfCheetahBrowser
# Salidas registradas por los dos entrenamientos, no datos sintéticos.
control = {'truncamientos': 200, 'terminaciones': 0,
           'ev_final': 0.2852209806442261, 'var_objetivo': 0.08190273493528366}
sin_bootstrap = {'truncamientos': 200, 'terminaciones': 0,
                 'ev_final': 0.5680091381072998, 'var_objetivo': 0.14952613413333893}
for nombre, registro in [('control', control), ('sin bootstrap al truncar', sin_bootstrap)]:
    print(nombre, registro)

Design a comparable ablation

An ablation compares a control with variants removing one detail, holding fixed architecture, actual transition count, training seeds, evaluation seeds and mode, and additional measurement cost. If observation normalization is removed, evaluation must use the transformation actually used by that variant, not the control normalizer. If reward normalization is removed, evaluation return remains raw for both.

Five episodes of one actor are not five training runs. First summarize episodes for each policy; then resample training seeds. If variants use the same seed identifiers by design, resample pairs and calculate their IQM difference; this does not mean trajectories are identical. With five seeds intervals can be wide and miss rare outcomes. Keep environments separate unless a common scale has been defined and justified.

This study’s interval resamples actors after averaging a fixed evaluation seed set shared by all variants. It quantifies variation among observed training runs under that evaluation set; it does not separately include uncertainty from choosing other test episodes. Studying that source needs an additional evaluation design independent of tuning.

With only five actors, state what IQM means. Here integrate the empirical distribution between the 25th and 75th percentiles: the five sorted values have weights [0, 0.3, 0.4, 0.3, 0]. The initial protocol used trim_mean at 0.25, removing an integer count at each end and, for five, averaging the middle three. This is also the convention in aggregate_iqm of rliable. Before complete comparisons were obtained, fractional integration was chosen as primary and integer trimming retained as sensitivity analysis. They are not interchangeable in small samples:

[ ]Two IQM conventions with five observationsBrowser
import numpy as np

x = np.array([0., 1., 2., 100., 101.])
pesos = np.array([0., .3, .4, .3, 0.])
print('observaciones:', x.tolist(), 'pesos:', pesos.tolist())
print('percentiles centrales:', 25, 75, 'proporción de recorte:', 0.25)
print('IQM integral:', float(np.dot(np.sort(x), pesos)))
print('recorte entero:', float(np.sort(x)[1:4].mean()))

Engstrom and colleagues show how design changes ablation interpretation: figure 1 explores 16 combinations of four details on Humanoid-v2 and Walker2d-v2, five seeds per configuration and a learning-rate grid. They found reward normalization, rate annealing and initialization affected return landscapes and were needed for best results in that grid. Rate was selected by mean performance; this is not the same experiment as removing one detail without reselecting initial rate on Hopper-v5. Andrychowicz and colleagues studied over 50 decisions and trained over 250000 agents in five continuous-control environments. Their scale and conditions do not automatically transfer a figure or ranking to this lesson’s small sweep.

Henderson and colleagues show seed allocation can substantially change a comparison even with identical algorithm and hyperparameters; one experiment splits ten runs into two groups of five. This motivates retaining seeds, not selecting only the best, and showing differences and uncertainty. Overlapping intervals do not prove equality, and a difference interval including zero does not prove a detail has no effect.

Lab: instrument, induce and measure

Start with the previous lesson’s PPO and normalization code. Before the sweep record full configuration, factors, steps per variant, evaluation times and termination/truncation treatment. For each update state whether KL and clipped fraction are calculated before or after optimization and whether they aggregate all minibatches; retain individual returns, end flags and versions. When plotting a nonfinite signal, record that it is missing and why: do not turn it into zero to make a figure look healthy.

The next cell contains instrumented PPO. Derived from the previous lesson’s current cell, it adds interventions and logging; running it only defines functions. Study training is explicitly launched later. Internal label kl_k2 denotes ed−1−de^d-1-d, called k3k_3 here; the lab calculates it using PyTorch arithmetic rather than expm1, so tiny near-zero values can suffer cancellation.

[ ]Instrumented PPO for the sweepLocal GPU
# Generado a partir de la celda p09-l04; no editar manualmente.
import os
VARIANT = os.environ.get('PPO_VARIANT', 'control')
VALID_VARIANTS = {'control', 'sin_normalizar_obs', 'sin_normalizar_recompensas',
                  'sin_normalizar_ventajas', 'sin_recorte_norma', 'sin_recocido_lr',
                  'tasa_alta', 'signo_actor_invertido', 'sin_bootstrap_truncamiento'}
if VARIANT not in VALID_VARIANTS:
    raise ValueError(f'Variante no reconocida: {VARIANT}')
# PPO y evaluación en un fichero. Reconstruido del protocolo congelado.
"""Evaluación determinista con el normalizador de entrenamiento congelado."""
from pathlib import Path
import json
import os
import gymnasium as gym
import numpy as np
import torch

EVAL_SEEDS = [700000, 700001, 700002, 700003, 700004]


def observation_stats(env):
    while not isinstance(env, gym.wrappers.NormalizeObservation):
        if not hasattr(env, 'env'):
            return {'mean': np.zeros(env.observation_space.shape), 'var': np.ones(env.observation_space.shape), 'count': 1., 'epsilon': 0.}
        env = env.env
    return {'mean': env.obs_rms.mean.copy(), 'var': env.obs_rms.var.copy(),
            'count': float(env.obs_rms.count), 'epsilon': float(env.epsilon)}


def evaluate(agent, env_id, stats):
    env = gym.make(env_id)
    results = []
    try:
        for seed in EVAL_SEEDS:
            obs, _ = env.reset(seed=seed)
            score, steps = 0., 0
            while True:
                norm = np.clip((obs - stats['mean']) / np.sqrt(stats['var'] + stats['epsilon']), -10, 10)
                with torch.no_grad():
                    device = next(agent.parameters()).device
                    action = agent.actor_mean(torch.tensor(norm[None, :], dtype=torch.float32, device=device)).cpu().numpy()[0]
                obs, reward, term, trunc, _ = env.step(np.clip(action, env.action_space.low, env.action_space.high))
                score += float(reward)
                steps += 1
                if term or trunc:
                    break
            results.append({'seed': seed, 'return': score, 'steps': steps,
                            'terminated': bool(term), 'truncated': bool(trunc)})
    finally:
        env.close()
    return results


def save_snapshot(agent, env, env_id, seed, steps, method, history, all_envs=None):
    stats = observation_stats(env)
    stats_by_env = [observation_stats(x) for x in all_envs] if all_envs is not None else [stats]
    folder = Path(os.environ.get('PPO_OUTPUT_DIR', Path(__file__).resolve().parent if '__file__' in globals() else Path.cwd()))
    name = f'{method}-{env_id}-seed{seed}'
    checkpoint = folder / f'{name}-step{steps}.pt'
    torch.save({'state_dict': agent.state_dict(), 'stats': stats, 'stats_by_env': stats_by_env, 'env_id': env_id,
                'seed': seed, 'steps': steps, 'method': method}, checkpoint)
    episodes = evaluate(agent, env_id, stats)
    history.append({'steps': steps, 'evaluation': episodes, 'checkpoint': checkpoint.name})
    (folder / f'{name}.json').write_text(json.dumps(history, ensure_ascii=False, indent=2), encoding='utf-8')
    print(method, env_id, seed, steps, 'eval', [round(ep['return'], 2) for ep in episodes], flush=True)


"""PPO continuo en CPU, con GAE separado para terminal y truncamiento."""
import argparse
import random
import gymnasium as gym
import numpy as np
import torch
from torch import nn
from torch.distributions import Normal

torch.set_num_threads(1)


def build_env(env_id, gamma, max_episode_steps=None):
    env = gym.make(env_id, max_episode_steps=max_episode_steps)
    env = gym.wrappers.FlattenObservation(env)
    env = gym.wrappers.RecordEpisodeStatistics(env)
    env = gym.wrappers.ClipAction(env)
    if VARIANT != 'sin_normalizar_obs':
        env = gym.wrappers.NormalizeObservation(env)
    env = gym.wrappers.TransformObservation(env, lambda obs: np.clip(obs, -10, 10), env.observation_space)
    if VARIANT != 'sin_normalizar_recompensas':
        env = gym.wrappers.NormalizeReward(env, gamma=gamma)
    return gym.wrappers.TransformReward(env, lambda reward: np.clip(reward, -10, 10))


def layer(n_in, n_out, gain):
    result = nn.Linear(n_in, n_out)
    nn.init.orthogonal_(result.weight, gain)
    nn.init.zeros_(result.bias)
    return result


class PPOAgent(nn.Module):
    def __init__(self, obs_dim, act_dim):
        super().__init__()
        # Orden de creación equivalente a la referencia, pero implementación propia.
        self.critic = nn.Sequential(layer(obs_dim, 64, np.sqrt(2)), nn.Tanh(),
                                    layer(64, 64, np.sqrt(2)), nn.Tanh(), layer(64, 1, 1.0))
        self.actor_mean = nn.Sequential(layer(obs_dim, 64, np.sqrt(2)), nn.Tanh(),
                                        layer(64, 64, np.sqrt(2)), nn.Tanh(), layer(64, act_dim, 0.01))
        self.actor_logstd = nn.Parameter(torch.zeros(1, act_dim))

    def value(self, state):
        return self.critic(state).squeeze(-1)

    def policy(self, state):
        mean = self.actor_mean(state)
        return Normal(mean, self.actor_logstd.exp().expand_as(mean))


def advantages_gae(rewards, values, next_values, terminated, truncated, gamma, lam):
    safe_next_values = torch.where(terminated, torch.zeros_like(next_values), next_values)
    delta = rewards + gamma * safe_next_values - values
    result = torch.empty_like(delta)
    tail = torch.zeros_like(delta[0])
    for t in reversed(range(len(delta))):
        tail = delta[t] + gamma * lam * (~(terminated[t] | truncated[t])).float() * tail
        result[t] = tail
    return result


def entropy_bonus(distribution):
    return distribution.entropy().sum(-1).mean()


def train(env_id, seed, total_steps=1_000_000, num_envs=1, entropy_coef=0.0):
    gamma, lam, rollout, epochs, num_minibatches = .99, .95, 2000, 4, 8
    batch_size = rollout * num_envs
    if num_envs < 1 or total_steps % batch_size:
        raise ValueError('El presupuesto debe ser múltiplo del tamaño de rollout')
    random.seed(seed); np.random.seed(seed); torch.manual_seed(seed)
    envs = gym.vector.SyncVectorEnv([lambda: build_env(env_id, gamma) for _ in range(num_envs)],
                                    autoreset_mode=gym.vector.AutoresetMode.SAME_STEP)
    obs, _ = envs.reset(seed=seed)
    agent = PPOAgent(obs.shape[-1], envs.single_action_space.shape[0])
    base_lr = 3e-3 if VARIANT == 'tasa_alta' else 3e-4
    optimizer = torch.optim.Adam(agent.parameters(), lr=base_lr, eps=1e-5)
    history = []
    save_snapshot(agent, envs.envs[0], env_id, seed, 0, 'own', history, all_envs=envs.envs)
    n_updates = total_steps // batch_size
    for update in range(n_updates):
        optimizer.param_groups[0]['lr'] = base_lr if VARIANT == 'sin_recocido_lr' else base_lr * (1 - update / n_updates)
        states, actions, logps, rewards = [], [], [], []
        values, next_values, terms, truncs = [], [], [], []
        for _ in range(rollout):
            state = torch.tensor(obs, dtype=torch.float32)
            with torch.no_grad():
                dist = agent.policy(state)
                action = dist.sample()
                logp = dist.log_prob(action).sum(-1)
                value = agent.value(state)
            next_obs, reward, terminated, truncated, info = envs.step(action.numpy())
            # SAME_STEP devuelve observación reiniciada tras fin. Para truncamientos,
            # sustituirla por la observación final anterior al reset.
            physical_next = next_obs.copy()
            for i in range(len(terminated)):
                if truncated[i] and not terminated[i]:
                    physical_next[i] = info['final_obs'][i]
            next_val = torch.zeros_like(value)
            alive = np.flatnonzero(~terminated)
            if len(alive):
                with torch.no_grad():
                    next_val[alive] = agent.value(torch.tensor(physical_next[alive], dtype=torch.float32))
            if VARIANT == 'sin_bootstrap_truncamiento':
                next_val[torch.tensor(truncated)] = 0.0
            states.append(state); actions.append(action); logps.append(logp); rewards.append(torch.tensor(reward, dtype=torch.float32))
            values.append(value); next_values.append(next_val)
            terms.append(torch.tensor(terminated, dtype=torch.bool)); truncs.append(torch.tensor(truncated, dtype=torch.bool))
            obs = next_obs
        states, actions, logps, rewards, values, next_values, terms, truncs = map(torch.stack,
            (states, actions, logps, rewards, values, next_values, terms, truncs))
        advantages = advantages_gae(rewards, values, next_values, terms, truncs, gamma, lam)
        returns = advantages + values
        states = states.reshape(batch_size, -1); actions = actions.reshape(batch_size, -1)
        logps = logps.reshape(batch_size); advantages = advantages.reshape(batch_size)
        returns = returns.reshape(batch_size); old_values = values.reshape(batch_size)
        indices = np.arange(batch_size)
        gradient_norms, gradient_norms_after = [], []
        for _ in range(epochs):
            np.random.shuffle(indices)
            for start in range(0, batch_size, batch_size // num_minibatches):
                ix = indices[start:start + batch_size // num_minibatches]
                dist = agent.policy(states[ix])
                new_logp = dist.log_prob(actions[ix]).sum(-1)
                ratio = (new_logp - logps[ix]).exp()
                adv = advantages[ix]
                if VARIANT != 'sin_normalizar_ventajas':
                    adv = (adv - adv.mean()) / (adv.std() + 1e-8)
                policy_loss = torch.maximum(-adv * ratio, -adv * ratio.clamp(.8, 1.2)).mean()
                new_value = agent.value(states[ix])
                clipped_value = old_values[ix] + (new_value - old_values[ix]).clamp(-.2, .2)
                value_loss = .5 * torch.maximum((new_value - returns[ix]).square(),
                                               (clipped_value - returns[ix]).square()).mean()
                loss = (-policy_loss if VARIANT == 'signo_actor_invertido' else policy_loss) + .5 * value_loss
                if entropy_coef != 0.0:
                    loss = loss - entropy_coef * entropy_bonus(dist)
                optimizer.zero_grad(); loss.backward()
                gradient_norms.append(float(nn.utils.clip_grad_norm_(agent.parameters(), float('inf') if VARIANT == 'sin_recorte_norma' else .5)))
                gradient_norms_after.append(float(nn.utils.clip_grad_norm_(agent.parameters(), float('inf'))))
                optimizer.step()
        steps = (update + 1) * batch_size
        with torch.no_grad():
            diagnostic_dist = agent.policy(states)
            diagnostic_logp = diagnostic_dist.log_prob(actions).sum(-1)
            logratio = diagnostic_logp - logps
            ratio = logratio.exp()
            predicted_value = agent.value(states)
            target_var = float(torch.var(returns, unbiased=False))
            explained = None if target_var == 0 else float(1 - torch.var(returns - predicted_value, unbiased=False) / target_var)
            diag = {'steps': steps, 'learning_rate': optimizer.param_groups[0]['lr'],
                    'kl_k1': float((-logratio).mean()), 'kl_k2': float((ratio - 1 - logratio).mean()),
                    'clip_fraction': float(((ratio - 1).abs() > .2).float().mean()),
                    'entropy_latent': float(diagnostic_dist.entropy().sum(-1).mean()),
                    'explained_variance': explained, 'target_variance': target_var,
                    'value_mse': float((returns - predicted_value).square().mean()),
                    'grad_norm_before_clip_mean': float(np.mean(gradient_norms)),
                    'grad_norm_after_clip_mean': float(np.mean(gradient_norms_after)),
                    'terminations': int(terms.sum()), 'truncations': int(truncs.sum())}
            numeric = [v for v in diag.values() if v is not None]
            if not np.isfinite(numeric).all():
                raise FloatingPointError(f'Diagnósticos no finitos en paso {steps}: {diag}')
            with open(Path(os.environ['PPO_OUTPUT_DIR']) / 'diagnostics.jsonl', 'a', encoding='utf8') as f:
                f.write(json.dumps(diag, allow_nan=False) + '\n')
        if steps // 50000 > (steps - batch_size) // 50000 or steps == total_steps:
            save_snapshot(agent, envs.envs[0], env_id, seed, steps, 'own', history, all_envs=envs.envs)
        if (update + 1) % 25 == 0:
            print('own', env_id, 'seed', seed, 'steps', steps, flush=True)
    envs.close()
    return agent, history
This cell needs the local lab (PyTorch with your GPU). Start it with npm run lab and open the connection link.

The study uses a control and five ablations plus three induced failures. The unnormalized-advantage variant also serves as one of four panel failures. All run on Hopper-v5 and HalfCheetah-v5 with five training seeds and 200000 transitions per policy. High rate multiplies initial rate by ten with the same relative schedule; sign failure reverses only actor contribution; incorrect bootstrap zeroes subsequent value on truncation. Other variants remove observation, reward or advantage normalization, norm clipping or learning-rate annealing. Both normalization ablations retain input or reward clipping, so the removed factor is normalization, not clipping too.

Each update measures KL, clipped fraction, latent entropy, MSE and explained variance over the full rollout after optimization. Global norms average minibatches before and after clipping. Termination and truncation counts are retained, and zero target variance is recorded missing. Seeds 700000–700004 are reserved for checkpoint evolution; 800000–800004 for final evaluation. Variants without observation normalization use identity transformation and the same clipping used in training.

To run one combination in a new folder and save configuration, hashes, diagnostics and restored-checkpoint final evaluation, copy the instrumented cell as ppo_diagnostics.py, the previous lesson’s PPO cell as ppo_l04_cell.py, and the following program as run_one.py in one folder. This block does not start work on opening the lesson. Hashes identify local bytes: changing line endings or the final newline while copying can change a hash despite identical logic. A failure leaves an explicit record and does not replace the series with zeros.

"""Ejecuta una combinación aislada y registra su evaluación final reservada."""
import argparse
import hashlib
import importlib.metadata
import json
import os
from pathlib import Path
import sys
import traceback

ROOT = Path(__file__).resolve().parent
parser = argparse.ArgumentParser()
parser.add_argument('--variant', required=True)
parser.add_argument('--env-id', choices=('Hopper-v5', 'HalfCheetah-v5'), required=True)
parser.add_argument('--seed', type=int, choices=range(5), required=True)
args = parser.parse_args()
folder = ROOT / 'runs' / f'{args.variant}-{args.env_id}-seed{args.seed}'
folder.mkdir(parents=True, exist_ok=False)
os.environ.update(PPO_VARIANT=args.variant, PPO_OUTPUT_DIR=str(folder), OMP_NUM_THREADS='1', MKL_NUM_THREADS='1')
def sha(path): return hashlib.sha256(path.read_bytes()).hexdigest()
manifest = {'variant': args.variant, 'environment': args.env_id, 'training_seed': args.seed,
            'total_steps': 200000, 'num_envs': 1, 'device': 'cpu', 'evaluation_curve_seeds': list(range(700000,700005)),
            'evaluation_final_seeds': list(range(800000,800005)), 'pid': os.getpid(),
            'source_sha256': {p.name: sha(p) for p in (ROOT/'ppo_l04_cell.py', ROOT/'ppo_diagnostics.py', ROOT/'run_one.py')},
            'versions': {'python': sys.version, **{name: importlib.metadata.version(name) for name in
                         ('gymnasium', 'mujoco', 'numpy', 'torch', 'scipy')}}, 'status': 'running'}
def save():
    temp = folder / 'provenance.tmp'
    temp.write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding='utf8')
    temp.replace(folder / 'provenance.json')
save()
try:
    import numpy as np
    import torch
    import ppo_diagnostics as lab
    agent, history = lab.train(args.env_id, args.seed, total_steps=200000, num_envs=1)
    if not all(p.device.type == 'cpu' and torch.isfinite(p).all() for p in agent.parameters()):
        raise ValueError('Parámetros no finitos o dispositivo incorrecto')
    expected_steps = [0, 50000, 100000, 150000, 200000]
    if [row['steps'] for row in history] != expected_steps:
        raise ValueError('Checkpoints incompletos')
    for row in history:
        if [ep['seed'] for ep in row['evaluation']] != list(range(700000,700005)):
            raise ValueError('Semillas de curva incorrectas')
        if any(not np.isfinite(ep['return']) or not (ep['terminated'] or ep['truncated'])
               for ep in row['evaluation']):
            raise ValueError('Episodios de curva inválidos')
    rows = [json.loads(line) for line in (folder / 'diagnostics.jsonl').read_text(encoding='utf8').splitlines()]
    if len(rows) != 100 or [r['steps'] for r in rows] != list(range(2000,200001,2000)):
        raise ValueError('Diagnósticos incompletos')
    checkpoint = torch.load(folder / history[-1]['checkpoint'], map_location='cpu', weights_only=False)
    if (checkpoint['env_id'],checkpoint['seed'],checkpoint['steps']) != (args.env_id,args.seed,200000):
        raise ValueError('Checkpoint final inválido')
    restored = lab.PPOAgent(checkpoint['stats']['mean'].shape[0], agent.actor_logstd.shape[-1])
    restored.load_state_dict(checkpoint['state_dict'], strict=True)
    if any(not torch.equal(value, agent.state_dict()[key]) for key, value in restored.state_dict().items()):
        raise ValueError('Los parámetros restaurados difieren de los entrenados')
    lab.EVAL_SEEDS = list(range(800000,800005))
    final_episodes = lab.evaluate(restored, args.env_id, checkpoint['stats'])
    if [ep['seed'] for ep in final_episodes] != lab.EVAL_SEEDS or any(
            not np.isfinite(ep['return']) or not (ep['terminated'] or ep['truncated']) for ep in final_episodes):
        raise ValueError('Episodios de evaluación final inválidos')
    (folder / 'final_evaluation.json').write_text(json.dumps(final_episodes, indent=2), encoding='utf8')
    manifest.update(status='complete', final_checkpoint_sha256=sha(folder / history[-1]['checkpoint']),
                    diagnostics_sha256=sha(folder / 'diagnostics.jsonl'),
                    final_evaluation_sha256=sha(folder / 'final_evaluation.json'))
    save()
    print('Ejecución completa:', args.variant, args.env_id, args.seed, flush=True)
except BaseException as exc:
    manifest.update(status='failed', error=f'{type(exc).__name__}: {exc}', traceback=traceback.format_exc())
    save()
    raise

For example, python run_one.py --variant control --env-id Hopper-v5 --seed 0 runs one policy. The nine valid labels are defined in the instrumented cell; repeat for both environments and five seeds, saving each run in its own folder. The study limited concurrency to four single-threaded CPU processes and did not use CUDA. Output includes per-update diagnostics, histories, checkpoints, final evaluation and a manifest. The table uses completed policies and neither deletes nor substitutes failures.

[ ]Pinned sweep configurationBrowser
print('semillas de entrenamiento:', list(range(5)))
print('semillas para las curvas:', list(range(700000, 700005)))
print('semillas para evaluación final:', list(range(800000, 800005)))
print('entornos:', ['Hopper-v5', 'HalfCheetah-v5'])
print('variantes:', 9, 'pasos por política:', 200000, 'procesos CPU máximos:', 4)
print('multiplicador de tasa alta:', 10, 'cifras significativas de datos del visor:', 5)
print('ejemplo opcional de puestos en un equipo dedicado:', 24)

To launch the full sweep, also save this program as run_all.py beside the two previous files. By default it uses the study’s four-process limit; on a dedicated machine you can request, for example, python run_all.py --workers 24 if at least that many logical cores are available. Each process uses one compute thread. The program waits for each batch and stops subsequent ones if a run fails. Check paths before starting; it does not overwrite files, so review and archive existing logs and folders before repeating the full sweep. This simple launcher does not resume only pending combinations. On shared machines reduce concurrency to avoid contention. Worker count changes elapsed time, not each policy’s transition budget.

import argparse
from concurrent.futures import ThreadPoolExecutor
from itertools import product
import os
from pathlib import Path
import subprocess
import sys

parser = argparse.ArgumentParser()
parser.add_argument('--workers', type=int, default=4)
workers = parser.parse_args().workers
if workers < 1 or workers > (os.cpu_count() or 1):
    raise ValueError('El número de procesos debe caber en los núcleos lógicos disponibles')

variants = ['control', 'sin_normalizar_obs', 'sin_normalizar_recompensas',
            'sin_normalizar_ventajas', 'sin_recorte_norma', 'sin_recocido_lr',
            'tasa_alta', 'signo_actor_invertido', 'sin_bootstrap_truncamiento']
jobs = list(product(variants, ['Hopper-v5', 'HalfCheetah-v5'], range(5)))
root = Path(__file__).resolve().parent
logs = root / 'logs'
logs.mkdir(exist_ok=True)
for variant, env, seed in jobs:
    name = f'{variant}-{env}-seed{seed}'
    if (logs / f'{name}.log').exists() or (root / 'runs' / name).exists():
        raise FileExistsError(f'Ya existe un registro o carpeta de salida para {name}')

def run(job):
    variant, env, seed = job
    log = logs / f'{variant}-{env}-seed{seed}.log'
    command = [sys.executable, str(root / 'run_one.py'), '--variant', variant,
               '--env-id', env, '--seed', str(seed)]
    with log.open('x', encoding='utf-8') as output:
        subprocess.run(command, cwd=root, stdout=output, stderr=subprocess.STDOUT,
                       env={**os.environ, 'PYTHONUTF8': '1'}, check=True)
    return job

for start in range(0, len(jobs), workers):
    with ThreadPoolExecutor(max_workers=workers) as pool:
        futures = [pool.submit(run, job) for job in jobs[start:start + workers]]
        for future in futures:
            print('Completa:', future.result(), flush=True)

Compare with a library

A maintained implementation helps compare names and identify instrumentation differences. In Stable-Baselines3 2.7.1 PPO code, train/approx_kl averages last-epoch minibatch estimates calculated as the policy updates; train/clip_fraction accumulates minibatches across executed epochs. Its explained_variance uses values stored during rollout, not predictions recomputed after optimization. Similar names therefore do not make those series equal to our post-update full-batch measurements. It also records entropy_loss, negative mean entropy when available.

The following example is independent of this lesson’s results. It requires locally installed Stable-Baselines3 and MuJoCo environment; it writes CSV logs for inspection but does not reproduce the prior protocol or normalizers. See logger documentation for fields and the effect of replacing the default logger.

from stable_baselines3 import PPO
from stable_baselines3.common.logger import configure

model = PPO('MlpPolicy', 'Hopper-v5', seed=0, device='cpu')
model.set_logger(configure('ppo-registros', ['stdout', 'csv']))
model.learn(total_timesteps=200000)

Before using its logs in an ablation, explicitly fix wrappers, evaluation, seeds and budget, and instrument missing quantities separately. For PPO, documentation describes total_timesteps as a lower bound: completed rollouts can exceed the requested count. Do not attribute library differences to a single detail when several change at once.

Observed control ranges

Each summary combines 500 measurements: 100 updates from each of five training seeds for one environment. Values are observations under this control and protocol, not universal limits or confidence intervals. Updates in a run are related; the median mixes phases with different learning rates, and extremes also depend on duration and measurement count. KL, fraction, entropy and explained variance are measured after rollout optimization; norms are minibatch means before and after clipping.

[ ]Control diagnostics: Hopper-v5Browser
resumen = {'KL aproximada': [1.9063353420278872e-06, 0.004330536583438516, 0.012939306907355785], 'Fracción recortada': [0.0, 0.0430000014603138, 0.18050000071525574], 'Varianza explicada': [0.008404195308685303, 0.9688489735126495, 0.9958100914955139], 'Entropía latente': [3.9774527549743652, 4.0380470752716064, 4.2602949142456055], 'Norma antes del recorte': [0.5167962731793523, 0.6491502989083529, 0.8212198438122869], 'Norma después del recorte': [0.46123864874243736, 0.4955177288502455, 0.49999931175261736]}
print('Hopper-v5', "500 observaciones: cinco semillas, 100 actualizaciones por semilla")
for metrica, (minimo, mediana, maximo) in resumen.items():
    print(metrica, "mínimo", minimo, "mediana", mediana, "máximo", maximo)
[ ]Control diagnostics: HalfCheetah-v5Browser
resumen = {'KL aproximada': [1.4146864941722015e-06, 0.003164005698636174, 0.009407059289515018], 'Fracción recortada': [0.0, 0.02199999988079071, 0.13850000500679016], 'Varianza explicada': [-0.5545659065246582, 0.4306190311908722, 0.9657093286514282], 'Entropía latente': [8.174337387084961, 8.33442497253418, 8.51961612701416], 'Norma antes del recorte': [0.7274017259478569, 0.8667338686063886, 1.2153614908456802], 'Norma después del recorte': [0.498783309943974, 0.49999940302222967, 0.499999575316906]}
print('HalfCheetah-v5', "500 observaciones: cinco semillas, 100 actualizaciones por semilla")
for metrica, (minimo, mediana, maximo) in resumen.items():
    print(metrica, "mínimo", minimo, "mediana", mediana, "máximo", maximo)

Ablation comparison

EnvironmentVariantIQM and 95% CIDifference from control and paired 95% CI
Hopper-v5Control867.94 [483.95, 1130.17]Not applicable
Hopper-v5No observation normalization455.66 [333.94, 666.64]-412.28 [-755.50, -104.71]
Hopper-v5No reward normalization369.57 [365.13, 371.85]-498.37 [-761.08, -112.54]
Hopper-v5No advantage normalization879.77 [553.32, 963.00]11.83 [-273.13, 78.23]
Hopper-v5No norm clipping851.31 [488.13, 1131.58]-16.63 [-296.91, 225.25]
Hopper-v5No rate annealing738.44 [485.81, 1092.22]-129.50 [-399.64, 141.37]
HalfCheetah-v5Control129.90 [-83.11, 974.10]Not applicable
HalfCheetah-v5No observation normalization494.30 [-4.49, 653.61]364.40 [-412.06, 701.94]
HalfCheetah-v5No reward normalization19.47 [-165.31, 607.68]-110.43 [-1044.84, 661.08]
HalfCheetah-v5No advantage normalization683.51 [-61.92, 1067.86]553.61 [-586.33, 901.49]
HalfCheetah-v5No norm clipping836.79 [17.57, 1434.29]706.89 [-37.94, 834.64]
HalfCheetah-v5No rate annealing438.51 [86.14, 1022.46]308.61 [-636.35, 865.71]

On Hopper, removing observation or reward normalization lowers observed IQM versus control, with both paired difference intervals below zero. On HalfCheetah, all five difference intervals include zero and are wide: these data cannot establish equivalence or securely rank effects. Both environments have five training runs per variant and a specific budget, not a guarantee for new seeds or longer training.

Hopper reward results agree in direction with reward-scale importance reported by Engstrom and colleagues in the cited grid. This is not a direct replication: environment, budget, rate selection and grouping differ. The viewer also explores induced failures: here high rate achieves higher IQM than control in both environments despite potentially sharper policy change. Calling it a risk intervention does not imply it always reduces return. On Hopper control and incorrect bootstrap match across all five seeds because there were no truncations; a zero interval describes these trajectories and does not prove the bug harmless generally.

InteractiveCompare control and ablations

Selected comparison: No observation normalization. Each point represents one of five trained actors and shows its mean across five evaluation episodes. The highlight marks the selected training seed. Squares show IQM and bars show 95% bootstrap intervals. Both rows share the same horizontal axis.

332.0777.91223.7ControlVariantEvaluation return

Subtract the control IQM from the variant IQM. The interval uses 10,000 paired bootstrap resamples of the five training seeds and takes the resulting percentiles. Effects can differ across other seeds and environments.

0
Episode mean, control338.24
Episode mean, variant338.51
Control IQM and 95% interval867.94 [483.95, 1130.17]
Variant IQM and 95% interval455.66 [333.94, 666.64]
IQM difference, variant − control−412.28
Paired 95% interval for the difference[−755.50, −104.71]
Compare per-training means, IQM and intervals by environment and variant. The paired difference compares each variant with control.

The following cell gathers training end counts for controls and no-bootstrap-at-truncation variants. Each pair contains terminations and truncations in seed order.

[ ]Check when the bootstrap failure activatesBrowser
hopper = [(2172, 0), (1602, 0), (1507, 0), (1747, 0), (1693, 0)]
halfcheetah = [(0, 200), (0, 200), (0, 200), (0, 200), (0, 200)]
for variante in ('control', 'sin bootstrap al truncar'):
    print('Hopper-v5', variante, hopper)
    print('HalfCheetah-v5', variante, halfcheetah)

Exercises

ProofTwo estimators of the same KL
Prove: Under common support and normalized distributions, prove both estimators have the same expectation over old-policy actions at a fixed state.
0
Use d=log⁡πnew−log⁡πoldd=\log\pi_{\mathrm{new}}-\log\pi_{\mathrm{old}} and r=edr=e^d. Assume integrability.

Step 1 of 3. What is Eold[r]\mathbb E_{\mathrm{old}}[r]?

CodeRatios in log space
Implement kl_samples(old_logp, new_logp). Return two NumPy arrays with per-sample old-to-new KL estimators k1 and k3. Inputs are same-shaped arrays of finite log densities; use expm1 for the second. Do not average inside the function.
import numpy as np

def kl_samples(old_logp, new_logp):
  pass
Shift+Enter to run
QuizComparing estimators
In the lesson’s known Gaussian model, with fixed policies and old-policy actions, which comparison is supported by the variance calculation?
QuizAn update under suspicion
Across several updates the fraction of ratios outside the band reaches 0.6 and estimated KL keeps growing. What conclusion is most justified?
NumericHow many policies to train
An ablation has 6 variants, 2 environments and 5 training seeds per combination. How many independent runs are required?
NumericTotal sweep process cost
With those 6 variants, 2 environments and 5 seeds, each run takes exactly 40 process minutes. How many total process hours, excluding overhead?
NumericSchedule the sweep
For the same 6 variants, 2 environments and 5 seeds, each run takes exactly 40 minutes; 8 parallel slots are available, runs are indivisible and there is no overhead. What is minimum elapsed time in minutes?
QuizAn ambiguous ablation
Removing a detail improves observed IQM but the variants’ intervals overlap. Which report is stronger?

After solving the scheduling problem, this cell checks the arithmetic with indivisible jobs. Its figures are the exercise assumptions, not measured times on this machine.

[ ]Check the exercise budgetBrowser
import math

variantes, entornos, semillas, puestos, minutos = 6, 2, 5, 8, 40
ejecuciones = variantes * entornos * semillas
tandas = math.ceil(ejecuciones / puestos)
print('Ejecuciones:', ejecuciones, 'tandas:', tandas, 'minutos de reloj:', tandas * minutos)
print('Horas de proceso:', ejecuciones * minutos / 60)
print('Minutos de proceso:', ejecuciones * minutos)
print('Fracción del otro ejercicio:', .6, 'equivale a', 100 * .6, '%')
Key idea

PPO diagnostics are measurements with specific definitions and times, not causal labels. Controlled intervention, multiple seeds, raw data and uncertainty comparison distinguish observations from what remains unknown.

Interactive curve data

These lists contain the viewer’s complete Hopper-v5 measurements for training seed 0, rounded to five significant digits. Each follows the same schedule: one measurement after each update, from 2000 to 200000 steps. Data come from this lesson’s protocol, not simulated curves. Each cell prints exactly the values used by the figure; to repeat the experiment, save code and launch variants as specified in the lab. Letter-to-intervention assignments are revealed in the viewer when checking the hypothesis.

[ ]Measurement scheduleBrowser
pasos = list(range(2000, 200001, 2000))
print('pasos:', pasos)
print('truncamientos observados en A y E:', 0)
print('terminaciones observadas en A y E:', 2172)

In A and E, modified bootstrap at truncation never activates on these trajectories. Curves coincide and cannot distinguish interventions for this seed. A test forcing truncation can verify mask handling but adds no performance evidence for this training run.

[ ]Case A: kl, clip, evBrowser
kl = [0.0033345, 0.0061275, 0.0079733, 0.0085158, 0.0073035, 0.0072163, 0.0088434, 0.010728, 0.010885, 0.0091551, 0.01027, 0.012939, 0.0064187, 0.0075578, 0.0077561, 0.0047644, 0.0073301, 0.0042785, 0.010149, 0.007637, 0.0057503, 0.0073959, 0.0070356, 0.0056538, 0.0069071, 0.0072364, 0.007373, 0.0066431, 0.0056633, 0.0050714, 0.0072142, 0.0074398, 0.0089086, 0.0087963, 0.0096298, 0.0083876, 0.010165, 0.0079097, 0.0092009, 0.0058503, 0.0049732, 0.0071985, 0.0039808, 0.0046989, 0.0078462, 0.002559, 0.0053529, 0.0048013, 0.0040943, 0.0048505, 0.0076641, 0.0059114, 0.0042229, 0.00291, 0.0043945, 0.0023595, 0.0044721, 0.0018254, 0.0050726, 0.0039843, 0.00125, 0.0023158, 0.001138, 0.0030304, 0.0037084, 0.0032476, 0.0019928, 0.0016213, 0.00092806, 0.0007705, 0.0018962, 0.002943, 0.0010194, 0.00077551, 0.0020123, 0.00082018, 0.001164, 0.0022356, 0.001605, 0.0010146, 0.00062119, 0.00044318, 0.00074668, 0.00039806, 0.0013983, 0.00063298, 0.00138, 0.00034075, 0.00036292, 0.0001885, 0.00072172, 0.00028572, 0.00013733, 0.00046313, 0.00018435, 4.3427e-05, 6.8159e-05, 2.4375e-05, 1.1789e-05, 2.5248e-06]
print('kl:', ','.join(format(x, '.5g') for x in kl))
clip = [0.03, 0.082, 0.1105, 0.115, 0.091, 0.0935, 0.1195, 0.159, 0.161, 0.119, 0.1465, 0.162, 0.081, 0.102, 0.1045, 0.042, 0.0995, 0.048, 0.1535, 0.1075, 0.0695, 0.0975, 0.0885, 0.0715, 0.097, 0.09, 0.0915, 0.085, 0.07, 0.049, 0.0955, 0.1005, 0.1245, 0.12, 0.1315, 0.104, 0.1435, 0.1095, 0.1265, 0.0705, 0.0515, 0.115, 0.0405, 0.0555, 0.102, 0.0165, 0.0575, 0.0555, 0.0455, 0.0475, 0.1045, 0.0745, 0.0365, 0.02, 0.0545, 0.012, 0.0425, 0.007, 0.063, 0.035, 0.001, 0.0085, 0.0035, 0.0265, 0.031, 0.031, 0.012, 0.006, 0.001, 0.001, 0.0055, 0.022, 0.0005, 0.001, 0.005, 0.0005, 0.001, 0.014, 0.004, 0.0005, 0.0, 0.0, 0.001, 0.0, 0.0035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
print('clip:', ','.join(format(x, '.5g') for x in clip))
ev = [0.0084042, 0.38023, 0.42155, 0.41559, 0.41311, 0.43779, 0.44683, 0.37062, 0.41391, 0.4807, 0.54385, 0.56024, 0.58923, 0.67231, 0.81775, 0.86341, 0.94035, 0.96628, 0.9763, 0.98503, 0.98753, 0.98792, 0.98916, 0.98701, 0.98642, 0.98861, 0.9893, 0.98546, 0.98909, 0.99016, 0.99014, 0.99157, 0.9907, 0.99174, 0.9901, 0.99245, 0.99086, 0.98696, 0.98583, 0.98283, 0.98019, 0.98195, 0.98045, 0.98253, 0.98498, 0.98477, 0.98849, 0.99026, 0.9922, 0.99367, 0.99441, 0.99405, 0.99509, 0.99419, 0.99212, 0.99463, 0.99509, 0.99413, 0.99329, 0.99407, 0.99428, 0.99505, 0.99449, 0.99523, 0.99414, 0.99495, 0.9943, 0.99479, 0.99349, 0.99494, 0.99444, 0.99471, 0.99535, 0.99218, 0.99581, 0.99395, 0.99518, 0.99359, 0.9954, 0.99511, 0.99379, 0.99253, 0.99193, 0.99435, 0.99328, 0.99315, 0.99359, 0.99189, 0.99303, 0.99336, 0.99283, 0.99263, 0.9938, 0.99231, 0.99252, 0.9884, 0.99161, 0.99237, 0.99031, 0.99268]
print('ev:', ','.join(format(x, '.5g') for x in ev))
[ ]Case A: entropy, grad, valueMseBrowser
entropy = [4.251, 4.2408, 4.2332, 4.2218, 4.2059, 4.195, 4.1877, 4.1812, 4.1753, 4.172, 4.168, 4.1667, 4.164, 4.1637, 4.1572, 4.1533, 4.1479, 4.1461, 4.1406, 4.1373, 4.1322, 4.1289, 4.1302, 4.1303, 4.1298, 4.1287, 4.1205, 4.114, 4.1125, 4.1084, 4.1047, 4.1017, 4.1027, 4.1016, 4.1, 4.0993, 4.0932, 4.0862, 4.0803, 4.0756, 4.0741, 4.0729, 4.073, 4.0715, 4.071, 4.0683, 4.0661, 4.0608, 4.0615, 4.0594, 4.051, 4.0489, 4.0463, 4.0431, 4.0451, 4.0454, 4.0427, 4.0436, 4.042, 4.04, 4.0379, 4.0355, 4.0337, 4.0285, 4.0266, 4.0257, 4.0233, 4.0216, 4.0204, 4.0199, 4.0192, 4.0203, 4.021, 4.0201, 4.0193, 4.0201, 4.0199, 4.0187, 4.0174, 4.0162, 4.0142, 4.0136, 4.0138, 4.014, 4.0141, 4.0131, 4.0123, 4.012, 4.0116, 4.0109, 4.0101, 4.0102, 4.0102, 4.0099, 4.0095, 4.009, 4.0086, 4.0082, 4.008, 4.008]
print('entropy:', ','.join(format(x, '.5g') for x in entropy))
grad = [0.65696, 0.67881, 0.64346, 0.7288, 0.69685, 0.6499, 0.67851, 0.63563, 0.66227, 0.60472, 0.67205, 0.67901, 0.80476, 0.78092, 0.77156, 0.68119, 0.6986, 0.62842, 0.64554, 0.5912, 0.56066, 0.59779, 0.52883, 0.5485, 0.55954, 0.52567, 0.54771, 0.56041, 0.52933, 0.54091, 0.54852, 0.5168, 0.54965, 0.60643, 0.59342, 0.55079, 0.5774, 0.61712, 0.57939, 0.60424, 0.61124, 0.62274, 0.6234, 0.58276, 0.60259, 0.62714, 0.57174, 0.57917, 0.57951, 0.61045, 0.58841, 0.60143, 0.58658, 0.62137, 0.6192, 0.56848, 0.63437, 0.58911, 0.64861, 0.60399, 0.64583, 0.6671, 0.60869, 0.56805, 0.60044, 0.6522, 0.62489, 0.65283, 0.59018, 0.57889, 0.59415, 0.6493, 0.63118, 0.64177, 0.66198, 0.63985, 0.63151, 0.60117, 0.68477, 0.613, 0.61349, 0.67251, 0.68539, 0.65362, 0.68857, 0.61708, 0.66847, 0.68942, 0.66308, 0.64476, 0.68372, 0.65712, 0.59815, 0.68398, 0.70053, 0.6631, 0.72162, 0.67244, 0.70519, 0.63558]
print('grad:', ','.join(format(x, '.5g') for x in grad))
valueMse = [1.2189, 0.57359, 0.61894, 0.7693, 0.56192, 0.48227, 0.44206, 0.43327, 0.39149, 0.39176, 0.3334, 0.34179, 0.35547, 0.24955, 0.14063, 0.12153, 0.061446, 0.04001, 0.029476, 0.020123, 0.017299, 0.015786, 0.013272, 0.015499, 0.015781, 0.012187, 0.01116, 0.014778, 0.010587, 0.0094629, 0.009339, 0.0078727, 0.0084853, 0.0075341, 0.0088963, 0.0066591, 0.0083577, 0.010563, 0.011047, 0.013073, 0.013895, 0.011863, 0.013211, 0.011415, 0.0096583, 0.01004, 0.0072788, 0.0070474, 0.0063138, 0.0050575, 0.0045191, 0.0050362, 0.0043486, 0.0049036, 0.0067599, 0.0046701, 0.0043153, 0.0050103, 0.0059095, 0.0049085, 0.0048965, 0.0044598, 0.0046489, 0.0041039, 0.0046396, 0.0041517, 0.0044351, 0.0043758, 0.0049224, 0.0040236, 0.0042446, 0.0042518, 0.0036658, 0.0059143, 0.0034832, 0.0047177, 0.0039361, 0.0052857, 0.0037747, 0.0039373, 0.0050433, 0.0056366, 0.0064808, 0.0043708, 0.0054534, 0.0052897, 0.0051587, 0.0064181, 0.0054164, 0.0055171, 0.0059685, 0.0058572, 0.0050598, 0.0062221, 0.0060376, 0.009028, 0.00677, 0.0058452, 0.008208, 0.0061156]
print('valueMse:', ','.join(format(x, '.5g') for x in valueMse))
[ ]Case B: kl, clip, evBrowser
kl = [0.012036, 0.018018, 0.019236, 0.018869, 0.013684, 0.011173, 0.016895, 0.013773, 0.008738, 0.008654, 0.012271, 0.017277, 0.012688, 0.013318, 0.018615, 0.015667, 0.018455, 0.009436, 0.01882, 0.0089621, 0.013297, 0.013998, 0.014768, 0.010735, 0.014519, 0.01546, 0.011252, 0.014107, 0.012926, 0.012504, 0.013606, 0.016711, 0.015429, 0.017064, 0.015023, 0.011691, 0.017449, 0.014664, 0.011248, 0.010163, 0.013795, 0.012258, 0.018608, 0.015729, 0.015369, 0.0095616, 0.016819, 0.01054, 0.014943, 0.012304, 0.016511, 0.012224, 0.014574, 0.016471, 0.013041, 0.013855, 0.011702, 0.0097284, 0.0135, 0.013663, 0.008735, 0.0092178, 0.0078202, 0.012216, 0.013479, 0.0092201, 0.016097, 0.014597, 0.012496, 0.010879, 0.0080863, 0.0086643, 0.011359, 0.0098399, 0.010215, 0.012042, 0.0085765, 0.009718, 0.0077695, 0.01095, 0.012107, 0.0094759, 0.0085794, 0.0092719, 0.011691, 0.0082262, 0.0095848, 0.0086985, 0.0052864, 0.0078475, 0.0069285, 0.00687, 0.01048, 0.0072505, 0.0069336, 0.006132, 0.0054905, 0.0034176, 0.0016994, 0.00052904]
print('kl:', ','.join(format(x, '.5g') for x in kl))
clip = [0.175, 0.269, 0.2535, 0.244, 0.178, 0.147, 0.223, 0.1875, 0.113, 0.1065, 0.1795, 0.214, 0.168, 0.206, 0.261, 0.2305, 0.268, 0.121, 0.2275, 0.1195, 0.178, 0.175, 0.1905, 0.1485, 0.2025, 0.208, 0.1645, 0.1835, 0.1885, 0.1805, 0.1905, 0.2275, 0.201, 0.2225, 0.1885, 0.1585, 0.254, 0.1945, 0.1555, 0.146, 0.1945, 0.1805, 0.244, 0.2055, 0.1995, 0.124, 0.192, 0.1435, 0.221, 0.1735, 0.218, 0.172, 0.2, 0.217, 0.1625, 0.1935, 0.148, 0.1285, 0.194, 0.1875, 0.1105, 0.1225, 0.0935, 0.1535, 0.1965, 0.1335, 0.213, 0.201, 0.187, 0.144, 0.114, 0.124, 0.151, 0.14, 0.139, 0.162, 0.1205, 0.1365, 0.1025, 0.1565, 0.1745, 0.127, 0.118, 0.1265, 0.1635, 0.107, 0.14, 0.1175, 0.06, 0.1, 0.0945, 0.092, 0.1525, 0.0925, 0.087, 0.081, 0.062, 0.0335, 0.0085, 0.001]
print('clip:', ','.join(format(x, '.5g') for x in clip))
ev = [0.22921, 0.42368, 0.42648, 0.3788, 0.38768, 0.52968, 0.57561, 0.72855, 0.6998, 0.85903, 0.93907, 0.94278, 0.97959, 0.96943, 0.97983, 0.97001, 0.97567, 0.98382, 0.98396, 0.95874, 0.98914, 0.98922, 0.95204, 0.99396, 0.99458, 0.99011, 0.99162, 0.99368, 0.99525, 0.99582, 0.99551, 0.99749, 0.9974, 0.99839, 0.9981, 0.99841, 0.99828, 0.99892, 0.99834, 0.99841, 0.99799, 0.99787, 0.9909, 0.99459, 0.99268, 0.98989, 0.98917, 0.99057, 0.99168, 0.99488, 0.99445, 0.99251, 0.9962, 0.99426, 0.99555, 0.99595, 0.95099, 0.9956, 0.99622, 0.99672, 0.99774, 0.99706, 0.99735, 0.99765, 0.9981, 0.99734, 0.99698, 0.99699, 0.99478, 0.99585, 0.99551, 0.99572, 0.9956, 0.99559, 0.99626, 0.99645, 0.99438, 0.99707, 0.99462, 0.99549, 0.93759, 0.98797, 0.9926, 0.99293, 0.93938, 0.98458, 0.99091, 0.98529, 0.99092, 0.98861, 0.98694, 0.99106, 0.98659, 0.9916, 0.98551, 0.992, 0.98904, 0.98959, 0.9338, 0.98154]
print('ev:', ','.join(format(x, '.5g') for x in ev))
[ ]Case B: entropy, grad, valueMseBrowser
entropy = [4.1968, 4.1321, 4.0521, 4.0126, 4.0051, 3.9978, 3.9331, 3.9272, 3.8879, 3.8552, 3.8111, 3.786, 3.7186, 3.6883, 3.6494, 3.5753, 3.5569, 3.5309, 3.5386, 3.5192, 3.5157, 3.4966, 3.4792, 3.4753, 3.4769, 3.4137, 3.3801, 3.3637, 3.3299, 3.2816, 3.2261, 3.1952, 3.1991, 3.1998, 3.1683, 3.1335, 3.1098, 3.0603, 3.0426, 3.0376, 3.0311, 2.9989, 2.964, 2.9335, 2.9276, 2.9086, 2.8932, 2.8902, 2.8568, 2.8278, 2.8045, 2.7821, 2.7616, 2.7559, 2.7391, 2.7258, 2.7335, 2.7159, 2.73, 2.7345, 2.7327, 2.727, 2.7244, 2.7229, 2.7095, 2.685, 2.6735, 2.6666, 2.6378, 2.638, 2.6193, 2.6013, 2.5958, 2.5798, 2.5738, 2.5712, 2.5623, 2.5393, 2.5411, 2.5479, 2.541, 2.5381, 2.5313, 2.5247, 2.5189, 2.5105, 2.5078, 2.5043, 2.4993, 2.4914, 2.4826, 2.4827, 2.4805, 2.4758, 2.473, 2.4711, 2.4704, 2.4702, 2.4689, 2.4689]
print('entropy:', ','.join(format(x, '.5g') for x in entropy))
grad = [0.45676, 0.51624, 0.50783, 0.53377, 0.62101, 0.61529, 0.69157, 0.61153, 0.65038, 0.59263, 0.58286, 0.56047, 0.71709, 0.59862, 0.65937, 0.72417, 0.70084, 0.70915, 0.70799, 0.63696, 0.70988, 0.71108, 0.50731, 0.72797, 0.72098, 0.76697, 0.83264, 0.72666, 0.85115, 0.91755, 0.80168, 0.87793, 0.82411, 0.79475, 0.85752, 0.96085, 0.91475, 0.86477, 0.91035, 0.96457, 0.92788, 0.95084, 1.056, 1.0048, 0.96747, 0.93444, 0.94717, 0.85674, 0.98996, 0.95815, 0.96646, 0.92081, 0.99959, 1.0335, 1.1423, 1.027, 0.8291, 1.1114, 1.056, 1.0543, 1.026, 1.0547, 1.071, 1.0765, 1.092, 1.1042, 1.0863, 1.0508, 1.1078, 1.1679, 1.1466, 1.1116, 1.0586, 1.0558, 1.1351, 1.1599, 1.1959, 1.1444, 1.0668, 1.1304, 1.0494, 1.1209, 1.1192, 1.166, 1.1772, 1.1479, 1.0896, 1.0931, 1.1571, 1.0995, 1.1776, 1.181, 1.2091, 1.248, 1.1782, 1.1992, 1.1802, 1.1561, 1.5725, 1.278]
print('grad:', ','.join(format(x, '.5g') for x in grad))
valueMse = [0.76135, 0.5886, 0.39768, 0.37488, 0.32391, 0.25587, 0.22118, 0.14975, 0.20272, 0.10158, 0.047887, 0.051543, 0.01807, 0.027063, 0.018398, 0.024533, 0.020968, 0.016511, 0.015773, 0.041773, 0.011157, 0.010244, 0.044551, 0.0060769, 0.0051559, 0.0091121, 0.0076229, 0.0055994, 0.0040641, 0.0036783, 0.0039283, 0.0022241, 0.0023331, 0.0014032, 0.0017337, 0.001449, 0.0015292, 0.0009557, 0.0014505, 0.0014199, 0.0017012, 0.0017569, 0.0075803, 0.0042135, 0.0060762, 0.0078544, 0.0088825, 0.007385, 0.0063945, 0.0042056, 0.004409, 0.0060728, 0.0031809, 0.0047358, 0.0037672, 0.0032282, 0.040703, 0.0036194, 0.0029911, 0.0026383, 0.0020243, 0.0024266, 0.0021453, 0.0019722, 0.0015413, 0.0021252, 0.0023155, 0.0020675, 0.0036784, 0.0029229, 0.0031255, 0.0029847, 0.0033496, 0.0030903, 0.0026681, 0.002347, 0.0040125, 0.0021584, 0.0037516, 0.0031588, 0.041307, 0.007147, 0.0047863, 0.0041308, 0.034792, 0.0076076, 0.005135, 0.0068829, 0.0045494, 0.005503, 0.0065659, 0.0042048, 0.0065831, 0.0041707, 0.0062775, 0.0038959, 0.0045576, 0.0053111, 0.029776, 0.0084186]
print('valueMse:', ','.join(format(x, '.5g') for x in valueMse))
[ ]Case C: kl, clip, evBrowser
kl = [0.0020597, 0.0027557, 0.0057138, 0.0051977, 0.006935, 0.0057278, 0.0098763, 0.0096882, 0.0085221, 0.010286, 0.00976, 0.0074426, 0.00438, 0.0043093, 0.0044199, 0.0068927, 0.0060447, 0.0041966, 0.0079836, 0.0076372, 0.0056548, 0.0084207, 0.0063936, 0.0040656, 0.0027541, 0.0041931, 0.0041782, 0.0019464, 0.0022683, 0.0017204, 0.00037566, 0.0013824, 0.0013757, 0.0005572, 0.00082106, 0.00068853, 0.0016118, 0.00041988, 0.0010704, 0.00093023, 0.00067021, 0.00021867, 0.0010948, 0.00030995, 0.00064781, 0.00038539, 0.00019687, 0.00068533, 0.00036815, 0.00028333, 0.00073222, 0.00076951, 0.00052751, 0.00052523, 0.00074399, 0.00040051, 0.0019705, 0.0011571, 0.00041212, 0.00074833, 0.0011046, 0.00028352, 0.0003467, 0.00048963, 0.00038637, 0.00052397, 0.00028117, 0.00019481, 0.00027675, 0.0011093, 0.001214, 0.00034918, 0.00040665, 0.00051386, 0.00048693, 0.00053332, 0.00076354, 0.00063602, 0.00026011, 0.00034205, 0.0002324, 0.0003262, 0.00078358, 0.00060236, 0.00019634, 0.00028622, 0.00017832, 0.00017816, 0.00011559, 0.00024563, 0.0005, 5.6181e-05, 6.1144e-05, 0.00013924, 0.00010677, 7.8113e-05, 1.8942e-05, 2.9133e-05, 7.3351e-06, 1.3856e-06]
print('kl:', ','.join(format(x, '.5g') for x in kl))
clip = [0.0105, 0.0155, 0.0705, 0.0555, 0.0965, 0.072, 0.1455, 0.1335, 0.1185, 0.1415, 0.1445, 0.097, 0.044, 0.0495, 0.0425, 0.0975, 0.0835, 0.0515, 0.1075, 0.1075, 0.074, 0.123, 0.082, 0.037, 0.019, 0.0495, 0.055, 0.0095, 0.0185, 0.005, 0.0, 0.006, 0.002, 0.0005, 0.0, 0.001, 0.006, 0.0, 0.001, 0.0015, 0.0, 0.0, 0.0005, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0135, 0.003, 0.0, 0.0005, 0.001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.002, 0.004, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
print('clip:', ','.join(format(x, '.5g') for x in clip))
ev = [0.011431, 0.33468, 0.4011, 0.42661, 0.47274, 0.47887, 0.3832, 0.37801, 0.39369, 0.39907, 0.50951, 0.72177, 0.76885, 0.87321, 0.88573, 0.96738, 0.96864, 0.96828, 0.9653, 0.96049, 0.95881, 0.9261, 0.95776, 0.97388, 0.98103, 0.98421, 0.98544, 0.9869, 0.97859, 0.98896, 0.989, 0.97958, 0.99064, 0.98969, 0.99048, 0.98882, 0.99029, 0.9914, 0.99112, 0.98993, 0.98993, 0.99112, 0.99058, 0.99016, 0.99178, 0.99258, 0.99051, 0.99334, 0.99027, 0.99275, 0.98944, 0.99179, 0.99129, 0.9914, 0.99205, 0.99296, 0.99124, 0.99306, 0.99294, 0.99159, 0.99019, 0.99341, 0.99286, 0.99075, 0.99344, 0.99151, 0.99224, 0.98969, 0.99267, 0.99136, 0.98766, 0.99195, 0.99143, 0.99077, 0.99018, 0.98998, 0.99089, 0.98924, 0.99107, 0.98998, 0.98804, 0.9876, 0.98673, 0.98685, 0.98568, 0.98884, 0.9795, 0.98983, 0.98686, 0.98742, 0.98942, 0.9862, 0.98604, 0.98832, 0.98683, 0.9845, 0.98856, 0.98656, 0.98785, 0.98773]
print('ev:', ','.join(format(x, '.5g') for x in ev))
[ ]Case C: entropy, grad, valueMseBrowser
entropy = [4.2583, 4.2493, 4.2436, 4.2371, 4.2302, 4.2205, 4.2115, 4.1997, 4.1927, 4.1828, 4.1742, 4.1656, 4.1591, 4.1556, 4.1555, 4.1536, 4.1555, 4.1538, 4.1499, 4.1471, 4.1464, 4.145, 4.142, 4.1382, 4.1349, 4.1347, 4.1343, 4.1343, 4.1321, 4.1294, 4.1268, 4.1243, 4.1233, 4.1241, 4.1245, 4.1242, 4.1241, 4.1238, 4.124, 4.1234, 4.1228, 4.1222, 4.1214, 4.1205, 4.119, 4.1186, 4.1186, 4.118, 4.1185, 4.119, 4.1182, 4.1186, 4.1176, 4.1175, 4.1174, 4.1172, 4.1156, 4.1147, 4.1148, 4.114, 4.1132, 4.1123, 4.1113, 4.1104, 4.1091, 4.1087, 4.1078, 4.1065, 4.1056, 4.1051, 4.1049, 4.1044, 4.1043, 4.1038, 4.1031, 4.1021, 4.101, 4.1, 4.0985, 4.0978, 4.0973, 4.0969, 4.0968, 4.0965, 4.0968, 4.0966, 4.0962, 4.0959, 4.0959, 4.0957, 4.0953, 4.0951, 4.095, 4.095, 4.0947, 4.0944, 4.0941, 4.0939, 4.0937, 4.0937]
print('entropy:', ','.join(format(x, '.5g') for x in entropy))
grad = [0.74172, 0.63232, 0.57509, 0.68004, 0.59527, 0.5577, 0.55528, 0.62769, 0.6291, 0.59549, 0.61219, 0.49894, 0.54037, 0.45535, 0.39532, 0.32658, 0.26229, 0.2129, 0.19067, 0.15846, 0.16892, 0.20364, 0.16383, 0.14642, 0.10569, 0.085379, 0.09149, 0.084243, 0.11407, 0.09094, 0.073036, 0.13159, 0.07534, 0.066452, 0.06641, 0.070887, 0.068462, 0.060242, 0.061261, 0.058165, 0.05944, 0.054885, 0.059222, 0.053493, 0.05127, 0.057097, 0.053626, 0.048559, 0.056469, 0.048017, 0.059729, 0.051892, 0.052943, 0.055559, 0.05421, 0.053087, 0.05168, 0.047607, 0.046902, 0.059082, 0.062852, 0.045377, 0.048055, 0.057506, 0.046492, 0.056457, 0.052967, 0.059863, 0.048185, 0.06092, 0.069874, 0.057359, 0.056419, 0.055854, 0.056019, 0.062948, 0.064397, 0.061027, 0.056331, 0.060477, 0.066453, 0.068376, 0.085462, 0.070921, 0.076472, 0.070397, 0.093897, 0.066892, 0.079256, 0.07293, 0.070121, 0.067983, 0.070506, 0.07518, 0.073047, 0.084298, 0.062805, 0.076473, 0.071989, 0.068031]
print('grad:', ','.join(format(x, '.5g') for x in grad))
valueMse = [1.2171, 0.54603, 0.57403, 0.73449, 0.60873, 0.53898, 0.5389, 0.54601, 0.53525, 0.46845, 0.34748, 0.19379, 0.19592, 0.12041, 0.11754, 0.037214, 0.035938, 0.037945, 0.036994, 0.038654, 0.03661, 0.059408, 0.038268, 0.024388, 0.017263, 0.014417, 0.013463, 0.01219, 0.018964, 0.010489, 0.010157, 0.018608, 0.0084428, 0.0086038, 0.0081724, 0.0094343, 0.0082946, 0.0070238, 0.0072831, 0.0081379, 0.0080059, 0.007115, 0.0073033, 0.00753, 0.0062669, 0.00593, 0.0069723, 0.005126, 0.0071571, 0.0056031, 0.0077659, 0.0061814, 0.0065486, 0.0063352, 0.0059684, 0.005283, 0.00612, 0.0051458, 0.0050899, 0.0061827, 0.006921, 0.0046874, 0.0054058, 0.0066737, 0.0047361, 0.00597, 0.0054858, 0.0074496, 0.0054678, 0.0062538, 0.0088215, 0.0057923, 0.0063139, 0.0069946, 0.0073024, 0.0072011, 0.0068224, 0.007838, 0.0065512, 0.0072477, 0.0085949, 0.0087218, 0.0097795, 0.0094011, 0.01012, 0.00858, 0.014415, 0.0075379, 0.009753, 0.0092878, 0.008454, 0.010033, 0.010577, 0.0088927, 0.0098841, 0.011656, 0.0089005, 0.0098647, 0.0091163, 0.009304]
print('valueMse:', ','.join(format(x, '.5g') for x in valueMse))
[ ]Case D: kl, clip, evBrowser
kl = [0.0039185, 0.015729, 0.077591, 0.13392, 0.15927, 0.31299, 0.42099, 0.5899, 0.58485, 1.1369, 0.5604, 1.0036, 1.0163, 0.51777, 0.61947, 0.98063, 0.86219, 0.6882, 0.86351, 0.31243, 0.62065, 0.65768, 0.52723, 0.66453, 1.4033, 0.51064, 0.53311, 0.82042, 0.32134, 1.1742, 1.2437, 0.61637, 0.84558, 0.54525, 2.0159, 4.6018, 3.831, 0.87966, 1.33, 0.69204, 0.56108, 0.64074, 0.68296, 0.22315, 0.80681, 0.16492, 0.15905, 0.11631, 0.12915, 0.15781, 0.14619, 0.21023, 0.3595, 0.2548, 0.077064, 0.046795, 0.04731, 0.16336, 0.1133, 0.27843, 0.37084, 0.38144, 0.78632, 0.92433, 1.2101, 0.29581, 0.43615, 0.35237, 0.61543, 0.3723, 0.48095, 0.31317, 0.34278, 0.33526, 0.4837, 0.35818, 0.27231, 0.25269, 0.066051, 0.27832, 0.004705, 0.20884, 0.372, 0.20597, 0.040669, 0.34598, 0.1921, 0.21657, 0.14433, 0.0081857, 0.021697, 0.0034759, 0.027802, 0.021498, 0.010582, 0.0073815, 0.0089454, 0.0018271, 0.00017709, 0.00016362]
print('kl:', ','.join(format(x, '.5g') for x in kl))
clip = [0.044, 0.2125, 0.456, 0.595, 0.656, 0.752, 0.817, 0.8615, 0.8505, 0.874, 0.8685, 0.8115, 0.8115, 0.801, 0.758, 0.7615, 0.811, 0.791, 0.8375, 0.807, 0.745, 0.7895, 0.776, 0.797, 0.766, 0.842, 0.8005, 0.7995, 0.7225, 0.694, 0.734, 0.786, 0.7225, 0.703, 0.707, 0.7795, 0.797, 0.759, 0.74, 0.736, 0.6945, 0.667, 0.735, 0.712, 0.6775, 0.6905, 0.4865, 0.4215, 0.6135, 0.588, 0.611, 0.5575, 0.125, 0.315, 0.1145, 0.1155, 0.175, 0.471, 0.441, 0.3125, 0.3875, 0.4945, 0.4805, 0.382, 0.397, 0.2875, 0.3165, 0.2845, 0.315, 0.2785, 0.28, 0.24, 0.28, 0.281, 0.2765, 0.269, 0.244, 0.3705, 0.1785, 0.274, 0.0425, 0.236, 0.2775, 0.264, 0.1705, 0.2735, 0.232, 0.239, 0.23, 0.0835, 0.1175, 0.044, 0.1315, 0.116, 0.0955, 0.0855, 0.09, 0.027, 0.0, 0.0]
print('clip:', ','.join(format(x, '.5g') for x in clip))
ev = [0.0093012, 0.45179, 0.63053, 0.66693, 0.39785, 0.43683, 0.81234, 0.88397, 0.51268, 0.86893, 0.86432, 0.86804, 0.86829, 0.88395, 0.90556, 0.89103, 0.92603, 0.91215, 0.91697, 0.92206, 0.93475, 0.94495, 0.95308, 0.96078, 0.96641, 0.97196, 0.97339, 0.97518, 0.97815, 0.97895, 0.9801, 0.9824, 0.98316, 0.97801, 0.98453, 0.36304, 0.46626, 0.61774, 0.72421, 0.82305, 0.86676, 0.89613, 0.9233, 0.94491, 0.96591, 0.97602, 0.98316, 0.98743, 0.98968, 0.99092, 0.99186, 0.9918, 0.99234, 0.99197, 0.99301, 0.99219, 0.99301, 0.99284, 0.99275, 0.99272, 0.99277, 0.99257, 0.99218, 0.99175, 0.97754, 0.50474, 0.0056859, 0.65824, 0.42568, -3.9338, -10.041, -3.9454, -3.0525, 0.030043, 0.078819, -1.7372, -1.3609, -1.0286, -0.7559, -0.56656, -0.40588, -0.28927, -0.22509, 0.31825, 0.50061, 0.46462, -0.39355, -0.078126, -0.01164, 0.052446, 0.098244, 0.13129, 0.15758, 0.1742, 0.20569, 0.22238, 0.22037, 0.25021, 0.24165, 0.25333]
print('ev:', ','.join(format(x, '.5g') for x in ev))
[ ]Case D: entropy, grad, valueMseBrowser
entropy = [4.2614, 4.2724, 4.2749, 4.271, 4.2662, 4.2615, 4.2491, 4.2397, 4.2328, 4.2209, 4.2068, 4.1999, 4.1913, 4.1822, 4.1752, 4.1702, 4.1697, 4.1621, 4.1642, 4.1591, 4.1539, 4.1479, 4.1454, 4.1429, 4.1416, 4.1359, 4.134, 4.1301, 4.1267, 4.1285, 4.1284, 4.1303, 4.1309, 4.1284, 4.1281, 4.1275, 4.1262, 4.1271, 4.1254, 4.1223, 4.1223, 4.1209, 4.1211, 4.1201, 4.1207, 4.1175, 4.1181, 4.1172, 4.119, 4.1175, 4.1215, 4.1214, 4.1188, 4.1143, 4.1151, 4.1142, 4.114, 4.1136, 4.1094, 4.1074, 4.1067, 4.1058, 4.1053, 4.105, 4.1044, 4.1013, 4.0973, 4.095, 4.0937, 4.0909, 4.0866, 4.0844, 4.0823, 4.0805, 4.0777, 4.0749, 4.0733, 4.0739, 4.0743, 4.0721, 4.0723, 4.0717, 4.0705, 4.0702, 4.0699, 4.0688, 4.0684, 4.0675, 4.0662, 4.0652, 4.0647, 4.0653, 4.0649, 4.0648, 4.0645, 4.0646, 4.0647, 4.0647, 4.0646, 4.0645]
print('entropy:', ','.join(format(x, '.5g') for x in entropy))
grad = [0.67093, 0.67994, 0.8079, 0.89338, 0.88621, 0.79174, 1.2899, 2.0563, 0.97031, 2.0124, 1.7635, 2.4996, 2.024, 1.5185, 2.1716, 2.2455, 2.5723, 2.1875, 3.4847, 1.6847, 1.656, 1.7825, 1.6702, 1.5755, 2.3025, 2.1992, 2.0187, 1.9581, 1.8816, 3.7029, 2.4282, 2.1438, 2.1488, 2.3149, 1.8326, 1.5882, 5.1458, 3.6172, 2.5764, 3.2985, 2.2844, 1.6049, 1.5855, 1.4924, 3.218, 1.5711, 1.3316, 1.4705, 1.6901, 1.9295, 1.8525, 3.3554, 3.5249, 7.8419, 2.1798, 2.1982, 1.6622, 1.8316, 1.9227, 2.328, 6.8559, 1.6645, 3.6134, 3.3661, 2.6533, 5.4473, 2.6515, 7.1185, 5.2385, 2.4287, 3.4774, 3.0756, 3.6251, 2.9819, 2.9669, 2.4734, 2.8384, 1.6604, 1.7454, 2.9601, 1.6027, 2.3031, 3.9194, 2.0601, 2.1719, 3.3805, 5.0721, 4.3458, 3.1991, 1.8178, 2.0622, 1.724, 2.0835, 2.1136, 1.9521, 2.1157, 2.1267, 1.4122, 1.6874, 1.7578]
print('grad:', ','.join(format(x, '.5g') for x in grad))
valueMse = [1.2182, 0.31326, 0.11484, 0.10533, 0.37266, 0.3437, 0.015728, 0.0065141, 0.070721, 0.004666, 0.0041882, 0.0039717, 0.0042232, 0.003817, 0.0032746, 0.0038901, 0.0028796, 0.0033063, 0.0034764, 0.0033101, 0.0029189, 0.0025028, 0.0022179, 0.0018939, 0.0016926, 0.0014392, 0.0014044, 0.0013435, 0.0011946, 0.0011818, 0.0011455, 0.0010417, 0.0010128, 0.0013668, 0.00097022, 1.8515, 5.3999, 2.9082, 1.4378, 0.66228, 0.416, 0.28005, 0.18258, 0.11916, 0.065669, 0.042792, 0.028625, 0.020114, 0.015739, 0.013311, 0.011463, 0.011157, 0.010043, 0.010301, 0.0088166, 0.0095506, 0.0083134, 0.0083663, 0.0083203, 0.0082131, 0.0080811, 0.0081916, 0.0085172, 0.0088077, 0.023237, 0.62424, 0.94972, 0.39515, 0.56254, 0.27309, 0.091128, 0.033125, 0.023921, 0.043319, 0.035501, 0.015897, 0.013918, 0.012206, 0.010511, 0.009741, 0.0088775, 0.008164, 0.0078506, 0.031229, 0.20946, 0.089401, 0.010332, 0.007506, 0.0068116, 0.0064713, 0.0060895, 0.0060225, 0.0058694, 0.0057849, 0.0056155, 0.0056023, 0.0056739, 0.0054739, 0.0057319, 0.0055992]
print('valueMse:', ','.join(format(x, '.5g') for x in valueMse))
[ ]Case E: kl, clip, evBrowser
kl = [0.0033345, 0.0061275, 0.0079733, 0.0085158, 0.0073035, 0.0072163, 0.0088434, 0.010728, 0.010885, 0.0091551, 0.01027, 0.012939, 0.0064187, 0.0075578, 0.0077561, 0.0047644, 0.0073301, 0.0042785, 0.010149, 0.007637, 0.0057503, 0.0073959, 0.0070356, 0.0056538, 0.0069071, 0.0072364, 0.007373, 0.0066431, 0.0056633, 0.0050714, 0.0072142, 0.0074398, 0.0089086, 0.0087963, 0.0096298, 0.0083876, 0.010165, 0.0079097, 0.0092009, 0.0058503, 0.0049732, 0.0071985, 0.0039808, 0.0046989, 0.0078462, 0.002559, 0.0053529, 0.0048013, 0.0040943, 0.0048505, 0.0076641, 0.0059114, 0.0042229, 0.00291, 0.0043945, 0.0023595, 0.0044721, 0.0018254, 0.0050726, 0.0039843, 0.00125, 0.0023158, 0.001138, 0.0030304, 0.0037084, 0.0032476, 0.0019928, 0.0016213, 0.00092806, 0.0007705, 0.0018962, 0.002943, 0.0010194, 0.00077551, 0.0020123, 0.00082018, 0.001164, 0.0022356, 0.001605, 0.0010146, 0.00062119, 0.00044318, 0.00074668, 0.00039806, 0.0013983, 0.00063298, 0.00138, 0.00034075, 0.00036292, 0.0001885, 0.00072172, 0.00028572, 0.00013733, 0.00046313, 0.00018435, 4.3427e-05, 6.8159e-05, 2.4375e-05, 1.1789e-05, 2.5248e-06]
print('kl:', ','.join(format(x, '.5g') for x in kl))
clip = [0.03, 0.082, 0.1105, 0.115, 0.091, 0.0935, 0.1195, 0.159, 0.161, 0.119, 0.1465, 0.162, 0.081, 0.102, 0.1045, 0.042, 0.0995, 0.048, 0.1535, 0.1075, 0.0695, 0.0975, 0.0885, 0.0715, 0.097, 0.09, 0.0915, 0.085, 0.07, 0.049, 0.0955, 0.1005, 0.1245, 0.12, 0.1315, 0.104, 0.1435, 0.1095, 0.1265, 0.0705, 0.0515, 0.115, 0.0405, 0.0555, 0.102, 0.0165, 0.0575, 0.0555, 0.0455, 0.0475, 0.1045, 0.0745, 0.0365, 0.02, 0.0545, 0.012, 0.0425, 0.007, 0.063, 0.035, 0.001, 0.0085, 0.0035, 0.0265, 0.031, 0.031, 0.012, 0.006, 0.001, 0.001, 0.0055, 0.022, 0.0005, 0.001, 0.005, 0.0005, 0.001, 0.014, 0.004, 0.0005, 0.0, 0.0, 0.001, 0.0, 0.0035, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
print('clip:', ','.join(format(x, '.5g') for x in clip))
ev = [0.0084042, 0.38023, 0.42155, 0.41559, 0.41311, 0.43779, 0.44683, 0.37062, 0.41391, 0.4807, 0.54385, 0.56024, 0.58923, 0.67231, 0.81775, 0.86341, 0.94035, 0.96628, 0.9763, 0.98503, 0.98753, 0.98792, 0.98916, 0.98701, 0.98642, 0.98861, 0.9893, 0.98546, 0.98909, 0.99016, 0.99014, 0.99157, 0.9907, 0.99174, 0.9901, 0.99245, 0.99086, 0.98696, 0.98583, 0.98283, 0.98019, 0.98195, 0.98045, 0.98253, 0.98498, 0.98477, 0.98849, 0.99026, 0.9922, 0.99367, 0.99441, 0.99405, 0.99509, 0.99419, 0.99212, 0.99463, 0.99509, 0.99413, 0.99329, 0.99407, 0.99428, 0.99505, 0.99449, 0.99523, 0.99414, 0.99495, 0.9943, 0.99479, 0.99349, 0.99494, 0.99444, 0.99471, 0.99535, 0.99218, 0.99581, 0.99395, 0.99518, 0.99359, 0.9954, 0.99511, 0.99379, 0.99253, 0.99193, 0.99435, 0.99328, 0.99315, 0.99359, 0.99189, 0.99303, 0.99336, 0.99283, 0.99263, 0.9938, 0.99231, 0.99252, 0.9884, 0.99161, 0.99237, 0.99031, 0.99268]
print('ev:', ','.join(format(x, '.5g') for x in ev))
[ ]Case E: entropy, grad, valueMseBrowser
entropy = [4.251, 4.2408, 4.2332, 4.2218, 4.2059, 4.195, 4.1877, 4.1812, 4.1753, 4.172, 4.168, 4.1667, 4.164, 4.1637, 4.1572, 4.1533, 4.1479, 4.1461, 4.1406, 4.1373, 4.1322, 4.1289, 4.1302, 4.1303, 4.1298, 4.1287, 4.1205, 4.114, 4.1125, 4.1084, 4.1047, 4.1017, 4.1027, 4.1016, 4.1, 4.0993, 4.0932, 4.0862, 4.0803, 4.0756, 4.0741, 4.0729, 4.073, 4.0715, 4.071, 4.0683, 4.0661, 4.0608, 4.0615, 4.0594, 4.051, 4.0489, 4.0463, 4.0431, 4.0451, 4.0454, 4.0427, 4.0436, 4.042, 4.04, 4.0379, 4.0355, 4.0337, 4.0285, 4.0266, 4.0257, 4.0233, 4.0216, 4.0204, 4.0199, 4.0192, 4.0203, 4.021, 4.0201, 4.0193, 4.0201, 4.0199, 4.0187, 4.0174, 4.0162, 4.0142, 4.0136, 4.0138, 4.014, 4.0141, 4.0131, 4.0123, 4.012, 4.0116, 4.0109, 4.0101, 4.0102, 4.0102, 4.0099, 4.0095, 4.009, 4.0086, 4.0082, 4.008, 4.008]
print('entropy:', ','.join(format(x, '.5g') for x in entropy))
grad = [0.65696, 0.67881, 0.64346, 0.7288, 0.69685, 0.6499, 0.67851, 0.63563, 0.66227, 0.60472, 0.67205, 0.67901, 0.80476, 0.78092, 0.77156, 0.68119, 0.6986, 0.62842, 0.64554, 0.5912, 0.56066, 0.59779, 0.52883, 0.5485, 0.55954, 0.52567, 0.54771, 0.56041, 0.52933, 0.54091, 0.54852, 0.5168, 0.54965, 0.60643, 0.59342, 0.55079, 0.5774, 0.61712, 0.57939, 0.60424, 0.61124, 0.62274, 0.6234, 0.58276, 0.60259, 0.62714, 0.57174, 0.57917, 0.57951, 0.61045, 0.58841, 0.60143, 0.58658, 0.62137, 0.6192, 0.56848, 0.63437, 0.58911, 0.64861, 0.60399, 0.64583, 0.6671, 0.60869, 0.56805, 0.60044, 0.6522, 0.62489, 0.65283, 0.59018, 0.57889, 0.59415, 0.6493, 0.63118, 0.64177, 0.66198, 0.63985, 0.63151, 0.60117, 0.68477, 0.613, 0.61349, 0.67251, 0.68539, 0.65362, 0.68857, 0.61708, 0.66847, 0.68942, 0.66308, 0.64476, 0.68372, 0.65712, 0.59815, 0.68398, 0.70053, 0.6631, 0.72162, 0.67244, 0.70519, 0.63558]
print('grad:', ','.join(format(x, '.5g') for x in grad))
valueMse = [1.2189, 0.57359, 0.61894, 0.7693, 0.56192, 0.48227, 0.44206, 0.43327, 0.39149, 0.39176, 0.3334, 0.34179, 0.35547, 0.24955, 0.14063, 0.12153, 0.061446, 0.04001, 0.029476, 0.020123, 0.017299, 0.015786, 0.013272, 0.015499, 0.015781, 0.012187, 0.01116, 0.014778, 0.010587, 0.0094629, 0.009339, 0.0078727, 0.0084853, 0.0075341, 0.0088963, 0.0066591, 0.0083577, 0.010563, 0.011047, 0.013073, 0.013895, 0.011863, 0.013211, 0.011415, 0.0096583, 0.01004, 0.0072788, 0.0070474, 0.0063138, 0.0050575, 0.0045191, 0.0050362, 0.0043486, 0.0049036, 0.0067599, 0.0046701, 0.0043153, 0.0050103, 0.0059095, 0.0049085, 0.0048965, 0.0044598, 0.0046489, 0.0041039, 0.0046396, 0.0041517, 0.0044351, 0.0043758, 0.0049224, 0.0040236, 0.0042446, 0.0042518, 0.0036658, 0.0059143, 0.0034832, 0.0047177, 0.0039361, 0.0052857, 0.0037747, 0.0039373, 0.0050433, 0.0056366, 0.0064808, 0.0043708, 0.0054534, 0.0052897, 0.0051587, 0.0064181, 0.0054164, 0.0055171, 0.0059685, 0.0058572, 0.0050598, 0.0062221, 0.0060376, 0.009028, 0.00677, 0.0058452, 0.008208, 0.0061156]
print('valueMse:', ','.join(format(x, '.5g') for x in valueMse))

Full sweep results

Each row is one training seed and each column a final evaluation seed in protocol order. Run cells sequentially: they retain full matrices and calculate viewer values.

[ ]Final returns: Hopper-v5/controlBrowser
import numpy as np
matrices = {}
matrices['Hopper-v5/control'] = np.array([[338.1929910926662, 338.65880993199323, 339.9281617171122, 335.4022728733878, 339.0252643318663], [727.744255537232, 836.0689946454169, 820.1931030925592, 925.3270044166516, 810.3777761742865], [882.8079703508627, 866.2967680081429, 860.1971199668759, 862.712180971441, 868.1588664277206], [914.8509732846643, 951.7674167271358, 890.4666438538812, 898.8997062483468, 903.0649048992777], [1227.1331199333483, 1222.4827497019844, 1291.4259310671093, 1231.8234353981957, 1145.8732302103624]], dtype=float)
print('Hopper-v5/control', matrices['Hopper-v5/control'].tolist())
[ ]Final returns: Hopper-v5/sin_normalizar_obsBrowser
matrices['Hopper-v5/sin_normalizar_obs'] = np.array([[337.4643833518757, 337.50329332823486, 339.53715326349123, 338.24549993490825, 339.78009494543966], [556.572084432584, 539.0699710253991, 552.872743323182, 548.1231481959722, 543.1456266619663], [587.0223075745092, 387.61598229686507, 500.3750605158734, 534.905980800641, 361.53386793087856], [622.6681251701386, 650.7673263169972, 987.1948029061182, 653.8577123905268, 673.0470569899807], [330.66759228981465, 330.5404370219937, 333.28167656054916, 331.7270911152249, 333.66606886715357]], dtype=float)
print('Hopper-v5/sin_normalizar_obs', matrices['Hopper-v5/sin_normalizar_obs'].tolist())
[ ]Final returns: Hopper-v5/sin_normalizar_recompensasBrowser
matrices['Hopper-v5/sin_normalizar_recompensas'] = np.array([[373.06078758941896, 372.12421136256, 371.69339105610516, 371.4963925365929, 373.52114536193017], [365.88472096281066, 371.5979557736887, 367.715009967139, 370.778658419735, 369.75331707933464], [368.61467267613574, 371.3737558416144, 370.64129469192216, 370.4351263865216, 371.986199677296], [355.81229645231184, 364.86621278850623, 358.86634754547595, 366.8996200980957, 370.7493455969421], [366.4284712215138, 369.84208686633474, 368.1670759775267, 370.9827817703308, 369.9944896471133]], dtype=float)
print('Hopper-v5/sin_normalizar_recompensas', matrices['Hopper-v5/sin_normalizar_recompensas'].tolist())
[ ]Final returns: Hopper-v5/sin_normalizar_ventajasBrowser
matrices['Hopper-v5/sin_normalizar_ventajas'] = np.array([[427.79515850128666, 429.5480302351489, 428.4874994920963, 427.8019780159795, 430.287038942902], [869.6336529616726, 875.6602618932632, 874.5267149629058, 874.1320205458758, 873.1820132060659], [920.4896473917976, 923.4225265722052, 923.6581811566232, 920.4522587505114, 932.5189538239064], [992.789570244847, 970.2201516482752, 1007.1656484596572, 967.417907698867, 960.7498564526811], [843.6025237238371, 845.1517385555504, 845.396631477472, 842.7989724081594, 842.5659317410614]], dtype=float)
print('Hopper-v5/sin_normalizar_ventajas', matrices['Hopper-v5/sin_normalizar_ventajas'].tolist())
[ ]Final returns: Hopper-v5/sin_recorte_normaBrowser
matrices['Hopper-v5/sin_recorte_norma'] = np.array([[346.1129202834661, 346.6868990273755, 344.98482971115817, 345.08569552180336, 346.3904318222281], [832.2226286795884, 837.2835160096521, 854.2674028569669, 825.3862496375003, 825.132281112246], [887.2021929277399, 910.3397243963366, 889.3402078965272, 919.3454827062209, 916.0148445926058], [1225.3151999627382, 1225.4592936113102, 1230.2908310541227, 1240.1257489282364, 1223.390781406982], [826.3253113997317, 814.473092729546, 815.0350710805764, 824.4093347240653, 820.3521855086497]], dtype=float)
print('Hopper-v5/sin_recorte_norma', matrices['Hopper-v5/sin_recorte_norma'].tolist())
[ ]Final returns: Hopper-v5/sin_recocido_lrBrowser
matrices['Hopper-v5/sin_recocido_lr'] = np.array([[535.9090748876471, 540.6074416915716, 541.627791312994, 547.8183870144629, 543.9568479050135], [702.9354331753852, 693.6607406246032, 702.674474255278, 714.4757265795172, 699.3009842454978], [994.6274559154251, 1003.0122529955033, 984.516209229701, 969.654505218222, 961.5608312170125], [459.6030397884323, 463.5623577314806, 463.3851613987386, 461.91934238396453, 460.2109410903416], [1117.6489524508142, 1165.2404576852457, 1139.549712114493, 1049.122453574518, 1224.2594803704233]], dtype=float)
print('Hopper-v5/sin_recocido_lr', matrices['Hopper-v5/sin_recocido_lr'].tolist())
[ ]Final returns: Hopper-v5/tasa_altaBrowser
matrices['Hopper-v5/tasa_alta'] = np.array([[1649.6645791909334, 1633.699307009292, 1767.2429703154748, 1685.555383253267, 1626.5197464544115], [1259.3502771254775, 1260.5327574043395, 1260.1964990826455, 1252.2417602453843, 1260.7513277251048], [3291.8738971222106, 3288.184818969033, 3284.2484420484193, 3288.9867275932843, 3286.6665318543605], [1673.054569102683, 1627.717233113818, 1647.5025994692387, 1647.9593202094666, 1663.5501158609013], [2384.5436145219987, 3134.709657470168, 3140.2176532445365, 3139.5507611945964, 3133.2749728067756]], dtype=float)
print('Hopper-v5/tasa_alta', matrices['Hopper-v5/tasa_alta'].tolist())
[ ]Final returns: Hopper-v5/signo_actor_invertidoBrowser
matrices['Hopper-v5/signo_actor_invertido'] = np.array([[0.7800669983868669, 0.7784962155111053, 0.8524791381651451, 0.7449727973788303, 0.7159093896027273], [-2.353209834656674, -2.636411709613636, -2.3424458311883947, -2.5503527235345036, 3.6102209271568224], [-2.310620731049821, -2.5145895597917454, -2.3433715485683293, -2.5515648325340754, -2.088652450034443], [4.941011334421675, 4.928546454852643, 4.895204973117206, 4.852398998616783, 4.975559959275749], [-0.6211397263964804, -0.6452264436176995, -0.4815346173661159, -0.5846861847408333, -0.7816975296751179]], dtype=float)
print('Hopper-v5/signo_actor_invertido', matrices['Hopper-v5/signo_actor_invertido'].tolist())
[ ]Final returns: Hopper-v5/sin_bootstrap_truncamientoBrowser
matrices['Hopper-v5/sin_bootstrap_truncamiento'] = np.array([[338.1929910926662, 338.65880993199323, 339.9281617171122, 335.4022728733878, 339.0252643318663], [727.744255537232, 836.0689946454169, 820.1931030925592, 925.3270044166516, 810.3777761742865], [882.8079703508627, 866.2967680081429, 860.1971199668759, 862.712180971441, 868.1588664277206], [914.8509732846643, 951.7674167271358, 890.4666438538812, 898.8997062483468, 903.0649048992777], [1227.1331199333483, 1222.4827497019844, 1291.4259310671093, 1231.8234353981957, 1145.8732302103624]], dtype=float)
print('Hopper-v5/sin_bootstrap_truncamiento', matrices['Hopper-v5/sin_bootstrap_truncamiento'].tolist())
[ ]Final returns: HalfCheetah-v5/controlBrowser
matrices['HalfCheetah-v5/control'] = np.array([[496.2762792093811, -318.7927743608504, 491.7576874454312, 507.3578072950645, -319.3868243975307], [198.31967510414316, -405.7196916031975, -478.3566268601227, -7.442081498263853, -19.3934403809658], [138.02516587944956, 171.9773665808955, 163.3232815772164, 159.66593068858091, 139.66784396657263], [1275.9218583570362, 1340.3472379082712, 1291.127422619801, 1312.5431697862937, 1370.5369445131112], [56.26401653114125, 46.19078620066923, 34.22196483599712, 72.60151834449958, 68.24194367985805]], dtype=float)
print('HalfCheetah-v5/control', matrices['HalfCheetah-v5/control'].tolist())
[ ]Final returns: HalfCheetah-v5/sin_normalizar_obsBrowser
matrices['HalfCheetah-v5/sin_normalizar_obs'] = np.array([[512.1487295660036, 396.4673149868579, 388.464200648388, 492.94712713233287, 475.2727358978235], [700.6307151768237, 581.7714098487667, 720.6877864368291, 715.8716855952105, 645.2455653464647], [-216.8541737657278, -132.7176503562237, -131.98037894412843, -242.19118412481805, -240.13014140518825], [616.4242796100774, 621.7674806299361, 628.1293230456622, 605.9608727185022, 571.4252442395175], [363.1111636787325, 381.49483536979835, 507.6477772647238, 464.5451425886681, 457.4078343473445]], dtype=float)
print('HalfCheetah-v5/sin_normalizar_obs', matrices['HalfCheetah-v5/sin_normalizar_obs'].tolist())
[ ]Final returns: HalfCheetah-v5/sin_normalizar_recompensasBrowser
matrices['HalfCheetah-v5/sin_normalizar_recompensas'] = np.array([[-206.45479229578083, -206.2254307694588, -203.77203207451038, -198.0456562618006, -208.1194925211137], [763.7346834181742, 675.3523009518343, 854.9184609683291, 758.9815238315998, 788.244766607741], [233.37575929982216, 234.9903894143331, 222.7911981934391, 242.18283152176255, 231.7063423800002], [-74.11957826042728, -65.77905103144201, -70.2413115746665, -71.24922911287256, -72.2900369697144], [-73.25654588988007, -73.94211641628335, -72.86312173989815, -73.84943242210105, -75.13758235811203]], dtype=float)
print('HalfCheetah-v5/sin_normalizar_recompensas', matrices['HalfCheetah-v5/sin_normalizar_recompensas'].tolist())
[ ]Final returns: HalfCheetah-v5/sin_normalizar_ventajasBrowser
matrices['HalfCheetah-v5/sin_normalizar_ventajas'] = np.array([[1215.9914499008955, 1180.6368437509846, 1186.7249502759382, 877.4715122534537, 1105.7979569042916], [728.9578615524753, 748.1256951021263, 783.6356058697513, 718.3544650862685, 634.504717351517], [974.1918895493538, 994.1389451645026, 966.9957824964831, 930.6619086128553, 942.8285192160164], [389.63722333121405, 367.5697574444959, 344.23588441256067, 349.4958115401801, 313.99134384505044], [-295.8716674545077, -137.52095681474495, -311.3206960046717, -137.22803040370553, -316.71700064865865]], dtype=float)
print('HalfCheetah-v5/sin_normalizar_ventajas', matrices['HalfCheetah-v5/sin_normalizar_ventajas'].tolist())
[ ]Final returns: HalfCheetah-v5/sin_recorte_normaBrowser
matrices['HalfCheetah-v5/sin_recorte_norma'] = np.array([[973.7234277764454, 1067.690354177105, 964.3815610851125, 1042.8006948625375, 901.7863551768039], [719.9533691102353, 755.1947672831419, 738.2699433873667, 775.5354535862554, 658.4519590731194], [1248.8662623834587, 742.430615254977, 968.7582284892168, -166.9155221778374, 1218.3557692194613], [1676.0716871329407, 1677.2655933280437, 1586.7481563828069, 1594.8003915715703, 1588.4261211683274], [-287.33914344270244, -287.76847200633466, -285.295538461816, -288.2848766732469, -288.9971142363735]], dtype=float)
print('HalfCheetah-v5/sin_recorte_norma', matrices['HalfCheetah-v5/sin_recorte_norma'].tolist())
[ ]Final returns: HalfCheetah-v5/sin_recocido_lrBrowser
matrices['HalfCheetah-v5/sin_recocido_lr'] = np.array([[1187.5273542995792, 1177.3050294423306, 1129.733769219682, 1098.7187696187357, 1160.3230619514827], [741.6709387638156, 672.8820266080769, 742.0465335457611, 723.8420560318943, 735.5269095705969], [-1.7034930340859482, -23.73186604165513, 17.660138088220606, 15.663165502355156, -10.089991246910753], [486.6442129844132, 14.40585018458858, 623.9016944493783, -224.8116537139163, 788.5896942715314], [575.2603357805276, -209.78397698399095, 639.8575346860961, 650.7981130406142, -215.30820441094912]], dtype=float)
print('HalfCheetah-v5/sin_recocido_lr', matrices['HalfCheetah-v5/sin_recocido_lr'].tolist())
[ ]Final returns: HalfCheetah-v5/tasa_altaBrowser
matrices['HalfCheetah-v5/tasa_alta'] = np.array([[1203.9974720280693, 1227.7835943443283, 1159.5829560178922, -207.74976998678707, -217.92694511260373], [1277.0519728693828, 1234.376654331058, 1274.4057180039204, 1274.2984649581495, 1143.8096343314564], [1273.6870183787746, 1192.0958579189, 1256.8040511638956, 1251.3157463158927, 1143.457021394751], [1443.9357739774064, 1499.3335988040965, 1450.9113990273315, 1448.2286319801667, 1513.0236179224214], [1356.2808650534762, 1334.4884935341556, 1285.6347758353163, 1290.9577508673058, 1016.7778215617495]], dtype=float)
print('HalfCheetah-v5/tasa_alta', matrices['HalfCheetah-v5/tasa_alta'].tolist())
[ ]Final returns: HalfCheetah-v5/signo_actor_invertidoBrowser
matrices['HalfCheetah-v5/signo_actor_invertido'] = np.array([[-2310.676811540435, -2307.9541592686705, -2297.022926539312, -2319.834455919015, -2297.688267364823], [-3190.0591822525384, -3206.0586646743072, -3131.5583565038837, -3306.036452439354, -3200.2045872885137], [-2335.7199648243795, -2313.6426290179215, -2329.4651314077687, -2344.8515140213885, -2340.7007868987243], [-1043.7126730945586, -3383.6942327036704, -3671.0443046542046, -1176.646648699193, -1245.8659720566616], [-2315.836967424276, -2352.978482304892, -2326.9803088508693, -2260.605177965761, -2380.0628007481823]], dtype=float)
print('HalfCheetah-v5/signo_actor_invertido', matrices['HalfCheetah-v5/signo_actor_invertido'].tolist())
[ ]Final returns: HalfCheetah-v5/sin_bootstrap_truncamientoBrowser
matrices['HalfCheetah-v5/sin_bootstrap_truncamiento'] = np.array([[-106.73639458393139, -94.75583176980709, -105.5524160267278, -109.67827917811994, -104.91677747019675], [803.4941045929389, 658.263703412165, 1022.8836418706004, 1053.0049690577414, 1137.6344004492553], [705.0318344439089, 663.3184906424397, 667.0402836726378, 644.2517088263099, 608.190888944525], [143.98213945219442, 142.96414987313713, 142.5858659176963, 152.08598277143102, 149.14099038564635], [987.2071911358439, 930.2856969135834, 1036.121099618032, 1000.2077603542792, 964.093370882535]], dtype=float)
print('HalfCheetah-v5/sin_bootstrap_truncamiento', matrices['HalfCheetah-v5/sin_bootstrap_truncamiento'].tolist())
[ ]IQM and intervals: block 1Browser

pesos = np.array([0., .3, .4, .3, 0.])
indices = np.random.default_rng(20261028).integers(5, size=(10000, 5))
print('Bootstrap: réplicas', len(indices), 'IC 95 % por percentiles 2.5 y 97.5, semilla', 20261028,
      'pesos IQM ordenados:', pesos.tolist())

def iqm(x):
    return np.sum(np.sort(x, axis=-1) * pesos, axis=-1)

def recorte_entero(x):
    return np.sort(x, axis=-1)[..., 1:4].mean(axis=-1)

def intervalo(x):
    return np.percentile(x, [2.5, 97.5]).tolist()

def mostrar(clave):
    matriz = matrices[clave]
    medias = matriz.mean(axis=1)
    print(clave, 'medias por actor', medias.tolist(),
          'IQM', float(iqm(medias)), 'IC IQM', intervalo(iqm(medias[indices])),
          'sensibilidad trim_mean', float(recorte_entero(medias)),
          'IC sensibilidad', intervalo(recorte_entero(medias[indices])))
    entorno, variante = clave.split('/')
    if variante == 'control':
        return
    control = matrices[entorno + '/control'].mean(axis=1)
    print(clave, 'diferencia IQM variante - control', float(iqm(medias) - iqm(control)),
          'IC emparejado', intervalo(iqm(medias[indices]) - iqm(control[indices])),
          'diferencia sensibilidad', float(recorte_entero(medias) - recorte_entero(control)),
          'IC sensibilidad', intervalo(recorte_entero(medias[indices]) - recorte_entero(control[indices])))
mostrar('Hopper-v5/control')
mostrar('Hopper-v5/sin_normalizar_obs')
mostrar('Hopper-v5/sin_normalizar_recompensas')
[ ]IQM and intervals: block 2Browser
mostrar('Hopper-v5/sin_normalizar_ventajas')
mostrar('Hopper-v5/sin_recorte_norma')
mostrar('Hopper-v5/sin_recocido_lr')
[ ]IQM and intervals: block 3Browser
mostrar('Hopper-v5/tasa_alta')
mostrar('Hopper-v5/signo_actor_invertido')
mostrar('Hopper-v5/sin_bootstrap_truncamiento')
[ ]IQM and intervals: block 4Browser
mostrar('HalfCheetah-v5/control')
mostrar('HalfCheetah-v5/sin_normalizar_obs')
mostrar('HalfCheetah-v5/sin_normalizar_recompensas')
[ ]IQM and intervals: block 5Browser
mostrar('HalfCheetah-v5/sin_normalizar_ventajas')
mostrar('HalfCheetah-v5/sin_recorte_norma')
mostrar('HalfCheetah-v5/sin_recocido_lr')
[ ]IQM and intervals: block 6Browser
mostrar('HalfCheetah-v5/tasa_alta')
mostrar('HalfCheetah-v5/signo_actor_invertido')
mostrar('HalfCheetah-v5/sin_bootstrap_truncamiento')

The next two cells print the rounded main-table numbers. Difference is variant IQM minus control IQM, and its interval jointly resamples seeds.

[ ]Ablation table: Hopper-v5Browser

def fila_tabla(clave, etiqueta):
    entorno, variante = clave.split('/')
    valores = matrices[clave].mean(axis=1)
    limites = intervalo(iqm(valores[indices]))
    resumen = f"{float(iqm(valores)):.2f} [{limites[0]:.2f}, {limites[1]:.2f}]"
    if variante == 'control':
        diferencia = 'No aplica'
    else:
        base = matrices[entorno + '/control'].mean(axis=1)
        limites_dif = intervalo(iqm(valores[indices]) - iqm(base[indices]))
        diferencia = f"{float(iqm(valores) - iqm(base)):.2f} [{limites_dif[0]:.2f}, {limites_dif[1]:.2f}]"
    print(f"{entorno} | {etiqueta} | {resumen} | {diferencia}")
fila_tabla('Hopper-v5/control', 'Control')
fila_tabla('Hopper-v5/sin_normalizar_obs', 'Sin normalizar observaciones')
fila_tabla('Hopper-v5/sin_normalizar_recompensas', 'Sin normalizar recompensas')
fila_tabla('Hopper-v5/sin_normalizar_ventajas', 'Sin normalizar ventajas')
fila_tabla('Hopper-v5/sin_recorte_norma', 'Sin recorte de norma')
fila_tabla('Hopper-v5/sin_recocido_lr', 'Sin recocido de tasa')
[ ]Ablation table: HalfCheetah-v5Browser
fila_tabla('HalfCheetah-v5/control', 'Control')
fila_tabla('HalfCheetah-v5/sin_normalizar_obs', 'Sin normalizar observaciones')
fila_tabla('HalfCheetah-v5/sin_normalizar_recompensas', 'Sin normalizar recompensas')
fila_tabla('HalfCheetah-v5/sin_normalizar_ventajas', 'Sin normalizar ventajas')
fila_tabla('HalfCheetah-v5/sin_recorte_norma', 'Sin recorte de norma')
fila_tabla('HalfCheetah-v5/sin_recocido_lr', 'Sin recocido de tasa')