def predict(test_data, results, model_name):
    model_params = DataFrame(results[model_name][0].params)
    formula = results[model_name][1]

    # Create regression friendly test DataFrame
    yt, xt = dmatrices(formula, data=test_data, return_type='dataframe')
    xt, model_params = ka_df.get_dataframes_intersections(xt, xt.columns,
                                                model_params, model_params.index)
    # Convert to NumPy arrays for performance
    model_params = np.asarray(model_params)
    yt = np.asarray(yt)
    yt = yt.ravel()
    xt = np.asarray(xt)

    # Use our models to create predictions
    row, col = xt.shape
    model_parameters = model_params.ravel()
    model_array = list((model_parameters for parameter in xrange(row)))
    model_array = np.asarray(model_array)

    # Multiply matrix together
    predictions = np.multiply(xt, model_array)
    predictions = np.sum(predictions, axis=1)
    return predictions
Mock gen_token method
dataset/ETHPy150Open agconti/KaggleAux/kaggleaux/modeling.py/predict--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/modules/publish_test.py/SAuth.gen_token