def thiels_U(ys_true=None, ys_pred=None, display_equation=True,
    display_table=True):
    """Calculate's Thiel's U metric for forecasting accuracy.
    Accepts true values and predicted values.
    Returns Thiel's U"""
    from IPython.display import Markdown, Latex, display
    import numpy as np
    display(Markdown(''))
    eqn = (
        ' $$U = \\sqrt{\\frac{ \\sum_{t=1 }^{n-1}\\left(\\frac{\\bar{Y}_{t+1} - Y_{t+1}}{Y_t}\\right)^2}{\\sum_{t=1 }^{n-1}\\left(\\frac{Y_{t+1} - Y_{t}}{Y_t}\\right)^2}}$$'
        )
    markdown_explanation = """|Thiel's U Value | Interpretation |
    | --- | --- |
    | <1 | Forecasting is better than guessing| 
    | 1 | Forecasting is about as good as guessing| 
    |>1 | Forecasting is worse than guessing| 
"""
    if display_equation and display_table:
        display(Latex(eqn), Markdown(markdown_explanation))
    elif display_equation:
        display(Latex(eqn))
    elif display_table:
        display(Markdown(markdown_explanation))
    if ys_true is None and ys_pred is None:
        return
    num_list = []
    denom_list = []
    for t in range(len(ys_true) - 1):
        num_exp = (ys_pred[t + 1] - ys_true[t + 1]) / ys_true[t]
        num_list.append([num_exp ** 2])
        denom_exp = (ys_true[t + 1] - ys_true[t]) / ys_true[t]
        denom_list.append([denom_exp ** 2])
    U = np.sqrt(np.sum(num_list) / np.sum(denom_list))
    return U
