def train_forest(random_forest: list, initial_average_weight: float, x_df: pd.DataFrame, y_df: pd.DataFrame, alpha: float=0.1):
    predictions = (np.ones(len(y_df)) * initial_average_weight)
    residuals = (np.array(y_df['Weight']) - predictions)
    residuals_matrix = [residuals]
    mse_list = [(np.square(residuals).sum() / len(predictions))]
    for tree in random_forest:
        tree.fit(x_df, residuals)
        residuals = tree.predict(x_df)
        residuals_matrix.append(residuals)
        mse_list.append((np.square(residuals).sum() / len(predictions)))
        predictions = (predictions + (alpha * residuals))
        residuals = (np.array(y_df['Weight']) - predictions)
    return (random_forest, predictions, residuals_matrix, mse_list)
def train_forest(random_forest: list, initial_average_weight: float, x_df: pd.DataFrame, y_df: pd.DataFrame, alpha: float=0.1):
    predictions = (np.ones(len(y_df)) * initial_average_weight)
    residuals = (np.array(y_df['Weight']) - predictions)
    residuals_matrix = [residuals]
    mse_list = [(np.square(residuals).sum() / len(predictions))]
    for tree in random_forest:
        tree.fit(x_df, residuals)
        residuals = tree.predict(x_df)
        residuals_matrix.append(residuals)
        mse_list.append((np.square(residuals).sum() / len(predictions)))
        predictions = (predictions + (alpha * residuals))
        residuals = (np.array(y_df['Weight']) - predictions)
    return (random_forest, predictions, residuals_matrix, mse_list)