Rule-based neural networks