@@ -465,19 +465,19 @@ def load_from_file(self, path):
465
465
n_feature = (c_int * 1 )()
466
466
thundersvm .get_sv_max_index (c_void_p (self .model ), n_feature )
467
467
self .n_features = n_feature [0 ]
468
-
469
468
csr_row = (c_int * (self .n_sv + 1 ))()
470
469
csr_col = (c_int * (self .n_sv * self .n_features ))()
471
470
csr_data = (c_float * (self .n_sv * self .n_features ))()
472
471
data_size = (c_int * 1 )()
473
- thundersvm .get_sv (csr_row , csr_col , csr_data , data_size , c_void_p (self .model ))
472
+ sv_indices = (c_int * self .n_sv )()
473
+ thundersvm .get_sv (csr_row , csr_col , csr_data , data_size , sv_indices , c_void_p (self .model ))
474
474
self .row = np .array ([csr_row [index ] for index in range (0 , self .n_sv + 1 )])
475
475
self .col = np .array ([csr_col [index ] for index in range (0 , data_size [0 ])])
476
476
self .data = np .array ([csr_data [index ] for index in range (0 , data_size [0 ])])
477
477
self .support_vectors_ = sp .csr_matrix ((self .data , self .col , self .row ))
478
478
# if self._sparse == False:
479
479
# self.support_vectors_ = self.support_vectors_.toarray(order = 'C')
480
-
480
+ self . support_ = np . array ([ sv_indices [ index ] for index in range ( 0 , self . n_sv )]). astype ( int )
481
481
dual_coef = (c_float * ((self .n_classes - 1 ) * self .n_sv ))()
482
482
thundersvm .get_coef (dual_coef , self .n_classes , self .n_sv , c_void_p (self .model ))
483
483
self .dual_coef_ = np .array ([dual_coef [index ] for index in range (0 , (self .n_classes - 1 ) * self .n_sv )]).astype (float )
0 commit comments