e914fb8d345d7d7ba7c2e3acaa1c51ad4d629e77,pyemma/util/discrete_trajectories.py,,sample_indexes_by_state,#Any#Any#Any#Any#,311

Before Change



    // list of states
    res = np.ndarray((len(subset)), dtype=object)
    for i in range(len(subset)):
        // sample the following state
        s = subset[i]
        // how many indexes are available?
        m_available = indexes[s].shape[0]
        // do we have no indexes for this state? Then insert empty array.
        if (m_available == 0):
            res[i] = np.zeros((0,2), dtype=int)
        elif replace:
            I = np.random.choice(m_available, nsample, replace=True)
            res[i] = indexes[s][I,:]
        else:
            I = np.random.choice(m_available, min(m_available,nsample), replace=False)
            res[i] = indexes[s][I,:]

    return res

After Change



    // list of states
    res = np.ndarray(len(subset), dtype=object)
    for i, s in enumerate(subset):
        // how many indexes are available?
        m_available = indexes[s].shape[0]
        // do we have no indexes for this state? Then insert empty array.
        if m_available == 0:
            res[i] = np.zeros((0,2), dtype=int)
        elif replace:
            I = np.random.choice(m_available, nsample, replace=True)
            res[i] = indexes[s][I,:]
        else:
            I = np.random.choice(m_available, min(m_available,nsample), replace=False)
            res[i] = indexes[s][I,:]

    return res
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: markovmodel/PyEMMA
Commit Name: e914fb8d345d7d7ba7c2e3acaa1c51ad4d629e77
Time: 2018-01-25
Author: m.scherer@fu-berlin.de
File Name: pyemma/util/discrete_trajectories.py
Class Name:
Method Name: sample_indexes_by_state


Project Name: markovmodel/PyEMMA
Commit Name: e914fb8d345d7d7ba7c2e3acaa1c51ad4d629e77
Time: 2018-01-25
Author: m.scherer@fu-berlin.de
File Name: pyemma/util/discrete_trajectories.py
Class Name:
Method Name: sample_indexes_by_distribution


Project Name: markovmodel/PyEMMA
Commit Name: e914fb8d345d7d7ba7c2e3acaa1c51ad4d629e77
Time: 2018-01-25
Author: m.scherer@fu-berlin.de
File Name: pyemma/util/discrete_trajectories.py
Class Name:
Method Name: sample_indexes_by_state


Project Name: geometalab/OSMDeepOD
Commit Name: 4eeabec420de5c8d6f3233be3d6c4f4ae9a47f0e
Time: 2016-04-29
Author: marcelhuberfoo@gmail.com
File Name: src/detection/deep/Convnet.py
Class Name: Convnet
Method Name: _to_numpy_array