def transition_features(self): data_frame = eli5.format_as_dataframes( eli5.explain_weights_sklearn_crfsuite(self.crf)) return list( zip(data_frame['transition_features']['from'], data_frame['transition_features']['coef'], data_frame['transition_features']['to']))
def weight_targets(self): data_frame = eli5.format_as_dataframes( eli5.explain_weights_sklearn_crfsuite(self.crf, top=2**10000)) return list( zip(data_frame['targets']['target'], data_frame['targets']['feature'], data_frame['targets']['weight']))
def transition_features_to_csv(self): data_frame = eli5.format_as_dataframes( eli5.explain_weights_sklearn_crfsuite(self.crf)) data_frame['transition_features'].to_csv(os.path.abspath( 'server/nlp/data/data_transition_features.csv')) return 'ok'
def state_features_to_csv(self): data_frame = eli5.format_as_dataframes( eli5.explain_weights_sklearn_crfsuite(self.crf, top=2**10000)) data_frame['targets'].to_csv(os.path.abspath( 'server/nlp/data/data_state_features.csv')) return 'ok'