TfELM
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
WELMLayer.WELMLayer Class Reference
Inheritance diagram for WELMLayer.WELMLayer:

Public Member Functions

 __init__ (self, number_neurons, activation='tanh', act_params=None, C=1.0, ELMOptimizer beta_optimizer=None, is_orthogonalized=False, weight_method='wei-1', weight_param=4, **params)
 
 fit (self, x, y)
 
 predict (self, x)
 
 predict_proba (self, x)
 
 calc_output (self, x)
 
 __str__ (self)
 
 count_params (self)
 
 to_dict (self)
 
 load (cls, attributes)
 

Public Attributes

 weight_method
 
 weight_param
 
 input
 
 beta
 
 error_history
 
 feature_map
 
 output
 
 number_neurons
 
 activation_name
 
 act_params
 
 C
 
 is_orthogonalized
 
 alpha
 
 bias
 

Detailed Description

    Weighted Extreme Learning Machine Layer.

    This layer extends the functionality of the ELMLayer by incorporating weighted samples during training.

    Args:
    -----------
        number_neurons (int): The number of neurons in the hidden layer.
        activation (str, optional): The activation function to use. Defaults to 'tanh'.
        act_params (dict, optional): Additional parameters for the activation function. Defaults to None.
        C (float, optional): Regularization parameter. Defaults to 1.0.
        beta_optimizer (ELMOptimizer, optional): Optimizer for updating output weights. Defaults to None.
        is_orthogonalized (bool, optional): Whether to orthogonalize the hidden layer weights. Defaults to False.
        weight_method (str, optional): Method for computing sample weights. Defaults to 'wei-1'. Oprions: 'wei-1',
        'wei-2', 'ban-1', 'ban-decay'
        weight_param (int, optional): Parameter for weight computation (if applicable). Defaults to 4.
        **params: Additional parameters.

    Attributes:
    -----------
        weight_method (str): Method for computing sample weights.
        weight_param (int): Parameter for weight computation (if applicable).

    Methods:
    -----------
        fit(x, y): Fit the layer to the input-output pairs.
        predict(x): Predict the output for input data.
        predict_proba(x): Predict class probabilities for input data.
        calc_output(x): Calculate the output for input data.
        count_params(): Count the number of trainable and non-trainable parameters.
        to_dict(): Convert layer attributes to a dictionary.
        load(attributes): Load layer attributes from a dictionary.

    Example:
    -----------
    >>> layer = WELMLayer(number_neurons=1000, activation='tanh', weight_method='wei-1')
    >>> model = ELMModel(layer)

Member Function Documentation

◆ __str__()

WELMLayer.WELMLayer.__str__ ( self)
    String representation of the layer.

    Returns:
    -----------
        str: String representation.

◆ calc_output()

WELMLayer.WELMLayer.calc_output ( self,
x )
    Calculate the output for input data.

    Args:
    -----------
        x (tf.Tensor): Input data.

    Returns:
    -----------
        tf.Tensor: Calculated output.

◆ count_params()

WELMLayer.WELMLayer.count_params ( self)
    Count the number of trainable and non-trainable parameters.

    Returns:
    -----------
        dict: Dictionary containing counts of trainable and non-trainable parameters.

◆ fit()

WELMLayer.WELMLayer.fit ( self,
x,
y )
    Fit the WELMLayer to the input-output pairs.

    Args:
    -----------
        x (tf.Tensor): Input data.
        y (tf.Tensor): Output data.

    Returns:
    -----------
        None

    Example:
    -----------
    >>> layer = WELMLayer(number_neurons=1000, activation='tanh', weight_method='wei-1')
    >>> layer.build(X.shape)
    >>> layer.fit(X_train, y_train)

◆ load()

WELMLayer.WELMLayer.load ( cls,
attributes )
    Load layer attributes from a dictionary.

    Args:
    -----------
        attributes (dict): Dictionary containing layer attributes.

    Returns:
    -----------
        WELMLayer: Loaded WELMLayer instance.

◆ predict()

WELMLayer.WELMLayer.predict ( self,
x )
    Predict the output for input data.

    Args:
    -----------
        x (tf.Tensor): Input data.

    Returns:
    -----------
        tf.Tensor: Predicted output.

    Example:
    -----------
    >>> layer = WELMLayer(number_neurons=1000, activation='tanh', weight_method='wei-1')
    >>> layer.build(X.shape)
    >>> layer.fit(X_train, y_train)
    >>> pred = layer.predict(X_test)

◆ predict_proba()

WELMLayer.WELMLayer.predict_proba ( self,
x )
    Predict class probabilities for input data.

    Args:
    -----------
        x (tf.Tensor): Input data.

    Returns:
    -----------
        tf.Tensor: Predicted class probabilities.

    Example:
    -----------
    >>> layer = WELMLayer(number_neurons=1000, activation='tanh', weight_method='wei-1')
    >>> layer.build(X.shape)
    >>> layer.fit(X_train, y_train)
    >>> pred = layer.predict_proba(X_test)

◆ to_dict()

WELMLayer.WELMLayer.to_dict ( self)
    Convert layer attributes to a dictionary.

    Returns:
    -----------
        dict: Dictionary containing layer attributes.

The documentation for this class was generated from the following file: