Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: index 15 is out of bounds for axis 1 with size 15 #2

Open
onlyff opened this issue Nov 25, 2017 · 0 comments
Open

IndexError: index 15 is out of bounds for axis 1 with size 15 #2

onlyff opened this issue Nov 25, 2017 · 0 comments

Comments

@onlyff
Copy link

onlyff commented Nov 25, 2017

hi,there are some errors when I run the code.
First, I exact features and get the comprehensive feature set(16 features):{'Connect_After': 5, 'Connect_Normal': 4, 'Connect_Weekend': 6, 'Disconnect': 7, 'Email_In': 9, 'Email_Out': 10, 'File_doc': 15, 'File_exe': 11, 'File_jpg': 12, 'File_txt': 14, 'File_zip': 13, 'Logoff': 3, 'Website': 8,
'Weekday_Logon_After': 1, 'Weekday_Logon_Normal': 0, 'Weekend_Logon': 2}, write "r42_features_complex.h5" to the disk.
Then I run "R4 Processing", when user_id is NGF0157, the user has 15 features, when compute the probability, the error is as follows:

in compute_probs(user_df)
37
38 print("timesTrained:",timesTrained)
---> 39 model.learn(seq, max_iters=20, threshold=0.01, restart_threshold=0.1,max_restarts=5, inertia=0.5)
40 timesTrained+=1
41

~\InsiderThreatDetection-master\HiddenMarkovModel\HiddenMarkovModel.py in learn(self, seq, max_iters, threshold, restart_threshold, max_restarts, inertia)
118 while(not done):
119
--> 120 forward_matrix, scaling_factors, log_prob = self.forward(seq, start = starts, trans=transitions, emiss= emissions)
121
122 backward_matrix = self.backward(seq, scaling_factors, start = starts, trans=transitions, emiss= emissions)

~\InsiderThreatDetection-master\HiddenMarkovModel\HiddenMarkovModel.py in forward(self, seq, start, trans, emiss)
45 for symbol_index, symbol in enumerate(seq[1:], start=1):
46
---> 47 forward_matrix[:,symbol_index] = emissions[:,symbol] * np.dot(forward_matrix[:,symbol_index-1], transitions)
48
49 # Normalise forward matrix

IndexError: index 15 is out of bounds for axis 1 with size 15

As we know, not every user has 16 features, how tore solve the problem when training HMM model? Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant