Explain key machine learning concepts and how you would implement them using Python.
Implement binary logistic regression from scratch without machine learning libraries. Your function must train weights with batch gradient descent and return class predictions for test rows.
Use def train_logistic_regression(X_train, y_train, X_test, learning_rate, epochs):. X_train and X_test are lists of numeric feature rows, y_train contains binary labels, and the function returns a list of 0 or 1 predictions.
def train_logistic_regression(X_train, y_train, X_test, learning_rate, epochs):