Exemplo n.º 1
0
    n_networks=n_networks,
    input_shape=[1],
    layer_units=layer_units,
    layer_activations=layer_activations,
    learning_rate=lr_schedule,
    seed=seed,
)

ensemble.fit(x_train=x_train,
             y_train=y_train,
             batch_size=batch_size,
             epochs=epochs,
             verbose=0)

# %%
prediction = ensemble.predict(x_plot)  # Mixture Of Gaussian prediction
fig, ax = plt.subplots(figsize=figsize)
plot_moment_matched_predictive_normal_distribution(
    x_plot=_x_plot,
    predictive_distribution=prediction,
    x_train=_x_train,
    y_train=y_train,
    y_ground_truth=y_ground_truth,
    fig=fig,
    ax=ax,
    y_lim=y_lim,
    title="Ensemble of ten MAP networks",
    save_path=figure_dir.joinpath(
        f"ensemble_moment_matched_{experiment_name}.pdf"),
)
Exemplo n.º 2
0
    layer_units=layer_units,
    layer_activations=layer_activations,
    initial_unconstrained_scale=initial_unconstrained_scale,
    transform_unconstrained_scale_factor=transform_unconstrained_scale_factor,
    preprocess_x=preprocess_x,
    preprocess_y=preprocess_y,
    learning_rate=lr_schedule,
    names=[None, "feature_extractor", "output"],
    seed=0,
)
ensemble.fit(x_train=x_train,
             y_train=y_train,
             batch_size=batch_size,
             epochs=epochs,
             verbose=0)
prediction = ensemble.predict(x_plot)
plot_moment_matched_predictive_normal_distribution(
    x_plot=x_plot,
    predictive_distribution=prediction,
    x_train=x_train,
    y_train=y_train,
    y_ground_truth=y_ground_truth,
    y_lim=y_lim,
)

# %%
llb_ensemble = LLBEnsemble(
    input_shape=[1],
    layer_units=layer_units,
    layer_activations=layer_activations,
    initial_unconstrained_scale=initial_unconstrained_scale,