Adaptive order local polynomial fitting