A General Framework for Learning Rules From Data