uncoverml.optimise package

Submodules

uncoverml.optimise.models module

12-05-2020 15:50:35 AEST - brenainn.moushall@ga.gov.au

Note

Only some models are compatible with optimisation. This is because models must be structued in a way compatible with scikit-learn’s GridSearchCV. This involves:

  • having all arguments explicitly listed in the __init__ signature (no varargs)

  • having the expected functions (fit, predict, etc.)

  • implemeting the get_params and set_params functions defined by Base Estimator

# TODO: refactor all models to have an interface compatible with GCV # and consolidate to a single module.

class uncoverml.optimise.models.Huber(epsilon=1.35, max_iter=100, alpha=0.0001, warm_start=False, fit_intercept=True, tol=1e-05, target_transform='identity')

Bases: uncoverml.optimise.models.TransformMixin, uncoverml.models.TagsMixin, sklearn.linear_model._huber.HuberRegressor

Robust HuberRegressor

class uncoverml.optimise.models.TransformMixin

Bases: object

fit(X, y, *args, **kwargs)
predict(X, *args, **kwargs)
class uncoverml.optimise.models.TransformPredictDistMixin

Bases: uncoverml.optimise.models.TransformMixin

predict_dist(X, interval=0.95, *args, **kwargs)
class uncoverml.optimise.models.TransformedElasticNet(alpha=1.0, l1_ratio=0.5, fit_intercept=True, normalize=False, precompute=False, max_iter=1000, copy_X=True, tol=0.0001, warm_start=False, positive=False, random_state=None, selection='cyclic', target_transform='identity')

Bases: uncoverml.optimise.models.TransformMixin, uncoverml.models.TagsMixin, sklearn.linear_model._coordinate_descent.ElasticNet

Linear regression with combined L1 and L2 priors as regularizer. Suitable for small learning jobs.

class uncoverml.optimise.models.TransformedForestRegressor(target_transform='identity', n_estimators=10, criterion='mse', max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features='auto', max_leaf_nodes=None, min_impurity_split=1e-07, bootstrap=True, oob_score=False, n_jobs=1, random_state=None, verbose=0, warm_start=False)

Bases: uncoverml.optimise.models.TransformPredictDistMixin, uncoverml.models.RandomForestRegressor, uncoverml.models.TagsMixin

class uncoverml.optimise.models.TransformedGPRegressor(target_transform='identity', kernel=None, alpha=1e-10, optimizer='fmin_l_bfgs_b', n_restarts_optimizer=0, normalize_y=False, copy_X_train=True, random_state=None)

Bases: uncoverml.optimise.models.TransformPredictDistMixin, sklearn.gaussian_process._gpr.GaussianProcessRegressor, uncoverml.models.TagsMixin

predict(X, *args, **kwargs)

Predict using the Gaussian process regression model

We can also predict based on an unfitted model by using the GP prior. In addition to the mean of the predictive distribution, also its standard deviation (return_std=True) or covariance (return_cov=True). Note that at most one of the two can be requested.

Parameters
  • X (sequence of length n_samples) – Query points where the GP is evaluated. Could either be array-like with shape = (n_samples, n_features) or a list of objects.

  • return_std (bool, default: False) – If True, the standard-deviation of the predictive distribution at the query points is returned along with the mean.

  • return_cov (bool, default: False) – If True, the covariance of the joint predictive distribution at the query points is returned along with the mean

Returns

  • y_mean (array, shape = (n_samples, [n_output_dims])) – Mean of predictive distribution a query points

  • y_std (array, shape = (n_samples,), optional) – Standard deviation of predictive distribution at query points. Only returned when return_std is True.

  • y_cov (array, shape = (n_samples, n_samples), optional) – Covariance of joint predictive distribution a query points. Only returned when return_cov is True.

predict_dist(X, interval=0.95, *args, **kwargs)
class uncoverml.optimise.models.TransformedGradientBoost(target_transform='identity', loss='ls', learning_rate=0.1, n_estimators=100, subsample=1.0, criterion='friedman_mse', min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_depth=3, min_impurity_split=1e-07, init=None, random_state=None, max_features=None, alpha=0.9, verbose=0, max_leaf_nodes=None, warm_start=False, presort='auto')

Bases: uncoverml.optimise.models.TransformMixin, sklearn.ensemble._gb.GradientBoostingRegressor, uncoverml.models.TagsMixin

class uncoverml.optimise.models.TransformedOLS(fit_intercept=True, normalize=False, copy_X=True, n_jobs=1, target_transform='identity')

Bases: uncoverml.optimise.models.TransformMixin, uncoverml.models.TagsMixin, sklearn.linear_model._base.LinearRegression

OLS. Suitable for small learning jobs.

class uncoverml.optimise.models.TransformedSGDApproxGP(kernel='rbf', nbases=50, lenscale=1.0, var=1.0, regulariser=1.0, ard=True, maxiter=3000, batch_size=10, alpha=0.01, beta1=0.9, beta2=0.99, epsilon=1e-08, random_state=None, target_transform='identity')

Bases: uncoverml.optimise.models.TransformMixin, uncoverml.models.SGDApproxGP, uncoverml.models.TagsMixin

class uncoverml.optimise.models.TransformedSGDRegressor(loss='squared_loss', penalty='l2', alpha=0.0001, l1_ratio=0.15, fit_intercept=True, max_iter=5, shuffle=True, verbose=0, epsilon=0.1, random_state=None, learning_rate='invscaling', eta0=0.01, power_t=0.25, warm_start=False, average=False, target_transform='identity')

Bases: uncoverml.optimise.models.TransformPredictDistMixin, sklearn.linear_model._stochastic_gradient.SGDRegressor, uncoverml.models.TagsMixin

Linear elastic net regression model using Stochastic Gradient Descent (SGD).

class uncoverml.optimise.models.TransformedSVR(kernel='rbf', degree=3, gamma='scale', coef0=0.0, tol=0.001, C=1.0, epsilon=0.1, shrinking=True, cache_size=200, verbose=False, max_iter=- 1, target_transform='identity')

Bases: uncoverml.optimise.models.TransformMixin, sklearn.svm._classes.SVR, uncoverml.models.TagsMixin

class uncoverml.optimise.models.XGBoost(target_transform='identity', max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective='reg:linear', nthread=1, gamma=0, min_child_weight=1, max_delta_step=0, subsample=1, colsample_bytree=1, colsample_bylevel=1, reg_alpha=0, reg_lambda=1, scale_pos_weight=1, n_jobs=- 1, base_score=0.5, random_state=1, missing=None)

Bases: uncoverml.optimise.models.TransformMixin, uncoverml.models.TagsMixin, xgboost.sklearn.XGBRegressor

uncoverml.optimise.scorers module

Wrappers around model scoring metrics so they can be used in GridSearchCV.

Module contents