Package: deepregression 2.2.0

deepregression: Fitting Deep Distributional Regression

Allows for the specification of semi-structured deep distributional regression models which are fitted in a neural network as proposed by Ruegamer et al. (2023) <doi:10.18637/jss.v105.i02>. Predictors can be modeled using structured (penalized) linear effects, structured non-linear effects or using an unstructured deep network model.

Authors:David Ruegamer [aut, cre], Christopher Marquardt [ctb], Laetitia Frost [ctb], Florian Pfisterer [ctb], Philipp Baumann [ctb], Chris Kolb [ctb], Lucas Kook [ctb]

deepregression_2.2.0.tar.gz
deepregression_2.2.0.zip(r-4.5)deepregression_2.2.0.zip(r-4.4)deepregression_2.2.0.zip(r-4.3)
deepregression_2.2.0.tgz(r-4.5-any)deepregression_2.2.0.tgz(r-4.4-any)deepregression_2.2.0.tgz(r-4.3-any)
deepregression_2.2.0.tar.gz(r-4.5-noble)deepregression_2.2.0.tar.gz(r-4.4-noble)
deepregression_2.2.0.tgz(r-4.4-emscripten)deepregression_2.2.0.tgz(r-4.3-emscripten)
deepregression.pdf |deepregression.html
deepregression/json (API)

# Install 'deepregression' in R:
install.packages('deepregression', repos = c('https://druegamer.r-universe.dev', 'https://cloud.r-project.org'))

On CRAN:

Conda-Forge:

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

2.28 score 1 packages 63 scripts 431 downloads 117 exports 67 dependencies

Last updated 3 months agofrom:e860bbd0c8. Checks:8 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKMar 02 2025
R-4.5-winOKMar 02 2025
R-4.5-macOKMar 02 2025
R-4.5-linuxOKMar 02 2025
R-4.4-winOKMar 02 2025
R-4.4-macOKMar 02 2025
R-4.3-winOKMar 02 2025
R-4.3-macOKMar 02 2025

Exports:%>%autogam_processorcheck_and_installcheck_input_args_fitcoef.deepregressioncollect_distribution_parameterscombine_penaltiescreate_familycreate_family_torchcreate_penaltycvdeepregressiondistfun_to_distensembleensemble.deepregressionextract_pure_gam_partextract_Sextractlenextractvalextractvalsextractvarfamily_to_tfdfamily_to_trafofamily_to_trafo_torchfamily_to_trochdfit.deepregressionfitted.deepregressionform_controlform2textfrom_distfun_to_dist_torchfrom_preds_to_distfrom_preds_to_dist_torchgam_plot_datagam_processorget_distributionget_ensemble_distributionget_gam_partget_gamdataget_gamdata_reduced_nrget_help_forward_torchget_layer_by_opnameget_layernr_by_opnameget_layernr_trainableget_luz_datasetget_names_pfcget_node_termget_nodedataget_partial_effectget_processor_nameget_specialget_type_pfcget_weight_by_nameget_weight_by_opnamehandle_gam_termint_processorinverse_group_lasso_penkeras_drlayer_add_identitylayer_concatenate_identitylayer_dense_torchlayer_generatorlayer_group_hadamardlayer_hadamardlayer_hadamard_difflayer_nodelayer_sparse_batch_normalizationlayer_sparse_conv_2dlayer_splinelayer_spline_torchlin_processorlog_scoremake_foldsmake_generator_from_matrixmake_tfd_distmake_torch_distmakeInputsmakelayernamemodel_torchmultioptimizerna_omit_listnames_familiesnode_processororthog_controlorthog_Porthog_structured_smooths_Zpen_layerpenalty_controlplot_cvplot.deepregressionprecalc_gampredict_gam_handlerpredict_genpredict.deepregressionprepare_dataprepare_newdataprepare_torch_distr_mixdistrprint.deepregressionquantre_layerregularizer_group_lassoreinit_weightsri_processorsimplyconnected_layerstddevstop_iter_cv_resultsubnetwork_initsubnetwork_init_torchtf_repeattf_row_tensortf_split_multipletf_stride_colstf_stride_last_dim_tensortib_layertibgroup_layertibgroup_layer_torchtiblinlasso_layer_torchweight_control

