Sometimes a when a cat bites you it can be mistaken for aggressive behavior. Be careful in making a judgment that the cat is aggressive. It may be play. If you stroke your cat a little to vigorously for example it may awaken play instinct in your cat. When cats play they bite. Cats are taught to hunt through play.
Sometimes you can stroke your cat gently and she shows she likes it. But after a while without warning she will complain, maybe nip you and walk off. Why does this happen? When your girlfriend comes over to you and cuddles you and then cuddles you some more do you always like it? Do you reach a time limit when you have had enough? You might not be in the mood. Something may have upset you. Even though it is something that is nice you reach a limit. I think that gives a clue as to the answer.
Cats are not as intelligent as humans when measured by our methods for measuring intelligence. That doesn't make them less intelligent in an absolute sense. Their intelligence and skills are parallel to ours but not less than ours.
Once you can tap in to a cats psyche you will understand how they think. They think remarkable like humans on a fundamental level. We are after all both animals on this planet. We are both programmed to survive using our particular skills.
If a cat is aggressive under certain circumstances it will be because of prior experience (i.e. learned by the cat through a bad experience). Usually the experience will have been created by human intervention. Understand what this might have been and avoid creating the same situation. Cat aggression is usually defensive. Don't give her a reason to be defensive.
Learn to understand what makes her tick by empathising with her. Get to understand her habits, likes and dislikes and you will see how similar we are.
Photograph - credit: GrahamlX - creative commons