def get_scaling_factors(all_truth, all_pred):
    """
    Compute factors to scale each target prediction
    :param all_truth: ground truth
    :param all_pred: predicitons
    :return: scaling factors corresponding to each target
    """
    N, L, C = all_pred.shape
    flat_pred = all_pred.reshape(N * L, C)
    flat_truth = all_truth.reshape(N * L, C)
    truth_per_cell_line_sum = flat_truth.sum(axis=0)
    pred_per_cell_line_sum = flat_pred.sum(axis=0)
    scaling_factors = truth_per_cell_line_sum / pred_per_cell_line_sum
    return scaling_factors