Dogs don't defecate in the floor to be naughty, so rather than take it personally, reinforce basic housetraining fundamentals and remain unemotional while dealing with your dog. Punishing your dog, through screaming or rubbing his nose in the accident, will not fix the issue, and may make it worse.
Look for medical problems. A visit to the vet should be your first stop if your dog suddenly starts soiling in the house.
Consider a change in diet. If his stool is loose, his food may not be agreeing with him and he will have trouble waiting to go outside.
Clean up accidents with an odor neutralizer. Picking up the mess and even wiping the floor with an all-purpose cleaner or cleaning with carpet shampoo will not eliminate the odor, making it an attractive target for your pup. Use a cleaner specifically designed for pet accidents, containing enzymes to neutralize odors.
Keep your dog on a short leash. He needs to be within your line of sight when he is loose in the house. You need to catch him before he has an accident and get him outside. If you can't watch him, put him in his crate.
Watch your dog while he is outside. Even if you have a fenced yard, walk outside with your dog when he goes out. This way you can be sure he is actually using the bathroom when he is outside and not playing, sniffing or digging holes. When he does his business, praise him and give him a treat.
Provide freedom gradually. Once you feel your dog is over the habit of defecating on the floor, you can gradually provide him with a little more freedom. You may want to confine him to particular rooms while you are gone, or start by leaving him out for short periods of time.