Recent Releases of lumin
lumin - v0.9.0
Major updates to dependencies and moves to poetry for build and packaging
What's Changed
- Refactor use poetry by @GilesStrong in https://github.com/GilesStrong/lumin/pull/116
- chore: python version by @GilesStrong in https://github.com/GilesStrong/lumin/pull/118
- chore: m2r version by @GilesStrong in https://github.com/GilesStrong/lumin/pull/119
Full Changelog: https://github.com/GilesStrong/lumin/compare/v0.8.1...v0.9.0
- Python
Published by GilesStrong about 1 year ago
lumin - v0.8.1
N.B. Last version to use setuptools for building, subsequent versions use Poetry
What's Changed
- Remove lambdas by @GilesStrong in https://github.com/GilesStrong/lumin/pull/106
- Matrix targets by @GilesStrong in https://github.com/GilesStrong/lumin/pull/107
- Sparse targ fixes by @GilesStrong in https://github.com/GilesStrong/lumin/pull/108
- No test shuffle by @GilesStrong in https://github.com/GilesStrong/lumin/pull/109
- Fix ensemble loading by @GilesStrong in https://github.com/GilesStrong/lumin/pull/110
- fix: Use 'req@url' syntax to install from remote VCS by @matthewfeickert in https://github.com/GilesStrong/lumin/pull/111
- Feat by from fy by @GilesStrong in https://github.com/GilesStrong/lumin/pull/112
- Feat add geo data by @GilesStrong in https://github.com/GilesStrong/lumin/pull/113
- Refactor: PDPDBox is optional dep by @GilesStrong in https://github.com/GilesStrong/lumin/pull/114
New Contributors
- @matthewfeickert made their first contribution in https://github.com/GilesStrong/lumin/pull/111
Full Changelog: https://github.com/GilesStrong/lumin/compare/v0.8.0...v0.8.1
- Python
Published by GilesStrong about 1 year ago
lumin - v0.8.0 - Mistake not...
v0.8.0 - Mistake not...
Important changes
- GNN architectures generalised into feature extraction and graph collapse stages, see details below and updated tutorial
Breaking
Additions
GravNetGNN head andGravNetLayersub-block Qasim, Kieseler, Iiyama, & Pierini, 2019- Includes optional self-attention
SelfAttentionandOffsetSelfAttention- Batchnorm:
LCBatchNorm1dto run batchnorm over length x channel data- Additional
bn_classarguments to blocks, allowing the user to choose different batchnorm implementations - 1, 2, & 3D Running batchnorm layers from fastai (https://github.com/fastai/course-v3)
GNNHeadencapsulating head for feature extraction, usingAbsGraphFeatExtractorclasses, and graph collapsing, usingGraphCollapserclasses- New callbacks:
AbsWeightDatato weight folds of data based on their inputs or targetsEpochSaverto save the model to a new file at the end of every epochCycleStepcombines OneCycle and step-decay of optimiser hyper-parameters
- New CNN blocks:
AdaptiveAvgMaxConcatPool1d,AdaptiveAvgMaxConcatPool2d,AdaptiveAvgMaxConcatPool3duse average and maximum pooling to reduce data to specified number sizes per channelSEBlock1d,SEBlock2d,SEBlock3dapply squeeze-excitation to data channels
BackwardHookfor recording telemetric data during backwards passes- New losses:
WeightedFractionalMSE,WeightedBinnedHuber,WeightedFractionalBinnedHuber
- Options for log x & y axis in
plot_feat
Removals
- Scheduled removal of depreciated methods and functions from old model and callback system:
OldAbsCallbackOldCallbackOldAbsCyclicCallbackOldCycleLROldCycleMomOldOneCycleOldBinaryLabelSmoothOldBinaryLabelSmoothSequentialReweightSequentialReweightClassesOldBootstrapResampleOldParametrisedPredictionOldGradClipOldLsuvInitOldAbsModelCallbackOldSWAOldLRFinderOldEnsembleOldAMSOldMultiAMSOldBinaryAccuracyOldRocAucScoreOldEvalMetricOldRegPullOldRegAsProxyPullOldAbsModelOldModelfold_train_ensembleOldMetricLoggerfold_lr_findold_plot_train_history_get_folds
- Unnecessary
pred_cbargument intrain_models
Fixes
- Bug when trying to use batchnorm in
InteractionNet - Bug in
FoldFile.save_fold_predwhen predictions change shape and try to overwrite existing predictions
Changes
paddingargument in conv 1D blocks renamed to pad- Graph nets: generalised into feature extraction for features per vertex and graph collapsing down to flat data (with optional self-attention)
- Renamed
FowardHooktoForwardHook - Abstract classes no longer inherit from ABC, but rather have
metaclass=ABCMetain order to be compatible with py>=3.7 - Updated the example of binary classification of signal & background to use the model and training resulting from https://iopscience.iop.org/article/10.1088/2632-2153/ab983a
- Also changed the multi-target regression example to use non-densely connected layers, and the multi-target classification example to use a cosine annealed cyclical LR
- Updated the single-target regression example to use
WeightedBinnedHuberas a loss - Changed
from torch.tensor import Tensortofrom torch import Tensorfor compatibility with latest PyTorch
Depreciations
OldInteractionNetreplaced in favour ofInteractionNetfeature extractor. Will be removed in v0.9
- Python
Published by GilesStrong over 4 years ago
lumin - v0.7.2 - All your batch are belong to us - Micro Update
v0.7.2 - All your batch are belong to us - Micro Update
Important changes
- Fixed bug in
Model.set_momwhich resulted in momentum never being set (affects e.g. OneCycle and CyclicalMom) Model.fitnow shuffles the fold indices for training folds prior to each epoch rather than once per training; removes the periodicity in training loss which was occasionally apparent.- Bugs found in
OneCycle:- When training multiple models, the initial LR for subsequent models was the end LR of the previous model (list in partial was being mutated)
- The model did not stop training at end of cycle
- Momentum was never altered in the optimiser
Breaking
Additions
- Mish activation function
Model.fit_params.val_requires_gradto control whether to compute validation epoch with gradient, default zero, built some losses might require it in the futureParameterisedPredictionnow stores copies of values for parametrised features in case they change, or need to be changed locally during prediction.freeze_layersandunfreeze_layersmethods forModelPivotTrainingcallback implementing Learning to Pivot Louppe, Kagan, & Cranmer, 2016- New example reimplementing paper's jets example
TargReplacecallback for replacing target data inBatchYielderduring training- Support for loss functions being
fastcorepartiallerobjects train_modelsnow has arguments to:- Exclude specific fold indices from training and validation
- Train models on unique folds, e.g. when training 5 models on a file with 10 folds, each model would be trained on their own unique pair of folds
- Added discussion of core concepts in LUMIN to the docs
Removals
Fixes
- Cases in which a NaN in the metric during training could spoil plotting and
SaveBest - Bug in
Model.set_momwhich resulted in momentum never being set (affects e.g. OneCycle and CyclicalMom) - Bug in
MetricLogger.get_resultswhere tracking metrics could be spoilt by NaN values - Bug in
trainwhen not passing any metrics - Bug in FoldYielder when loading output pipe from Path
- Bugs found in
OneCycle:- When training multiple models, the initial LR for subsequent models was the end LR of the previous model (list in partial was being mutated)
- The model did not stop training at end of cycle
- Momentum was never altered in the optimiser
Changes
Model.fitnow shuffles the fold indices for training folds prior to each epoch rather than once per training; removes the periodicity in training loss which was occasionally apparent.- Validation and prediction forwards passes now performed without gradient tracking to save memory and time
MetricLoggernow records loss values on batch end rather than on forwards endon_batch_endnow always called regardless of model state
Depreciations
Comments
- Python
Published by GilesStrong almost 5 years ago
lumin - v0.7.1 - All your batch are belong to us - Micro Update
v0.7.1
Important changes
EvalMetricsrevised to inherit fromCallbackand be called on validation data after every epoch. User-writtenEvalMetricswillneed to be adjusted to work with the new calling method: adjustevaluatemethod and constructor may need to be adjusted; see existing metrics to see how.
Breaking
eval_metricsargument intrain_modelsrenamed tometric_partialsand now takes a list of partialEvalMetrics- User-written
EvalMetricswill need to be adjusted to work with the new calling method: adjustevaluatemethod and constructor may need to be adjusted; see existing metrics to see how.
Additions
OneCyclenow has acycle_ends_trainingwhich allows training to continue at the final LR and Momentum. keeping at default ofTrueends the training once the cycle is complete, as usual.to_npnow returnsNonewhen input tensor isNoneplot_train_historynow plots metric evolution for validation data
Removals
Fixes
Modelnow createscb_savepathis it didn't already exist- Bug in
PredHandlerwhere predictions were kept on device leading to increased memory usage - Version issue in matplotlib affecting plot positioning
Changes
Depreciations
- V0.8:
- All
EvalMetricsdepreciated with metric system. They have been copied and renamed to Old* for compatibility with the old model training system. OldEvalMetric: Replaced byEvalMetricOldMultiAMS: Replaced byMultiAMSOldAMS: Replaced byAMSOldRegPull: Replaced byRegPullOldRegAsProxyPull: Replaced byRegAsProxyPullOldRocAucScore: Replaced byRocAucScoreOldBinaryAccuracy: Replaced byBinaryAccuracy
- All
Comments
- Python
Published by GilesStrong about 5 years ago
lumin - v0.7.0 - All your batch are belong to us
v0.7.0 - All your batch are belong to us
Important changes
- Model training and callbacks have significantly changed:
Model.fitnow expects to perform the entire training proceedure, rather than just single epochs.- A lot of the functionality of the old training method
fold_train_ensembleis now delegated toModel.fit. - A new ensemble training method
train_modelshas replacedfold_train_ensemble. It provied a similar API, but aims to be more understandable to users. Model.fitis now 'stateful': afit_paramsclass is created containing all the information and data relevant to training the model and trainig methods change their actions according tofit_params.state('train', 'valid', and 'test')- Callbacks now have greater potential: They have more action points during the training cycle, where they can affect training behaviour, and they have access to
fit_params, allowing them to modify more aspects of the training and have indirect access to all other callbacks. - The "tick" for the training loop is now one epoch, i.e. validation loss is computed after the entire use of the training data (as opposed to after every sub-epoch), cyclic callbacks now work on the scale of epochs, rather than sub-epochs. Due to the data being split into folds, the concept of a sup-epoch still exists, but the APIs are now simplified for the user (previously they were a mixture of sup-epoch and epoch arguments).
- For users who do not wish to transition to the new model behaviour, the existing behaviour can still be achieved by using the
Old*models and classes. See the depreciations section for the full list.
- Input masks (present if e.g using feature subsampling in
ModelBuilder`)BatchYieldernow takes aninput_maskargument to filter inputsModelprediction methods no longer take input mask arguments, instead the input mask (if present) is automatically used. If users have already filtered their data, they should manually remove the input mask from the model (i.e. set it to None)
- Callbacks which take arguments related to (sub-)epochs (e.g. cycle length, scale, time to renewal. etc. for
CycleLR,OneCycle, etc. andSWA) now take these arguments in terms of epochs. I.e. a OneCycle schedule with 9 training folds, running for 15 epochs would previously require e.g.lenghts=(45,90)in order to complete the cycle in 15 epochs (135 subepochs). Now it is specified as simplylenghts=(5,10). Additionally, these arguments must be integers. Floats will be coerced to integers with warning. lr_findnow runds over all training folds, instead of just 1
Breaking
- Heavy renaming of methods and classes due to changes in model trainng and callbacks.
Additions
__del__method toFowardHookclassBatchYielder:- Now takes an
input_maskargument to filter inputs - Now takes an argument allowing incomplete batches to be yielded
- Target array can now be None
- Now takes an
Model:- now takes a
bsargument forevaluate - predictions can now be modified by passing a
PredHandlercallback topred_cb. The default one simply returns the model predicitons, however other actions could be defined by the user, e.g. performing argmax for multiclass classifiers.
- now takes a
Removals
Model:- Now no longer takes
callbacksandmask_inputsas arguments forevaluate evaluate_from_byremoved, just callevaluate
- Now no longer takes
- Callbacks no longer take model and plot_settings arguments during initialisation. These should be added by calling the relevant setters.
Modelwill call them when relevant.
Fixes
- Potential bug in convolutional models where checking the out size of the head would affect the batchnorm averaging
- Potential bug in
plot_sample_predto do with bin ranges ForwardHooknot working with passed hook functions
Changes
BinaryLabelSmoothnow only applies smoothing during training and not in validationEnsemblefrom_resultsandbuild_ensemblenow no longer takelocationas an argument. Instead, results should contain the savepath for the models_build_ensembleis now private
Model:predict_arrayandpredict_foldsare now privatefitnow expects to perform the entire fitting of the model, rather than just one sup-epoch. Additionally, validation loss is now computed only at the end of the epoch, rather that previously where it was computed after each fold.
SWArenewal_periodshould now be None in order to prevent a second average being tracked (previously was negative)- Some examples have been renamed, and copies using the old model fitting proceedure and old callbacks are available in
examples/old lr_findnow runds over all training folds, instead of just 1
Depreciations
- V0.8:
- Many classes and methods depreciated with new model. They have been copied and renamed to Old*.
OldAbsModel: Replaced byAbsModelOldModel: Replaced byModelOldAbsCallback: Replaced byAbsCallbackOldCallback: Replaced byCallbackOldBinaryLabelSmooth: Replaced byBinaryLabelSmoothOldSequentialReweight: Will not be replacedSequentialReweightClasses: Will not be replacedOldBootstrapResample: Replaced byBootstrapResampleOldParametrisedPrediction: Replaced byParametrisedPredictionOldGradClip: Replaced byGradClipOldLsuvInitLReplaced byLsuvInitOldAbsCyclicCallback: Replaced byAbsCyclicCallbackOldCycleLR: Replaced byCycleLROldCycleMom: Replaced byCycleMomOldOneCycle: Replaced byOneCycleOldLRFinder: Replaced byLRFinderfold_lr_find: Replaced bylr_findfold_train_ensemble: Replaced bytrain_modelsOldMetricLogger: Replaced byMetricLoggerAbsModelCallback: Will not be replacedOldSWA: Replaced bySWAold_plot_train_history: Replaced byplot_train_historyOldEnsemble: Replaced byEnsemble
Comments
- Python
Published by GilesStrong about 5 years ago
lumin - v0.6.0 - Train and Converge Until it is Done
v0.6.0 - Train and Converge Until it is Done
Important changes
auto_filter_on_linear_correlationnow examines all features within correlated clusters, rather than just the most correlated pair. This means that the function now only needs to be run once, rather than the previously recommended multiple rerunning.- Moved to Scikit-learn 0.22.2, and moved, where possible, to keyword argument calls for sklearn methods in preparation for 0.25 enforcement of keyword arguments
- Fixed error in patience when using cyclical LR callbacks, now specify the number of cycles to go without improvement. Previously had to specify 1+number.
- Matrix data is no longer passed through
np.nan_to_numinFoldYielder. Users should ensure that all values in matrix data are not NaN or Inf - Tensor data:
df2foldfile,fold2foldfile, and 'addmetadata` can now support the saving of arbitrary matrices as a matrix input- Pass a
numpy.arraywhose first dimension matches the length of the DataFrame to thetensor_dataargument ofdf2foldfileand a name totensor_name. The array will be split along the first dimension and the sub-arrays will be saved as matrix inputs in the resulting foldfile - The matrices may also be passed as sparse format and be densified on loading by FoldYielder
Breaking
plot_rank_order_dendrogramnow returns sets of all features in cluster with distance over the threshold, rather than just the closest features in each cluster
Additions
- Addition of batch size parameter to
Ensemble.predict* - Lorentz Boost Network (https://arxiv.org/abs/1812.09722):
LorentzBoostNetbasic implementation which learns boosted particles from existing particles and extracts features from them using fixed kernel functionsAutoExtractLorentzBoostNetwhich also learns the kernel-functions during training
- Classification
Evalclasses:BinaryAccuracy: Computes and returns the accuracy of a single-output model for binary classification tasks.RocAucScore: Computes and returns the area under the Receiver Operator Characteristic curve (ROC AUC) of a classifier model.
plot_binary_sample_feat: a version ofplot_sample_preddesigned for plotting feature histograms with stacked contributions by sample for background.- Added compression arguments to
df2foldfile,fold2foldfile, andsave_to_grp - Tensor data:
df2foldfile,fold2foldfile, and 'addmetadata` can now support the saving of arbitrary matrices as a matrix input- Pass a
numpy.arraywhose first dimension matches the length of the DataFrame to thetensor_dataargument ofdf2foldfileand a name totensor_name. The array will be split along the first dimension and the sub-arrays will be saved as matrix inputs in the resulting foldfile - The matrices may also be passed as sparse format and be densified on loading by FoldYielder
plot_lr_findersnow has alog_yargument for logarithmic y-axis. Defaultautoset log_y if maximum fractional difference between losses is greater than 50- Added new rescaling options to
ClassRegMultiusing linear outputs and scaling by mean and std of targets LsuvInitnow applies scaling tonn.Conv3dlayersplot_lr_findersandfold_lr_findnow have options to save the resulting LR finder plot (currently limited to png due to problems with pdf)- Addition of AdamW and an optimiser, thanks to @kiryteo
- Contribution guide, thanks to @kiryteo
- OneCycle
lr_rangenow supports a non-zero final LR; just supply a three-tuple to thelr_rangeargument. Ensemble.from_modelsclassmethod for combining in-memory models into an Ensemble.
Removals
FeatureSubsampleplotskeyword infold_train_ensemble
Fixes
- Docs bug for nn.training due to missing ipython in requirements
- Bug in LSUV init when running on CUDA
- Bug in TF export based on searching for fullstops
- Bug in model_bar update during fold training
- Quiet bug in 'MultHead' when matrix feats were not listed first; map construction indexed self.matrix_feats not self.feats
- Slowdown in
ensemble.predict_arraywhich caused the array to get sent to device in during each model evaluations -Model.get_param_countnow includes mon-trainable params when requested - Fixed bug in
fold_lr_findwhere LR finders would use different LR steps leading to NaNs when plotting infold_lr_find plot_featused to coerce NaNs and Infs vianp.nan_to_numprior to plotting, potentially impacting distributions, plotting scales, moments, etc. Fixed so that nan and inf values are removed rather than coerced.- Fixed early-stopping statement in
fold_train_ensembleto state the number as "sub-epochs" (previously said "epochs") - Fixed error in patience when using cyclical LR callbacks, now specify the number of cycles to go without improvement. Previously had to specify 1+number.
- Unnecessary warning
df2foldfilewhen no strat-key is passed. - Saved matrices in
fold2foldfileare now in float32 - Fixed return type of
get_layersmethods inRNNs_CNNs_and_GNNs_for_matrix_dataexample - Bug in
model.predict_arraywhen predicting matrix data with a batch size - Added missing indexing in
AbsMatrixHeadto usetorch.boolif PyTorch version is >= 1.2 (wasuint8but now depreciated for indexing) - Errors when running in terminal due to trying to call
.showon fastprogress bars - Bug due to encoding of readme when trying to install when default encoder is ascii
- Bug when running
Model.predictin batches when the data contains less than one batch - Include missing files in sdist, thanks to @thatch
- Test path correction in example notebook, thanks to @kiryteo
- Doc links in
hep_proc - Error in
MultiHead._set_featswhenmatrix_headdoes not contain 'vecs' or 'featspervec' keywords - Compatibility error in numpy >= 1.18 in
bin_binary_class_preddue to float instead of int - Unnecessary second loading of fold data in
fold_lr_find - Compatibility error when working in PyTorch 1.6 based on integer and true division
- SWA not evaluating in batches when running in non-bulk-move mode
- Moved from
normedtodensitykeywords for matplotlib
Changes
ParametrisedPredictionnow accepts lists of parameterisation featuresplot_sample_prednow ensures that signal and background have the same binningPlotSettingsnow coerces string arguments forsavepathtoPath- Added default value for
targ_nameinEvalMetric plot_rank_order_dendrogram:- Now uses "optimal ordering" for improved presentation
- Now returns sets of all features in cluster with distance over the threshold, rather than just the closest features in each cluster
auto_filter_on_linear_correlationnow examines all features within correlated clusters, rather than just the most correlated pair. This means that the function now only needs to be run once, rather than the previously recommended multiple rerunning.- Improved data shuffling in
BatchYielder, now runs much quicker - Slight speedup when loading data from foldfiles
- Matrix data is no longer passed through
np.nan_to_numinFoldYielder. Users should ensure that all values in matrix data are not NaN or Inf
Depreciations
Comments
- RFPImp still imports from
sklearn.ensemble.forestwhich is depreciated, and possibly part of the private API. Hopefully the package will remedy this in time for depreciation. For now, future warnings are displayed.
- Python
Published by GilesStrong over 5 years ago
lumin - v0.5.1 - The Gradient Must Flow - Micro Update
v0.5.1 - The Gradient Must Flow - Micro Update
Important changes
- New live plot for losses during training (
MetricLogger):- Provides additional information
- Only updates after every epoch (previously every subepoch) reducing training times
- Nicer appearance and automatic log scale for y-axis
Breaking
Additions
- New live plot for losses during training (
MetricLogger):- Provides additional information
- Only updates after every epoch (previously every subepoch) reducing training times
- Nicer appearance and automatic log scale for y-axis
Removals
Fixes
- Fixed error in documentation which removed the ToC for the nn module
Changes
Depreciations
plotsargument infold_train_ensemble. The plots argument is now depreciated and ignored. Loss history will always be shown, lr history will no longer be shown separately, and live feedback is now controlled by the four live_fdbk arguments. This argument will be removed in V0.6.
Comments
- Python
Published by GilesStrong almost 6 years ago
lumin - v0.5 The Gradient Must Flow
V0.5 The Gradient Must Flow
Important changes
- Added support for processing and embedding of matrix data
MultiHeadto allow the use of multiple head blocks to handle input data containing flat and matrix inputsAbsMatrixHeadabstract class for head blocks designed to process matrix dataInteractionNeta new head block to apply interaction graph-nets to objects in matrix formRecurrentHeada new head block to apply recurrent layers (RNN, LSTM, GRU) to series objects in matrix formAbsConv1dHeada new abstract class for building convolutional networks from basic blocks to apply to object in matrix form.
- Meta data:
FoldYieldernow checks its foldfile for ameta_datagroup which contains information about the features and inputs in the datacont_featsandcat_featsnow no longer need to be passed toFoldYielderduring initialisation of the foldfile contains meta dataadd_meta_datafunction added to write meta data to foldfiles and is automatically called bydf2foldfile
- Improved usage with large datasets:
- Added
Model.evaluate_from_byto allow batch-wise evaluation of loss bulk_moveinfold_train_ensemblenow also affects the validation fold, i.e.bulk_move=Falseno longer preloads the validation fold, and validation loss is evaluated usingModel.evaluate_from_bybulk_movearguments added tofold_lr_find- Added batch-size argument to Model predict methods to run predictions in batches
- Added
Potentially Breaking
FoldYielder.get_df()now returns any NaNs present in data rather than zeros unlessnan_to_numis set toTrue- Zero bias init for bottlenecks in
MultiBlockbody
Additions
__repr__ofModelnow detail information about input variables- Added support for processing and embedding of matrix data
MultiHeadto allow the use of multiple head blocks to handle input data containing flat and matrix inputsAbsMatrixHeadabstract class for head blocks designed to process matrix dataInteractionNeta new head block to apply interaction graph-nets to objects in matrix formRecurrentHeada new head block to apply recurrent layers (RNN, LSTM, GRU) to series objects in matrix formAbsConv1dHeada new abstract class for building convolutional networks from basic blocks to apply to object in matrix form.
- Meta data:
FoldYieldernow checks its foldfile for ameta_datagroup which contains information about the features and inputs in the datacont_featsandcat_featsnow no longer need to be passed toFoldYielderduring initialisation of the foldfile contains meta dataadd_meta_datafunction added to write meta data to foldfiles and is automatically called bydf2foldfile
get_inputsmethod toBatchYielderto return the inputs, optionally on device- Added LSUV initialisation, implemented by
LsuvInitcallback
Removals
Fixes
FoldYielder.get_df()now returns any NaNs present in data rather than zeros unlessnan_to_numis set toTrue- Various typing fixes`
- Body and tail modules not correctly freezing
- Made
Swishto not be inplace - seemed to cause problems sometimes - Enforced fastprogress version; latest version renamed a parameter
- Added support to
df2foldfilefor missingstrat_key - Added support to
fold2foldfilefor missing features - Zero bias init for bottlenecks in
MultiBlockbody
Changes
- Slight optimisation in
FullyConnectedwhen not using dense or residual networks FoldYielder.set_foldfileis now a private functionFoldYielder._set_foldfile- Improved usage with large datasets:
- Added
Model.evaluate_from_byto allow batch-wise evaluation of loss bulk_moveinfold_train_ensemblenow also affects the validation fold, i.e.bulk_move=Falseno longer preloads the validation fold, and validation loss is evaluated usingModel.evaluate_from_bybulk_movearguments added tofold_lr_find- Added batch-size argument to Model predict methods to run predictions in batches
- Added
Depreciations
Comments
- Python
Published by GilesStrong almost 6 years ago
lumin - v0.4 Hypothetically Useful But Of Limited Actual Utility
Important changes
- Moved to Pandas 0.25.0
- Moved to Seaborn 0.9.0
- Moved to Scikit-learn 0.21.0
Breaking
Additions
rf_check_feat_removalmethod to check whether one of several (correlated) features can safely be ignoredrf_rank_features:n_max_displaytorf_rank_featuresto adjust number of features displayed in plotplot_results,retrain_on_import_feats, andverboseto control printed outputs of function- Can now take preset RF params, rather than optimising each time
- Control over x-axis label in
plot_importance repeated_rf_rank_featuresget_dffunction toLRFinder- Ability to use dictionaries for
PlotSettings.style plot_rank_order_dendrogram:- added threshold param to control plotting colour and return
- returns list of paris of correlated features
FoldYielder- Method to list columns in foldfile
- option to initialise using a string or path for the foldfile
- close method to close the foldfile
- New methods to
hep_procfocussing on vectoriesed transformations and operatins of Lorentz Vectors subsample_dfto sub sample a data frame (with optional stratification and replacement)- Callbacks during prediction:
on_pred_beginandon_pred_endmethods added toAbsCallbackwhich are called duringModel.predict_arrayModel.predict,Model.predict_folds,Model.predict_arraynow take a list of instantiated callbacks to apply during predicitonEnsemble.predict,Ensemble.predict_folds,Ensemble.predict_arraynow take a list of instantiated callbacks to apply during prediciton
ParametrisedPredictioncallback for setting a single parameterisation feature to a set value during model prediction- y-axis limit argument to
plot_1d_partial_dependence auto_filter_on_linear_correlationauto_filter_on_mutual_dependence
Removals
- Passing
etaargument toto_pt_eta_phi: now inferred from data Embedderrenamed toCatEmbeddercat_argsandn_cont_inarguments inModelBuilder: Usecat_embedderandcont_featsinsteadcallback_argsargument infold_train_ensemble: Usecallback_partialsinsteadbinary_class_cutrenamed tobinary_class_cut_by_amsplot_dendrogramrenamed toplot_rank_order_dendrogram
Fixes
- Remove mutable default paramert for
get_opt_rf_params - Missing
n_estimatorsin call toget_opt_rf_paramstorf_rank_features - Added string interpretation check when loading
ModelBuildersaved in pre-v0.3.1 versions rf_rank_featuresimportance cut now >= threshold, was previously >plot_rank_order_dendrogramnow clusters by absolute Spearman's rank correlation coeficientfeat_maptoself.feat_mapinMultiBlock.__init__- Bias initialisation for sigmoids in
ClassRegMulticorrected to zero, was 0.5 - Removed uncertainties from the moments shown by
plot_featwhen plotting with weights; uncertainties were underestimated
Changes
- Improved
plot_lr_finders - Moved to Pandas 0.25.0
- Moved to Seaborn 0.9.0
- Moved to Scikit-learn 0.21.0
model_builder.get_modelnow returns a 4th object, an input_mask- Feature subsampling:
- Moved to
ModelBuilderrather thanFeatureSubsamplecallback: required to handleMultiBlockmodels - Now allows a list of features to always be present in model via
ModelBuilder.guaranteed_feats
- Moved to
plot_1d_partial_dependenceandplot_2d_partial_dependencenow better handle weighted resampling of data: replacement sampling, and auto fix whenwgt_namespecified but nosample_sz
Depreciations
FeatureSubsamplein favour ofguaranteed_featsandcont_subsample_rateinModelBuilder. Will be removed in v0.5.
Comments
- Python
Published by GilesStrong about 6 years ago
lumin - v0.3.1 Micro update
Important changes
- Online documentation now available at https://lumin.readthedocs.io
Breaking
Additions
bin_binary_class_pred- Ability to only consider classes rather than samples when computing bin edges
- Ability to add pure signal bins if normalisation uncertainty would be below some value
plot_bottleneck_weighted_inputsmethod for interpretting bottleneck blocks inMultiBlock- Online documentation: https://lumin.readthedocs.io
- Default optimiser notice
- Can now pass arbitary optimisers to the 'opt' value in
opt_args. Optimisers still interpretable from strings. - Expanded advanced model building example to include more interpretation examples and diagrams of network architectures
Removals
- weak decorators for losses
Fixes
CatEmbedder.from_fyusing features ignored byFoldYielderbottleneck_sz_maskstobottleneck_masksinMultiBlock- SWA crahsing when evaluating targets of type long, when loss expects a float (model.evaluate now converts to float when objective is not multiclass classification)
- Doc string fixes
- Fixed model being moved to device after instantiating optimiser (sometimes leads to an error). Models now moved to device in
ModelBuilder.get_modelrather than inModel.__init__
Changes
Depreciations
Comments
- Python
Published by GilesStrong over 6 years ago
lumin - V0.3 Tears in Rain
Important changes
norm_indefault value forget_pre_proc_pipesis nowTruerather thanFalse- layer width in dense=True
FullyConnectednow no longer scales with input size to prevent parameter count from exploding - Biases in
FullyConnectedlinear layers are now initialised to zero, rather that default PyTorch init - Bias in
ClassRegMultilinear layer is now intitialised to 0.5 if sigmoid output, zero if linear output, and 1/nout if softmax, unless a biasinit value is specified
Breaking
- Changed order of arugments in
AMSandMultiAMSand removed some default values - Removed default for
return_meaninRegAsProxyPullandRegPull - Changed
settingstoplot_settingsinrf_rank_features - Removed some default parameters for NN blocks in
ModelBuilder ModelBuildermodel_argsshould now be a dictionary of dictionaries of keyword arguments, one for head, body, and tail blocks, previously was a single dictionary of keyword argumentsEmbedder.from_fynow no longer works: change toCatEmbedder.from_fyCatEmbHeadnow no longer has an_cont_inargument, instead one should pass a list of feature names tocont_feats
Additions
- Added
n_estimatorsparameter torf_rank_featuresandget_opt_rf_paramsto adjust the number of trees - Added
n_rfsparameter torf_rank_featuresto average feature importance over several random forests - Added automatic computation of 3-momenta magnitude to
add_massif it's missing n_componentstoget_pre_proc_pipesto be passed toPCAPipelineconfiguration parameters tofit_input_pipe- Ability to pass an instantiated
Pipelinetofit_input_pipe - Callbacks now receive
model_numandsavepathinon_train_begin - Random Forest like ensembling:
BootstrapResamplecallback for resampling training and validation data- Feature subsambling:
FeatureSubsamplecallback for training on random selection of featuresModelnow has aninput_maskto automatically mask inputs at inference time (train-time inputs should be masked atBatchYielderlevel)
plot_rocnow returns aucs as dictionary- growth_rate scaling coefficient to
FullyConnectedto adjust layer width by depth n_inparameter toFullyConnectedso it works on arbitray size inputsfreeze_tailtoModelBuilderandClassRegMulti- Abstract blocks for head, body, and tail
cont_featsargument toModelBuilderto allow passing of list of named features, eventually allowing more advanced methods based on named outputs of head blocks.CatEmbHeadnow computes a mapping from named input features to their outputs- body blocks now expect to be passed a dictionary mapping from named input features to the model to the outputs of the head block
ModelandAbsBlockclasses now have a method to compute total number of (trainable) parametersMultiBlockbody, providing possibility for multiple, parallel body blocks taking subsets of input features- Explicit initialisation paramater for bias in
ClassRegMulti plot_1d_partial_dependencenow takespdp_isolate_kargsandpdp_plot_kargsto pass topdp_isolateandpdp_plot, respectivelyplot_2d_partial_dependencenow takespdp_interact_kargsandpdp_interact_plot_kargsto pass topdp_interactandpdp_interact_plot, respectivelyForwardHookclassplot_multibody_weighted_outputsan interpration plot forMultiBlockmodels- Better documentation for methods and classes
Removals
- Some default values of arugments in
AMSandMultiAMS - Default for
return_meaninRegAsProxyPullandRegPull
Fixes
- Missing bboxinches in `plotembedding`
- Typing for
cont_featsandsavenameinfit_input_pipe - Typing for
targ_featsandsavenameinfit_output_pipe - Moved predictions to after callback
on_eval_begin - Updated
from_model_builderclass method ofModelBuilderto use andCatEmbedder - Hard coded savename in
Modelduring save to hopefull solve occaisional permission error during save - Typing for
val_foldinSWA - 'lr' to 'momentum' in
Model.set_mom Model.get_momnow actually returns momentum (beta_1) rather than lr- Added catch for infinite uncertainties being passed to
uncert_round - Added catch for
plot_rocwith bootstraping when resamples data only contains one class - Error when attempting to plot categorical feature in
plot_1d_partial_dependence - layer width in dense=True
FullyConnectedscaling with input size - Fixed
lookup_actfor linear function plot_1d_partial_dependencenot usingn_pointsparameter- Errors in
plot_rocswhen passing non-lists and when requesting plot_params and bootsrapping - Missing
to_devicecall when exporting to ONNX on a CUDA device
Changes
to_pt_eta_phinow infers presence of z momentum from dataframenorm_indefault value forget_pre_proc_pipesis nowTruerather thanFalsefold_train_ensemblenow always trainsn_models, and validation fold IDs are cycled through according tofy.n_folds % model_numFoldYielder.set_ignorechanged toFoldYielder.add_ignore- Changed
HEPAugFoldYielder.rotateandHEPAugFoldYielder.reflectto private methods computemethod ofRegPullnow private- Renamed
datatofyinRegPull.evaluateandRegAsProxyPull.evaluate - Made
get_layerinFullyConnectedprivate - Made
get_denseandload_embedsinCatEmbHeadprivate - Made
build_layersin 'ClassRegMulti` private - Made parse methods and
build_optinModelBuilderprivate - Made
get_foldsprivate - Changed
settingstoplot_settingsinrf_rank_features - Dense layer from
CatEmbHeadremoved and placed inFullyConnected - Swapped order of continuous and categorical embedding concatination in
CatEmbHeadin order to match input data arrinplot_kdes_from_bschanged tox- weighted partial dependencies in
plot_1d_partial_dependenceare now computed by passing the name of the weight coulmn in the dataframe and normalisation is done automatically dataargument forplot_binary_class_predrenamed todfplot_1d_partial_dependenceandplot_2d_partial_dependenceboth now expect to be passed a list on training features, rather than expecteing the DataFrame to only contain the trainign features- rfpimp package nolonger requires manual installation
Depreciations
- Passing
etaargument toto_pt_eta_phi. Will be removed in v0.4 binary_class_cutrenamed tobinary_class_cut_by_ams. Code added to callbinary_class_cut_by_ams. Will be removed in v0.4plot_dendrogramrenamed toplot_rank_order_dendrogram. Code added to callplot_rank_order_dendrogram. Will be removed in v0.4Embedderrenamed toCatEmbedder. Code added to callCatEmbedder. Will be removed in v0.4n_cont_in(number of continuous input features) argument ofModelBuilderdepreciated in favour ofcont_feats(list of named continuous input features). Code added to create this by encoding numbers as string. Will be removed in v0.4.
Comments
Online documentation to be created soon
- Python
Published by GilesStrong over 6 years ago
lumin - v0.2 Bonfire Lit
Important changes
- Residual mode in
FullyConnected:- Identity paths now skip two layers instead of one to align better with arXiv:1603.05027
- In cases where an odd number of layers are specified for the body, the number of layers is increased by one
- Batch normalisation now corrected to be after the addition step (previously was set before)
- Dense mode in
FullyConnectednow no longer adds an extra layer to scale down to the original width, insteadget_out_sizenow returns the width of the final concatinated layer and the tail of the network is expected to accept this input size - Fixed rule-of-thumb for embedding sizes from max(50, 1+(sz//2)) to max(50, (1+sz)//2)
Breaking
- Changed callbacks to receive
kargs, rather than logs to allow for great flexibility - Residual mode in
FullyConnected:- Identity paths now skip two layers instead of one to align better with arXiv:1603.05027
- In cases where an odd number of layers are specified for the body, the number of layers is increased by one
- Batch normalisation now corrected to be after the addition step (previously was set before)
- Dense mode in
FullyConnectednow no longer adds an extra layer to scale down to the original width, insteadget_out_sizenow returns the width of the final concatinated layer and the tail of the network is expected to accept this input size - Initialisation arguments for
CatEmbHeadchanged considerably w.r.t. embedding arguments; now expects to receive aEmbedderclass
Additions
- Added wrapper class for significance-based losses (
SignificanceLoss) - Added label smoothing for binary classification
- Added
on_eval_beginandon_eval_endcallback calls - Added
on_backwards_beginandon_backwards_endcallback calls - Added callbacks to
fold_lr_find - Added gradient-clipping callback
- Added default momentum range to
OneCycleof .85-.95 - Added
SequentialReweightclasses - Added option to turn of realtime loss plots
- Added
from_resultsandfrom_saveclassmethods forEnsemble - Added option to
SWAto control whether it only updates on cycle end when paired with anAbsCyclicalCallback - Added helper class
Embedderto simplify parsing of embedding settings - Added parameters to save and configure plots to
get_nn_feat_importance,get_ensemble_feat_importance, andrf_rank_features - Added classmethod for
Modelto load from save - Added experimental export to Tensorflow Protocol Buffer
Removals
Fixes
- Added missing data download cell for multiclass example
- Corrected type hint for
OneCycle lr_rangetoList - Corrected
on_train_endnot being called infold_train_ensemble - Fixed crash in
plot_featwhen plotting non-bulk without cuts, and non-crash bug when plotting non-bulk with cuts - Fixed typing of callbackargs in `foldtrain_ensemble`
- Fixed crash when trying to load model trained on cuda device for application on CPU device
- Fixed positioning of batch normalisation in residual mode of
FullyConnectedto after addition rf_rank_featureswas accidentally evaluating feature importance on validation data rather than training data, resulting in lower importances that it should- Fixed feature selection in examples using a test size of 0.8 rather than 0.2
- Fixed crash when no importnat features were found by
rf_rank_features - Fixed rule-of-thumb for embedding sizes from max(50, 1+(sz//2)) to max(50, (1+sz)//2)
- Fixed cutting when saving plots as pdf
Changes
- Moved
on_train_endcall infold_train_ensembleto after loading best set of weights - Replaced all mutable default arguments
Depreciations
- Callbacks:
- Added
callback_partialsparameter (a list of partials that yield a Callback object) infold_train_ensembleto eventually replacecallback_args; Neater appearance than previous Dict of object and kargs callback_argsnow depreciated, to be removed in v0.3- Currently
callback_argsare converted tocallback_partials, code will also be removed in v0.3
- Added
- Embeddings:
- Added
cat_embedderparameter toModelBuilderto eventuall replacecat_args cat_argsnow depreciated to be removed in v0.3- Currently
cat_argsare converted to anEmbedder, code will also be removed in v0.3
- Added
Comments
- Python
Published by GilesStrong over 6 years ago
lumin - v0.1 micro update
Change log
Breaking
binary_class_cutnow returns tuple of(cut, mean_AMS, maximum_AMS)as opposed to just the cut- Initialisation lookups now expected to return callable, rather than callable and dictionary of arguments.
partialused instead. top_percinbinary_class_cutnow treated as percentage rather than fraction
Additions
- Added PReLU activation
- Added uniform initialisation lookup
Removals
Fixes
uncert_roundconvertsNaNuncertainty to0- Correct name of internal embedding dropout layer in
CatEmbHead: emddo -> embdo - Adding missing settings for activations and initialisations to body and tail
- Corrected plot annotation for percentage in
binary_class_cut
Changes
- Removed the
BatchNorm1dautomatically added inCatEmbHeadwhen using categorical inputs; assuming unit-Gaussian continuous inputs, no a priori resaon to add it, and tests indicated it hurt performance and train-time. - Changed weighting factor when not loading loading cycles only to n+2 from n+1
Depreciations
Comments
- Python
Published by GilesStrong over 6 years ago
lumin - v0.1 PyPI am assuming direct control
1st Beta release
- Now available from PIP
- Various bug fixes and improvements
- Zenodo DOI
- Python
Published by GilesStrong almost 7 years ago