Core objects, functions and statistics for working with biological data in Python.
Hello everyone, I had a quick statistic question I hope its ok to ask here.
I am trying to do linear interpolation for a set of data but have the end number no be between 0-1 but 0-15 how can I make the range correlate the results with 0-15?
I am using this formula to get the 0-1 between the range,
(ele.value - min) / (max - min)
dm_data[id_pos][id_pos]
also doesn't look quite right to me, but I always forget the fancy indexing rules for multi-dimensional arrays so I am probably wrong
Wait... do you want duplicate IDs? or should the IDs stay the same, just with bootstrapped data? I don't think distance matrix will allow proper bootstrapping of the IDs as they need to be unique and bootstrapping (if I recall correctly) requires random choices with replacement.
So you probably just need to bootstrap the data, in which case your code is close, but the index needs to be [id_pos][:, id_pos]
so that symmetry is preserved.
@wasade please correct me if I'm wrong
In [1]: import numpy as np
In [2]: x = np.reshape(np.arange(100), (10, 10))
In [3]: x
Out[3]:
array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[10, 11, 12, 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, 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]])
In [4]: r = np.random.choice(10, (10,), replace=True)
In [5]: r
Out[5]: array([9, 8, 2, 6, 9, 3, 7, 2, 2, 1])
In [6]: x[r][:, r]
Out[6]:
array([[99, 98, 92, 96, 99, 93, 97, 92, 92, 91],
[89, 88, 82, 86, 89, 83, 87, 82, 82, 81],
[29, 28, 22, 26, 29, 23, 27, 22, 22, 21],
[69, 68, 62, 66, 69, 63, 67, 62, 62, 61],
[99, 98, 92, 96, 99, 93, 97, 92, 92, 91],
[39, 38, 32, 36, 39, 33, 37, 32, 32, 31],
[79, 78, 72, 76, 79, 73, 77, 72, 72, 71],
[29, 28, 22, 26, 29, 23, 27, 22, 22, 21],
[29, 28, 22, 26, 29, 23, 27, 22, 22, 21],
[19, 18, 12, 16, 19, 13, 17, 12, 12, 11]])