Dependencies:abindbackportsbase64encbitbit64callrclicolorspaceconfigcorocrayondescdplyrellipsisfansifarverfsgenericsglueherehmsjpegjsonlitekeraslabelinglatticelifecycleluzmagrittrMatrixmgcvmunsellnlmepillarpkgconfigpngprettyunitsprocessxprogresspspurrrR6rappdirsRColorBrewerRcppRcppTOMLreticulaterlangrprojrootrstudioapisafetensorsscalestensorflowtfautographtfprobabilitytfrunstibbletidyselecttorchtorchvisionutf8vctrsviridisLitewhiskerwithryamlzeallot

Readme and manuals

Help Manual

Help pageTopics
Function to check python environment and install necessary packagescheck_and_install
Function to check if inputs are supported by corresponding fit functioncheck_input_args_fit
Function to choose a kernel initializer for a torch layerchoose_kernel_initializer_torch
Method for extracting ensemble coefficient estimatescoef.drEnsemble
Character-to-parameter collection function needed for mixture of same distribution (torch)collect_distribution_parameters
Function to combine two penaltiescombine_penalties
Function to create (custom) familycreate_family
Function to create (custom) familycreate_family_torch
Function to create mgcv-type penaltycreate_penalty
Generic cv functioncv
Fitting Semi-Structured Deep Distributional Regressiondeepregression
Function to define output distribution based on dist_fundistfun_to_dist
Generic deep ensemble functionensemble
Ensembling deepregression modelsensemble.deepregression
Extract the smooth term from a deepregression term specificationextract_pure_gam_part
Convenience function to extract penalty matrix and valueextract_S
Formula helpersextractlen extractval extractvals form2text
Extract variable from termextractvar
Character-tfd mapping functionfamily_to_tfd
Character-to-transformation mapping functionfamily_to_trafo
Character-to-transformation mapping functionfamily_to_trafo_torch
Character-torch mapping functionfamily_to_trochd
Method for extracting the fitted values of an ensemblefitted.drEnsemble
Options for formula parsingform_control
Function to transform a distritbution layer output into a loss functionfrom_dist_to_loss
Function to transform a distribution layer output into a loss functionfrom_dist_to_loss_torch
Function to define output distribution based on dist_funfrom_distfun_to_dist_torch
Define Predictor of a Deep Distributional Regression Modelfrom_preds_to_dist
Define Predictor of a Deep Distributional Regression Modelfrom_preds_to_dist_torch
used by gam_processorgam_plot_data
Function to return the fitted distributionget_distribution
Obtain the conditional ensemble distributionget_ensemble_distribution
Extract gam part from wrapped termget_gam_part
Extract property of gamdataget_gamdata
Extract number in matching table of reduced gam termget_gamdata_reduced_nr
Helper function to calculate amount of layers Needed when shared layers are used, because of layers have same namesget_help_forward_torch
Function to return layer given model and nameget_layer_by_opname
Function to return layer number given model and nameget_layernr_by_opname
Function to return layer numbers with trainable weightsget_layernr_trainable
Helper function to create an function that generates R6 instances of class datasetget_luz_dataset
Extract term names from the parsed formula contentget_names_pfc
Extract variables from wrapped node termget_node_term
Extract attributes/hyper-parameters of the node termget_nodedata
Return partial effect of one smooth termget_partial_effect
Extract processor name from termget_processor_name
Extract terms defined by specials in formulaget_special
Function to subset parsed formulasget_type_pfc
Function to retrieve the weights of a structured layerget_weight_by_name
Function to return weight given model and nameget_weight_by_opname
Function to define smoothness and call mgcv's smooth constructorhandle_gam_term
Function to import required packagesimport_packages
Function to import required packages for tensorflow @import tensorflow tfprobability kerasimport_tf_dependings
Function to import required packages for torch @import torch torchvision luzimport_torch_dependings
Compile a Deep Distributional Regression Modelkeras_dr
Convenience layer functionlayer_add_identity layer_concatenate_identity
Function to create custom nn_linear module to overwrite reset_parameterslayer_dense_module
Function to define a torch layer similar to a tf dense layerlayer_dense_torch
Function that creates layer for each processorautogam_processor gam_processor int_processor layer_generator lin_processor node_processor ri_processor
NODE/ODTs Layerlayer_node
Sparse Batch Normalization layerlayer_sparse_batch_normalization
Sparse 2D Convolutional layerlayer_sparse_conv_2d
Function to define spline as TensorFlow layerlayer_spline
Function to define spline as Torch layerlayer_spline_torch
Function to return the log_scorelog_score
Function to loop through parsed formulas and apply data trafoloop_through_pfc_and_call_trafo
Generate folds for CV out of one hot encoded matrixmake_folds
creates a generator for trainingmake_generator
Make a DataGenerator from a data.frame or matrixmake_generator_from_matrix
Families for deepregressionmake_tfd_dist make_torch_dist
Convenience layer functionmakeInputs
Function that takes term and create layer namemakelayername
Function to initialize a nn_module Forward functions works with a list. The entries of the list are the input of the subnetworksmodel_torch
Function to define an optimizer combining multiple optimizersmultioptimizer
Function to exclude NA valuesna_omit_list
Returns the parameter names for a given familynames_families
custom nn_linear module to overwrite reset_parameters # nn_init_constant works only if value is scalar; so warmstarts for gam does'not worknn_init_no_grad_constant_deepreg
Options for orthogonalizationorthog_control
Function to compute adjusted penalty when orthogonalizingorthog_P
Orthogonalize a Semi-Structured Model Post-hocorthog_post_fitting
Orthogonalize structured term by another matrixorthog_structured_smooths_Z
Options for penalty setup in the pre-processingpenalty_control
Plot CV results from deepregressionplot_cv
Generic functions for deepregression modelscoef.deepregression cv.deepregression fit.deepregression fitted.deepregression mean.deepregression plot.deepregression predict.deepregression print.deepregression quant.deepregression stddev.deepregression
Pre-calculate all gam parts from the list of formulasprecalc_gam
Handler for prediction with gam termspredict_gam_handler
Generator function for deepregression objectspredict_gen
Function to prepare data based on parsed formulasprepare_data
Function to additionally prepare data for fit process (torch)prepare_data_torch
Function to prepare input list for fit process, due to different approachesprepare_input_list_model
Function to prepare new data based on parsed formulasprepare_newdata
Prepares distributions for mixture processprepare_torch_distr_mixdistr
Control function to define the processor for terms in the formulaprocess_terms
Generic quantile functionquant
random effect layerpen_layer re_layer
Generic function to re-intialize model weightsreinit_weights
Method to re-initialize weights of a '"deepregression"' modelreinit_weights.deepregression
Function to define orthogonalization connections in the formulaseparate_define_relation
Hadamard-type layers torchsimplyconnected_layer_torch tibgroup_layer_torch tiblinlasso_layer_torch tib_layer_torch
Generic sd functionstddev
Function to get the stoppting iteration from CVstop_iter_cv_result
Initializes a Subnetwork based on the Processed Additive Predictorsubnetwork_init
Initializes a Subnetwork based on the Processed Additive Predictorsubnetwork_init_torch
TensorFlow repeat function which is not available for TF 2.0tf_repeat
Row-wise tensor product using TensorFlowtf_row_tensor
Split tensor in multiple partstf_split_multiple
Function to index tensors columnstf_stride_cols
Function to index tensors last dimensiontf_stride_last_dim_tensor
For using mean squared error via TFPtfd_mse
Implementation of a zero-inflated negbinom distribution for TFPtfd_zinb
Implementation of a zero-inflated poisson distribution for TFPtfd_zip
Hadamard-type layersinverse_group_lasso_pen layer_group_hadamard layer_hadamard layer_hadamard_diff regularizer_group_lasso simplyconnected_layer tibgroup_layer tib_layer
Compile a Deep Distributional Regression Model (Torch)torch_dr
Function to update miniconda and packagesupdate_miniconda_deepregression
Options for weights of layersweight_control