ANN models¶
refann.element¶
refann.hpmodel¶
-
refann.hpmodel.models(key)[source]¶ Hyperparameter models.
Parameters: key (str) – Hyperparameter model that contains hyperparameters (such as activation function, batch normalization, dropout, etc.) used in the network. It can be ‘rec_1’ (no batch normalization) or ‘rec_2’ (with batch normalization). Returns: Hyperparameter model. Return type: object
refann.nodeframe¶
-
refann.nodeframe.decreasingNode(node_in=1970, node_out=5, hidden_layer=3, get_allNode=True)[source]¶ A network structure that the number of neurons in each hidden layer is decreased proportionally.
Parameters: - node_in (int) – The number of nodes in the input layer.
- node_out (int) – The number of nodes in the output layer.
- hidden_layer (int) – The number of the hidden layers.
- get_allNode (bool) – If True, return the number of all nodes, otherwise, only return the number of nodes of hidden layers. Default: True
Returns: A list that contains the number of nodes in each layer.
Return type:
-
refann.nodeframe.triangleNode_1(node_in=1, node_mid=1024, node_out=2, hidden_layer=5)[source]¶ A neural network structure that the number of neurons in each hidden layer is increased proportionally and then decreased proportionally, the number of nodes in the hidden layers is symmetrical.
Parameters: Returns: A list that contains the number of nodes in each layer.
Return type:
refann.sequence¶
-
class
refann.sequence.Activation[source]¶ Bases:
objectActivation functions, to be used by class LinearSeq
-
class
refann.sequence.BatchNorm[source]¶ Bases:
objectBatch Normalization, to be used by class LinearSeq
-
class
refann.sequence.LinearSeq(nodes, mainBN=True, finalBN=False, mainActive='relu', finalActive='None', mainDropout='None', finalDropout='None')[source]¶ Bases:
refann.sequence.SeqName,refann.sequence.BatchNorm,refann.sequence.Activation,refann.sequence.DropoutSequence of Linear
refann.fcnet¶
-
class
refann.fcnet.FcNet(nodes, mainActive='relu', finalActive='None', mainBN=False, finalBN=False, mainDropout='None', finalDropout='None')[source]¶ Bases:
torch.nn.modules.module.Module-
forward(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
refann.fcnet.get_FcNet(node_in=2000, node_out=6, hidden_layer=3, nodes=None, hparams={})[source]¶ Get a fully connected network.
Parameters: - node_in (int) – The number of the input nodes.
- node_out (int) – The number of the output nodes.
- hidden_layer (int) – The number of the hidden layers.
- nodes (None or list) – If list, it should be a collection of nodes of the network, e.g. [node_in, node_hidden1, node_hidden2, …, node_out]
- hparams (dict) – A dictionary of hyperparameters (or hidden parameters, such as the activation function,
the batch normalization, and the dropout) of the netwowrk. See
models().
refann.optimize¶
-
class
refann.optimize.LrDecay(iter_mid, iteration=10000, lr=0.1, lr_min=1e-06)[source]¶ Let the learning rate decay with iteration.
-
exp(gamma=0.999, auto_params=True)[source]¶ exponential decay
Parameters: auto_params (bool) – If True, gamma is set automatically. Returns: lr * gamma^iteration Return type: float
-
refann.train¶
refann.data_process¶
-
class
refann.data_process.InverseNormalize(x1, statistic={}, norm_type='z_score')[source]¶ Bases:
objectInverse transformation of class
Normalize.
-
class
refann.data_process.Normalize(x, statistic={}, norm_type='z_score')[source]¶ Bases:
objectNormalize data.
-
minmax()[source]¶ min-max normalization
Rescaling the range of features to scale the range in [0, 1] or [a,b] https://en.wikipedia.org/wiki/Feature_scaling
-