src/perceptron/NeuralNetwork/NeuralNetwork.py
def train(self, epochs: int, input_set: Union[list, np.ndarray],
              predicted_outputs: Union[list, np.ndarray], learning_rate: float = 1,
              logger: Logger = None, log_rate: int = 1) -> np.ndarray:
        """
        Trains neural network.

        Parameters
        ----------
        epochs : int
            Number of epochs.
        input_set : list or NDArray
            Your train set.
        predicted_outputs : list or NDArray
            Outputs of train set. It's length must be same as length of train set.
        learning_rate : float
            It changes speed of learning.
            Lower value leads to lower changes of weights and slower learning.
        logger : logging.Logger
            To use it import logging from standard library.
        log_rate : int
            Number of log outputs during training.

        Returns
        -------
        NDArray with loss values per iteration.

        Notes
        -----
        Logging level should be logging.INFO.
        """
        self.learning_rate = learning_rate
        loss_per_iteration = []
        for iter in range(epochs):
            error = self.__backward(input_set, predicted_outputs)
            loss = np.average(np.abs(error))
            loss_per_iteration.append(loss)

            # Logging
            if (isinstance(logger, Logger) and
                (iter + 1) % floor(epochs / log_rate) == epochs % floor(epochs / log_rate) and
                    iter >= epochs % log_rate):
                logger.info(
                    f"Iteration: {iter + 1}/{epochs} ({format((iter + 1) / epochs, '.1%')}) | Loss: {loss}")

        return np.array(loss_per_iteration)

        Trains neural network.

        Parameters
        ----------
        epochs : int
            Number of epochs.
        input_set : list or NDArray
            Your train set.
        predicted_outputs : list or NDArray
            Outputs of train set. It's length must be same as length of train set.
        learning_rate : float
            It changes speed of learning.
            Lower value leads to lower changes of weights and slower learning.
        logger : logging.Logger
            To use it import logging from standard library.
        log_rate : int
            Number of log outputs during training.

        Returns
        -------
        NDArray with loss values per iteration.

        Notes
        -----
        Logging level should be logging.INFO.
        
Trains neural network.
Parameters

epochs : int
Number of epochs.
input_set : list or NDArray
Your train set.
predicted_outputs : list or NDArray
Outputs of train set. It's length must be same as length of train set.
learning_rate : float
It changes speed of learning.
Lower value leads to lower changes of weights and slower learning.
logger : logging.Logger
To use it import logging from standard library.
log_rate : int
Number of log outputs during training.

Returns

NDArray with loss values per iteration.

Notes

Logging level should be logging.INFO.
Trains neural network . Parameters epochs : int Number of epochs . input_set : list or NDArray Your train set . predicted_outputs : list or NDArray Outputs of train set . It ' s length must be same as length of train set . learning_rate : float It changes speed of learning . Lower value leads to lower changes of weights and slower learning . logger : logging . Logger To use it import logging from standard library . log_rate : int Number of log outputs during training . Returns NDArray with loss values per iteration . Notes Logging level should be logging . INFO .
def train(self, epochs: int, input_set: Union[list, np.ndarray],
              predicted_outputs: Union[list, np.ndarray], learning_rate: float = 1,
              logger: Logger = None, log_rate: int = 1) -> np.ndarray:
        self.learning_rate = learning_rate
        loss_per_iteration = []
        for iter in range(epochs):
            error = self.__backward(input_set, predicted_outputs)
            loss = np.average(np.abs(error))
            loss_per_iteration.append(loss)
            if (isinstance(logger, Logger) and
                (iter + 1) % floor(epochs / log_rate) == epochs % floor(epochs / log_rate) and
                    iter >= epochs % log_rate):
                logger.info(
                    f"Iteration: {iter + 1}/{epochs} ({format((iter + 1) / epochs, '.1%')}) | Loss: {loss}")
        return np.array(loss_per_iteration)
def train ( self , epochs : int , input_set : Union [ list , np . ndarray ] , predicted_outputs : Union [ list , np . ndarray ] , learning_rate : float = 1 , logger : Logger = None , log_rate : int = 1 ) -> np . ndarray : self . learning_rate = learning_rate loss_per_iteration = [ ] for iter in range ( epochs ) : error = self . __backward ( input_set , predicted_outputs ) loss = np . average ( np . abs ( error ) ) loss_per_iteration . append ( loss ) if ( isinstance ( logger , Logger ) and ( iter + 1 ) % floor ( epochs / log_rate ) == epochs % floor ( epochs / log_rate ) and iter >= epochs % log_rate ) : logger . info ( f"Iteration: {iter + 1}/{epochs} ({format((iter + 1) / epochs, '.1%')}) | Loss: {loss}" ) return np . array ( loss_per_iteration )
Trains neural network.
Trains neural network .
"""
        Trains neural network.

        Parameters
        ----------
        epochs : int
            Number of epochs.
        input_set : list or NDArray
            Your train set.
        predicted_outputs : list or NDArray
            Outputs of train set. It's length must be same as length of train set.
        learning_rate : float
            It changes speed of learning.
            Lower value leads to lower changes of weights and slower learning.
        logger : logging.Logger
            To use it import logging from standard library.
        log_rate : int
            Number of log outputs during training.

        Returns
        -------
        NDArray with loss values per iteration.

        Notes
        -----
        Logging level should be logging.INFO.
        """ # Logging
self
epochs
int
input_set
Union[list, np.ndarray]
predicted_outputs
Union[list, np.ndarray]
learning_rate
float
logger
Logger
log_rate
int