architecture
get_hidden_sizes(_L_in, l1, n=10)
¶
Generates a list of hidden sizes for a neural network with a given input size and l1 regularization. The list is generated by dividing the input size by 2 until the minimum size is reached.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_L_in |
int
|
input size. |
required |
l1 |
int
|
l1 regularization. |
required |
n |
int
|
number of hidden sizes to generate. |
10
|
Returns:
Type | Description |
---|---|
list
|
list of hidden sizes. |
Examples:
>>> from spotpython.hyperparameters.architecture import get_hidden_sizes
_L_in = 10
l1 = 10
n = 10
get_hidden_sizes(_L_in, l1, n)
[10, 5, 2, 1, 1, 1, 1, 1, 1, 1]
Source code in spotpython/hyperparameters/architecture.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|