You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 26, 2018. It is now read-only.
def sim_migration_to_default(trans_mat, max_wgt_defaults=0.5, max_iter=1000, wgt_states=None):
import numpy as np
# number of states
num_states = trans_mat.shape[0];
# weights for each states (sum equals 1)
if wgt_states is None:
wgt_states = np.ones((1,num_states)) / num_states;
#wgt_states = np.zeros((1,num_states)); wgt_states[0,0] = 1.
# loop
it = 1
while wgt_states[0,-1] < max_wgt_defaults:
wgt_states = np.dot(wgt_states, trans_mat);
if it >= max_iter:
return None, wgt_states;
else:
it += 1;
# in case the while loop aborted, return the periods
return it, wgt_states;
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
modes
example code
The text was updated successfully, but these errors were encountered: