libpyhat.regression package

Submodules

libpyhat.regression.cv module

libpyhat.regression.cv.RMSE(ypred, y)[source]
class libpyhat.regression.cv.cv(paramgrid, meta_label='meta')[source]

Bases: object

do_cv(Train, xcols='wvl', ycol=('comp', 'SiO2'), method='PLS', yrange=None, n_jobs=-1)[source]
libpyhat.regression.cv.cv_core(i, paramgrid, Train, xcols, ycol, method, yrange, meta_label='meta')[source]

libpyhat.regression.local_regression module

class libpyhat.regression.local_regression.LocalRegression(params, n_neighbors=250, verbose=True, n_jobs=-1)[source]

Bases: object

This class implements “local” regression. Given a set of training data and a set of unknown data,

iterate through each unknown spectrum, find the nearest training spectra, and generate a model. Each of these local models is optimized using built-in cross validation methods from scikit.

fit_predict(x_train, y_train, x_predict)[source]

Use local regression to predict values for unknown data.

Arguments:

x_train = The training data spectra. y_train = The values of the quantity being predicted for the training data x_predict = The unknown spectra for which y needs to be predicted.

libpyhat.regression.local_regression.fit_predict_parallel(i, x_train=None, y_train=None, x_predict=None, model=None, neighbors=None, verbose=True)[source]

libpyhat.regression.local_rmsep module

;+ ;This function is used to calculate the RMSEP on-the-fly as a function of predicted composition. ;It uses the test set results to create a plot of RMSEP vs composition. This is then smoothed and extrapolated ;and re-sampled to be used as a look-up table for the predictions of unknown targets. ; ;Inputs: ; predicts = Array containing the predicted compositions that need RMSEPs ; test_predicts = Hash containing the predicted compositions for the test set ; test_actuals = Hash containing the actual compositions for the test set ; elems = string array containing major oxide names ; makeplot = Optional keyword that produces plots of RMSEP vs composition ;Outputs: ; rmseps = Array of RMSEP values calculated for each of the predictions in “predicts” ;-

libpyhat.regression.local_rmsep.extrap_full(predicts, rmseps, xmax)[source]
libpyhat.regression.local_rmsep.extrap_last_min(predicts, rmseps, xmax)[source]
libpyhat.regression.local_rmsep.generate_dummy(test_predicts, test_actuals, minval, win, xmax)[source]
libpyhat.regression.local_rmsep.linear_function(x, A, B)[source]
libpyhat.regression.local_rmsep.local_rmse_calc(test_predicts, test_actuals, unk_predicts, windowsize=0.0, min_rmsep_num=40, sigma=10, extrapolate=True, full_fit=False, xmax=120)[source]
libpyhat.regression.local_rmsep.local_rmse_explore(test_predicts, test_actuals, windowsize=[0.0], min_rmsep_num=[40], outpath='', plot_file=None, element='', sigma=None, extrapolate=True, full_fit=False, xmax=120)[source]
libpyhat.regression.local_rmsep.remove_duplicates(rmseps, predicts)[source]

libpyhat.regression.regression module

class libpyhat.regression.regression.regression(method, params, i=0)[source]

Bases: object

calc_Qres_Lev(x)[source]
fit(x, y)[source]
predict(x, return_std=None)[source]

libpyhat.regression.sm module

Created on Sat Mar 26 20:15:46 2016

@author: [username deleted]

class libpyhat.regression.sm.sm(blendranges, random_seed=None)[source]

Bases: object

do_blend(predictions, truevals=None, verbose=True)[source]
get_rmse(blendranges, predictions, truevals, verbose, rangemin=0.0, rangemax=100, roundval=10)[source]
submodels_blend(predictions, blendranges, overwrite=False)[source]

Module contents