id_selection


This function selects a k dimension from the all dimensions (uniform selection).

id_selection(n_dimensions, n, k_dimension=False)

Input variables

</table> Output variables {: .label .label-yellow }
Name Description Type
n_dimensions Problem dimension Integer
n Number of dimensions to select Integer
k_dimension Default is False (Selects n dimensions among all dimensions). k_dimension=Integer Selects n dimensions among all dimensions, excluding k dimension Integer or Boolean
Name Description Type
selected selected dimensions List
report Report about the selection process String
Example 1 {: .label .label-blue } Select three dimension from five dimensions, except dimension 2 ($k=2$). ```python # Import # pip install metapy-toolbox or pip install --upgrade metapy-toolbox from metapy_toolbox import id_selection # or import * # Data nDimensions = 5 n = 3 excludedDimension = 2 # Call function selected, report = id_selection(nDimensions, n, excludedDimension) print(f'selected ids from dimensions: {selected} \n') print(report) ``` ```bash selected ids from dimensions: [4 3 0] Selection dimension operator probs = [0.25, 0.25, 0.0, 0.25, 0.25] the selected dimensions = [4 3 0] ``` Example 2 {: .label .label-blue } Select three dimension from five dimensions. ```python # Import # pip install metapy-toolbox or pip install --upgrade metapy-toolbox from metapy_toolbox import id_selection # or import * # Data nDimensions = 5 n = 3 # Call function selected, report = id_selection(nDimensions, n) print(f'selected ids from dimensions: {selected} \n') print(report) ``` ```bash selected ids from dimensions: [2 0 4] Selection dimension operator probs = [0.2, 0.2, 0.2, 0.2, 0.2] the selected dimensions = [2 0 4] ```