def predict_data_files(ts_paths, features_to_use, model,
                       custom_features_script=None):
    """Generate features from new TS data and perform model prediction.

    Generates features for new time series file, loads saved
    estimator model, calculates target predictions with extracted
    features, and returns a dictionary containing a list of target
    prediction probabilities, a string containing HTML markup for a
    table containing a list of the results, the time-series data itself
    used to generate features, and a dictionary of the features
    extracted. The respective dict keys of the above-mentioned values
    are: "pred_results", "results_str", "ts_data", "features_dict".

    Parameters
    ----------
    ts_paths : str
        Path to netCDF files containing seriealized TimeSeries objects to be
        used in prediction.
    features_to_use : list of str
        List of features to extract for new time series data
    model : scikit-learn model
        Model to use for making predictions on new input time series
    custom_features_script : str, optional
        Path to custom features script to be used in feature
        generation. Defaults to None.

    Returns
    -------
    dict
        Returns dictionary whose keys are the file names of the
        individual time-series data files used in prediction and whose
        corresponding values are dictionaries with the following
        key-value pairs:

            - "results_str": String containing table listing results in markup.
            - "ts_data": The original time-series data provided.
            - "features_dict": A dictionary containing the generated features.
            - "pred_results": A list of lists, each containing one of the
              most-probable targets and its probability.
    """
    new_featureset = featurize.featurize_data_files(ts_paths,
                                                    features_to_use=features_to_use,
                                                    custom_script_path=custom_features_script)

    # Covert to DataFrame so we can treat 1d/2d predictions in the same way
    preds_df = pd.DataFrame(model_predictions(new_featureset, model))

    # TODO for now, all time series data is passed to the front end for
    # plotting; should remove once plots are generated by the backend
    results_dict = {}
    feature_df = build_model.rectangularize_featureset(new_featureset)
    all_time_series = {util.shorten_fname(ts_path):
                       time_series.from_netcdf(ts_path)
                       for ts_path in ts_paths}
    all_ts_data = {fname: np.vstack((ts.time, ts.measurement, ts.error))
                   for fname, ts in all_time_series.items()}
    results_dict = {fname: {"results_str": "",
                            "ts_data": all_ts_data[fname],
                            "features_dict": feature_df.loc[fname].to_dict(),
                            "pred_results": (list(row.sort_values(inplace=False,
                                                 ascending=False).iteritems())
                                             if 1 > len(row) else row)}
                    for fname, row in preds_df.iterrows()}

    return results_dict
dataset/ETHPy150Open cesium-ml/cesium/cesium/predict.py/predict_data_files/swapped operands of `>`