original_docstring: Generate maximum a posteriori neural network predictions.
  
      Args:
          weight_prior (tfp.distribution): Prior probability for the weights
          bias_prior (tfp.distribution): Prior probability for the biases
          [X/y_train/test] (np.arrays): Train and test sets
      
docstring: Generate maximum a posteriori neural network predictions.
docstring_tokens: Generate maximum a posteriori neural network predictions .
code: def map_predict(weight_prior, bias_prior, X_train, y_train, X_test, y_test):
      """Generate maximum a posteriori neural network predictions.
  
      Args:
          weight_prior (tfp.distribution): Prior probability for the weights
          bias_prior (tfp.distribution): Prior probability for the biases
          [X/y_train/test] (np.arrays): Train and test sets
      """
  
      log_prob_tracers = (
          bnn.tracer_factory(X_train, y_train),
          bnn.tracer_factory(X_test, y_test),
      )
  
      n_features = X_train.shape[-1]
      nodes = get_nodes_per_layer(n_features, net_taper=(1, 0.5, 0.3))
      random_initial_state = bnn.get_random_initial_state(weight_prior, bias_prior, nodes)
  
      trace, log_probs = get_map_trace(
          bnn.target_log_prob_fn_factory(weight_prior, bias_prior, X_train, y_train),
          random_initial_state,
          n_iter=5000,
          callbacks=log_prob_tracers,
      )
      # Initial configuration for HMC.
      best_params = get_best_map_state(trace, log_probs)
  
      model = bnn.build_net(best_params)
      y_pred, y_var = model(X_test, training=False)
      return y_pred.numpy(), y_var.numpy(), log_probs, best_params
code_tokens: def map_predict ( weight_prior , bias_prior , X_train , y_train , X_test , y_test ) : log_prob_tracers = ( bnn . tracer_factory ( X_train , y_train ) , bnn . tracer_factory ( X_test , y_test ) , ) n_features = X_train . shape [ - 1 ] nodes = get_nodes_per_layer ( n_features , net_taper = ( 1 , 0.5 , 0.3 ) ) random_initial_state = bnn . get_random_initial_state ( weight_prior , bias_prior , nodes ) trace , log_probs = get_map_trace ( bnn . target_log_prob_fn_factory ( weight_prior , bias_prior , X_train , y_train ) , random_initial_state , n_iter = 5000 , callbacks = log_prob_tracers , ) best_params = get_best_map_state ( trace , log_probs ) model = bnn . build_net ( best_params ) y_pred , y_var = model ( X_test , training = False ) return y_pred . numpy ( ) , y_var . numpy ( ) , log_probs , best_params
short_docstring: Generate maximum a posteriori neural network predictions.
short_docstring_tokens: Generate maximum a posteriori neural network predictions .
comment: """Generate maximum a posteriori neural network predictions.
  
      Args:
          weight_prior (tfp.distribution): Prior probability for the weights
          bias_prior (tfp.distribution): Prior probability for the biases
          [X/y_train/test] (np.arrays): Train and test sets
      """$SEP$# Initial configuration for HMC.