autora.experimentalist.inequality
sample(conditions, reference_conditions, num_samples=1, equality_distance=0, metric='euclidean')
This inequality experimentalist chooses from the pool of IV conditions according to their inequality with respect to a reference pool reference_conditions. Two IVs are considered equal if their distance is less than the equality_distance. The IVs chosen first are feed back into reference_conditions and are included in the summed equality calculation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conditions
|
Union[DataFrame, ndarray]
|
pool of IV conditions to evaluate inequality |
required |
reference_conditions
|
Union[DataFrame, ndarray]
|
reference pool of IV conditions |
required |
num_samples
|
int
|
number of samples to select |
1
|
equality_distance
|
float
|
the distance to decide if two data points are equal. |
0
|
metric
|
str
|
inequality measure. Options: 'euclidean', 'manhattan', 'chebyshev',
'minkowski', 'wminkowski', 'seuclidean', 'mahalanobis', 'haversine',
'hamming', 'canberra', 'braycurtis', 'matching', 'jaccard', 'dice',
'kulsinski', 'rogerstanimoto', 'russellrao', 'sokalmichener',
'sokalsneath', 'yule'. See |
'euclidean'
|
Returns:
Type | Description |
---|---|
ndarray
|
Sampled pool |
Examples:
The value 1 is not in the reference. Therefore it is choosen.
>>> summed_inequality_sample([1, 2, 3], [2, 3, 4])
0
0 1
The equality distance is set to 0.4. 1 and 1.3 are considered equal, so are 3 and 3.1. Therefore 2 is choosen.
>>> summed_inequality_sample([1, 2, 3], [1.3, 2.7, 3.1], 1, .4)
0
0 2
The value 3 appears least often in the reference.
>>> summed_inequality_sample([1, 2, 3], [1, 1, 1, 2, 2, 2, 3, 3])
0
0 3
The experimentalist "fills up" the reference array so the values are contributed evenly
>>> summed_inequality_sample([1, 1, 1, 2, 2, 2, 3, 3, 3], [1, 1, 2, 2, 2, 2, 3, 3, 3], 3)
0
0 1
1 3
2 1
The experimentalist samples without replacemnt!
>>> summed_inequality_sample([1, 2, 3], [1, 1, 1], 3)
0
0 3
1 2
2 1
Source code in temp_dir/inequality/src/autora/experimentalist/inequality/__init__.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|