Algorithms and frameworks for preventing privacy leakage and overfitting in machine learning