airbornegeo.trend

Contents

airbornegeo.trend#

trend(data_to_fit, cols_to_fit, data_to_predict, cols_to_predict, degree, intersection_weight_col=None)[source]#

Fit a polynomial trend using scikit-learn and predict values at new locations.

The polynomial degree is automatically reduced if there are insufficient observations to constrain the requested model.

Parameters:
  • data_to_fit (DataFrame) – Data used to fit the polynomial.

  • cols_to_fit (list[str]) – Two column names specifying the independent and dependent variables, respectively.

  • data_to_predict (DataFrame) – DataFrame containing the coordinates where the fitted trend should be evaluated.

  • cols_to_predict (list[str]) – Two column names specifying the predictor variable and the output column that will receive the predicted values.

  • degree (int) – Requested polynomial degree.

  • intersection_weight_col (str | None) – Column containing sample weights for weighted least-squares fitting.

Returns:

Copy of data_to_predict containing the predicted trend.

Return type:

DataFrame