I'm not sure which act or scene you are referring to; you mention Act 4 in the question, and scene 4 in the question tags. I will assume that you mean Act 4, scene 1...if I am wrong, then let me know and I can help you out with the appropriate scene.
Act 4 scene 1 is right after Hamlet has killed Polonius, and given a pretty hard verbal lashing to his mother. Gertrude comes out of her room as Hamlet pulls the corpse of Polonius away. The king and Rosencrantz and Guildenstern enter, and Gertrude asks Rosencrantz and Guildenstern to leave, so that she may speak privately with the king. This is one way of shielding Hamlet; she doesn't want his doings and state of mind advertised everywhere, or his friends knowing what is going on. She is trying to shield Hamlet from vicous gossip and rumors. Gertrude further tries to shield her son by blaming his murder of Polonius on "his very madness," and that he feels bad and "weeps for what is done" (ll. 25-27). This helps paint Hamlet's murder in a more favorable light, and shields him from appearing to be a ruthless and cunning murderer. The king has already expressed wariness and concern for Hamlet's state of mind, and now Hamlet has committed murder. There could be serious consequences for them if this is known in the kingdom; the king's own nephew murdering one of the trusted advisors to the kingdom? Awful! And with Claudius so new to the throne, he wants to keep his reputation in tact. Gertrude shields the potential fierceness of Claudius' reaction by blaming Hamlet's behavior on madness. He couldn't help it, he is just crazy. But he really does feel bad about it anyway...so go easy on him.
I hope that those thoughts help; good luck!