trainCoxMlp
This function is the main entry point to building a Cox-nnet survival model. Returns the Cox-nnet model and the likelihood score.
Parameters:
x_train
- training set matrix. Expected numpy array.ytime_train
- time of death or censoring for each patientystatus_train
- censoring of each patientmodel_params = {}
- model parameters, see belowsearch_params = {}
- model search/training parameters, see belowverbose=True
- print more stuff.
model_params
is a dictionary of model parameters used in model training. It has the following parameters:
L2_reg
- Ridge regression parameter for regularization. Default value is numpy.exp(-1)node_map
- mapping of neurons in networkinput_split
- splitting of input layer for customization of the network architecture
The network architecture is defined by the node_map
and input_split
parameters. Setting these values to None will default to a neural network of one hidden layer with the number of neurons in the hidden layer = ceil( sqrt( # of input nodes )). input_split
is a list of lists with the indices of the inputs determining which sub-input layer each input belongs to. For example, if you want to split an input with four features into two groups of two: input_split = [[0,1], [2,3]].
node_map
defines the connections of the input layer (or sub-input layers). node_map list of list of triples (one list for each hidden layer). A triple defines the inputs of a sub-hidden layer and how many output nodes it has. I.e., ( # of input neurons, list of input sub-layers, # of output neurons). The simpleNetArch
function can be used to generate an architecture with a given number of hidden layer neurons.
search params
is a dictionary of search/optimization hyper-parameters. Generally the default values will work pretty well and you don't need to change these parameters.
method
- The algorithm for gradient descent. Includes standard gradient descent ("gradient"), Nesterov accelerated gradient "nesterov" and momentum gradient descent ("momentum"). Default is "nesterov".learning_rate
- Initial learning rate. Default is 0.01momentum
- proportion of momentum in momentum and nesterov gradients. Default is 0.9.lr_decay
- Decrease of the learning rate if the cost function is not decreasing. Default is 0.9lr_growth
- Increase of the learning rate if the cost function is decreasing. Default is 1.0 (i.e., it does not increase. Adding a small term could, e.g., 1.01, could improve speed).eval_step
- Number iterations between cost function evaluation in order to determine learning rate decay or growth. Setting this to a lower number will increase overhead. Default is 23.max_iter
- Maximum number of iterations. Default is 10000stop_threshold
- Threshold for stopping. If the cost does not decrease by this proportion, then allow the training to stop. Default is 0.995.patience
- Perform at least many iterations before stopping. Default is 2000.patience_incr
- If a new lowest cost is found, wait at least patience_incr * current iteration before stopping. Default is 2.rand_seed
- Random seed for initializing model parameters. Default is 123.