nip.parameters.message_regression.MessageRegressionParameters#
- class nip.parameters.message_regression.MessageRegressionParameters(enabled: bool = False, agents: list[str] | None = None, regression_method: Literal['mlp', 'cnn'] = 'mlp', test_size: float = 0.2, reset_on_fit: bool = True, mlp_num_layers: int = 2, mlp_hidden_size: int = 64, mlp_activation: Literal['relu', 'tanh', 'sigmoid'] = 'relu', mlp_num_epochs: int = 10, mlp_batch_size: int = 512, mlp_learning_rate: float = 0.001)[source]#
Additional parameters for doing regression analysis on the messages.
This allows doing testing to what extent the label can be inferred purely from the first message sent an agent, without considering the other data.
This is useful in the shared reward setting to see if the prover is simply communicating the label to the verifier. If this is the case, we expect to be able to recover it just from the messages.
- Parameters:
enabled (bool) – Whether to do regression analysis on the messages.
agents (list of str) – The agents to do regression analysis on. If None, do it on all agents.
regression_method (MessageRegressionMethodType) – The method to use to do the regression.
test_size (float) – The proportion of the message data to use for testing.
reset_on_fit (bool) – Whether to reset the regressor on each fit (i.e. to fit it from scratch).
mlp_num_layers (int) – The number of layers in the MLP, when using.
mlp_hidden_size (int) – The hidden size of the MLP, when using.
mlp_activation (ActivationType) – The activation function to use in the MLP, when using.
mlp_num_epochs (int) – The number of epochs to train the MLP for, when using.
mlp_batch_size (int) – The batch size to use when training the MLP, when using.
mlp_learning_rate (float) – The learning rate to use when training the MLP, when using.
Methods Summary
__eq__
(other)Return self==value.
__init__
([enabled, agents, ...])__repr__
()Return repr(self).
_get_param_class_from_dict
(param_dict)Try to get the parameter class from a dictionary of serialised parameters.
Construct a set of basic parameters for testing.
from_dict
(params_dict[, ignore_extra_keys])Create a parameters object from a dictionary.
get
(address)Get a value from the parameters object using a dot-separated address.
to_dict
()Convert the parameters object to a dictionary.
Attributes
agents
enabled
mlp_activation
mlp_batch_size
mlp_hidden_size
mlp_learning_rate
mlp_num_epochs
mlp_num_layers
regression_method
reset_on_fit
test_size
Methods
- __eq__(other)#
Return self==value.
- __init__(enabled: bool = False, agents: list[str] | None = None, regression_method: Literal['mlp', 'cnn'] = 'mlp', test_size: float = 0.2, reset_on_fit: bool = True, mlp_num_layers: int = 2, mlp_hidden_size: int = 64, mlp_activation: Literal['relu', 'tanh', 'sigmoid'] = 'relu', mlp_num_epochs: int = 10, mlp_batch_size: int = 512, mlp_learning_rate: float = 0.001) None #
- __repr__()#
Return repr(self).
- classmethod _get_param_class_from_dict(param_dict: dict) type[ParameterValue] | None [source]#
Try to get the parameter class from a dictionary of serialised parameters.
- Parameters:
param_dict (dict) – A dictionary of parameters, which may have come from a
to_dict
method. This dictionary may contain a_type
key, which is used to determine the class of the parameter.- Returns:
param_class (type[ParameterValue] | None) – The class of the parameter, if it can be determined.
- Raises:
ValueError – If the class specified in the dictionary is not a valid parameter class.
- classmethod construct_test_params() BaseHyperParameters [source]#
Construct a set of basic parameters for testing.
- classmethod from_dict(params_dict: dict, ignore_extra_keys: bool = False) BaseHyperParameters [source]#
Create a parameters object from a dictionary.