Design a function utilizing a learning algorithm with the error-correction learning rule. The function shall be robust,
Question:
Design a function utilizing a learning algorithm with the error-correction learning rule. The function shall be robust, so it should not depend on the length of the input, the size of a learning set, and the inputs type (binary or real). Inputs and desired outputs should be transferred to the function as its arguments.
• This function shall also have a flag-argument determining whether to generate starting weights randomly (in such a case starting weights should be generated inside the function as random numbers belonging to the interval [-0.5, 0.5]) or to start learning from the external weights (in the latter case a starting weighting vector shall be another calling argument, respectively).
• The function shall also have an argument specifying a limit for the maximum number of the learning iterations to avoid falling in an infinite loop for input/output mappings, which are non-linearly separable.
• The function shall return a weighting vector.