def classify(df, w):
    """
    Classify result of linear discriminant analysis for different classifiers.
    @param df pandas dataframe;
    @param w dict[classifier: (list of weights, weight threshold)];
    @return df with appended result.
    """

    # get input
    if 'state' in df.columns:
        x = df.drop('state', axis=1).to_numpy(dtype='float64')
    else:
        x = df.to_numpy(dtype='float64')

    # initialize result
    new = df.copy()

    for classifier, wi in w.items():

        # evaluate output
        y = x@wi[0]

        # append output
        new[f'lda_{classifier}'] = y - wi[1]

        # get states
        states = classifier.split('_')

        # append output
        new[f'lda_{classifier}_class'] = [
            states[0] if i > 0 else states[1] for i in y
        ]

    return new