Get names of features. Returns ------- result : list List with names of features.
(self)
| 2573 | return out_num_feature.value |
| 2574 | |
| 2575 | def feature_name(self): |
| 2576 | """Get names of features. |
| 2577 | |
| 2578 | Returns |
| 2579 | ------- |
| 2580 | result : list |
| 2581 | List with names of features. |
| 2582 | """ |
| 2583 | num_feature = self.num_feature() |
| 2584 | # Get name of features |
| 2585 | tmp_out_len = ctypes.c_int(0) |
| 2586 | string_buffers = [ctypes.create_string_buffer(255) for i in range_(num_feature)] |
| 2587 | ptr_string_buffers = (ctypes.c_char_p * num_feature)(*map(ctypes.addressof, string_buffers)) |
| 2588 | _safe_call(_LIB.LGBM_BoosterGetFeatureNames( |
| 2589 | self.handle, |
| 2590 | ctypes.byref(tmp_out_len), |
| 2591 | ptr_string_buffers)) |
| 2592 | if num_feature != tmp_out_len.value: |
| 2593 | raise ValueError("Length of feature names doesn't equal with num_feature") |
| 2594 | return [string_buffers[i].value.decode() for i in range_(num_feature)] |
| 2595 | |
| 2596 | def feature_importance(self, importance_type='split', iteration=None): |
| 2597 | """Get feature importances. |