def train_m_step(self, classifier, social_features, prob_e_step, steps, total_epochs, y_test, y_val, start_val):
    theta_i = prob_e_step.copy()
    weights = np.array([])
    iter = 0
    old_theta_i = np.zeros((social_features.shape[0], 1))
    epsilon = 0.001
    y_test = np.argmax(y_test, axis=1)
    y_val = np.argmax(y_val, axis=1)
    while ((LA.norm((theta_i - old_theta_i)) > epsilon) and (iter < total_epochs)):
        old_theta_i = theta_i.copy()
        (theta_i, weights, classifier) = self.nn_pzi_test_val(classifier, social_features, prob_e_step, steps)
        end_val = (start_val + y_val.shape[0])
        theta_i_val = theta_i[start_val:end_val]
        theta_i_test = theta_i[end_val:]
        theta_i_test = np.argmax(theta_i_test, axis=1)
        theta_i_val = np.argmax(theta_i_val, axis=1)
        eval_model_test = accuracy_score(y_test, theta_i_test)
        eval_model_val = accuracy_score(y_val, theta_i_val)
        if ((iter % 10) == 0):
            print('epoch', iter, ' convergence influencer:', LA.norm((theta_i - old_theta_i)), 'val', eval_model_val, 'test', eval_model_test)
        iter += 1
    print('epoch', iter, ' convergence influencer:', LA.norm((theta_i - old_theta_i)), 'val', eval_model_val, 'test', eval_model_test)
    return (theta_i, classifier, weights)
def train_m_step(self, classifier, social_features, prob_e_step, steps, total_epochs, y_test, y_val, start_val):
    theta_i = prob_e_step.copy()
    weights = np.array([])
    iter = 0
    old_theta_i = np.zeros((social_features.shape[0], 1))
    epsilon = 0.001
    y_test = np.argmax(y_test, axis=1)
    y_val = np.argmax(y_val, axis=1)
    while ((LA.norm((theta_i - old_theta_i)) > epsilon) and (iter < total_epochs)):
        old_theta_i = theta_i.copy()
        (theta_i, weights, classifier) = self.nn_pzi_test_val(classifier, social_features, prob_e_step, steps)
        end_val = (start_val + y_val.shape[0])
        theta_i_val = theta_i[start_val:end_val]
        theta_i_test = theta_i[end_val:]
        theta_i_test = np.argmax(theta_i_test, axis=1)
        theta_i_val = np.argmax(theta_i_val, axis=1)
        eval_model_test = accuracy_score(y_test, theta_i_test)
        eval_model_val = accuracy_score(y_val, theta_i_val)
        if ((iter % 10) == 0):
            print('epoch', iter, ' convergence influencer:', LA.norm((theta_i - old_theta_i)), 'val', eval_model_val, 'test', eval_model_test)
        iter += 1
    print('epoch', iter, ' convergence influencer:', LA.norm((theta_i - old_theta_i)), 'val', eval_model_val, 'test', eval_model_test)
    return (theta_i, classifier, weights)