learn relations and function