rspamd_fannThis module enables fann interaction in rspamd
Please note, that this module works merely if you have ENABLE_FANN=ON option
definition when building rspamd
Functions:
Methods:
The module rspamd_fann defines the following functions.
rspamd_fann.is_enabled()Checks if fann is enabled for this rspamd build
Parameters:
No parameters
Returns:
{boolean}: true if fann is enabledBack to module description.
rspamd_fann.create(nlayers, [layer1, ... layern])Creates new neural network with nlayers that contains layer1…layern
neurons in each layer
Parameters:
nlayers {number}: number of layerslayerI {number}: number of neurons in each layerReturns:
{fann}: fann objectBack to module description.
rspamd_fann.create_full(params)Creates new neural network with parameters:
layers {table/numbers}: table of layers in form: {N1, N2, N3 … Nn} where N is number of neurons in a layeractivation_hidden {string}: activation function type for hidden layers (tanh by default)activation_output {string}: activation function type for output layer (tanh by default)sparsed {float}: create sparsed ANN, where number is a coefficient for sparsinglearn {string}: learning algorithm (quickprop, rprop or incremental)randomize {boolean}: randomize weights (true by default)Parameters:
No parameters
Returns:
{fann}: fann objectBack to module description.
rspamd_fann.load(file)Loads neural network from the file
Parameters:
file {string}: filename where fann is storedReturns:
{fann}: fann objectBack to module description.
rspamd_fann.load_data(data)Loads neural network from the data
Parameters:
file {string}: filename where fann is storedReturns:
{fann}: fann objectBack to module description.
rspamd_fann:data()Returns serialized neural network
Parameters:
No parameters
Returns:
{rspamd_text}: fann dataBack to module description.
The module rspamd_fann defines the following methods.
rspamd_fann:get_inputs()Returns number of inputs for neural network
Parameters:
No parameters
Returns:
{number}: number of inputsBack to module description.
rspamd_fann:get_outputs()Returns number of outputs for neural network
Parameters:
No parameters
Returns:
{number}: number of outputsBack to module description.
rspamd_fann:get_mse()Returns mean square error for ANN
Parameters:
No parameters
Returns:
{number}: MSE valueBack to module description.
rspamd_fann:get_layers()Returns array of neurons count for each layer
Parameters:
No parameters
Returns:
{table/number}: table with number ofr neurons in each layerBack to module description.
rspamd_fann:save(fname)Save fann to file named ‘fname’
Parameters:
fname {string}: filename to save fann intoReturns:
{boolean}: true if ann has been savedBack to module description.
Back to top.