def weight_bin_vectors(bin_vecs, bin_name, results,
                       column='Weighted Average Vector'):
    """Compute frequency-weighted class vectors from output.

    Parameters
    ----------
    bin_vecs : pandas.DataFrame
        DataFrame loaded from classvecs.pkl.
    bin_name : str
        Name of bin used to stratify vector dataset.
    results : pandas.DataFrame
        DataFrame loaded from results.pkl.
    column : str (default: 'Weighted Average Vector')
        Name of new column containing vector outputs.

    Returns
    -------
    pandas.DataFrame
        DataFrame containing new vector column.

    """
    train = results[~results["Test Set"]]

    weighted_vecs = []
    for a_name, a_vec in zip(bin_vecs[bin_name],
                             bin_vecs['Average Vector']):
        size = len(train[train[bin_name] == a_name])
        weight = size / len(train)
        weighted_vec = weight * a_vec
        weighted_vecs.append(weighted_vec)

    bin_vecs[column] = weighted_vecs

    return bin_vecs