Associative memory and threshold control in neural networks