Giter VIP home page Giter VIP logo

neuralnlp-neuralclassifier's Introduction

NeuralClassifier Logo

NeuralClassifier: An Open-source Neural Hierarchical Multi-label Text Classification Toolkit

Introduction

NeuralClassifier is designed for quick implementation of neural models for hierarchical multi-label classification task, which is more challenging and common in real-world scenarios. A salient feature is that NeuralClassifier currently provides a variety of text encoders, such as FastText, TextCNN, TextRNN, RCNN, VDCNN, DPCNN, DRNN, AttentiveConvNet and Transformer encoder, etc. It also supports other text classification scenarios, including binary-class and multi-class classification. It is built on PyTorch. Experiments show that models built in our toolkit achieve comparable performance with reported results in the literature.

Support tasks

  • Binary-class text classifcation
  • Multi-class text classification
  • Multi-label text classification
  • Hiearchical (multi-label) text classification (HMC)

Support text encoders

Requirement

  • Python 3
  • PyTorch 0.4+
  • Numpy 1.14.3+

System Architecture

NeuralClassifier Architecture

Usage

Training

How to train a non-hierarchical classifier

python train.py conf/train.json 
  • set task_info.hierarchical = false.
  • model_name can be FastText、TextCNN、TextRNN、TextRCNN、DRNN、VDCNN、DPCNN、AttentiveConvNet、Transformer.

How to train a hierarchical classifier using hierarchial penalty

python train.py conf/train.hierar.json
  • set task_info.hierarchical = true.
  • model_name can be FastText、TextCNN、TextRNN、TextRCNN、DRNN、VDCNN、DPCNN、AttentiveConvNet、Transformer

How to train a hierarchical classifier with HMCN

python train.py conf/train.hmcn.json 
  • set task_info.hierarchical = false.
  • set model_name = HMCN

Detail configurations and explanations see Configuration.

The training info will be outputted in standard output and log.logger_file.

Evaluation

python eval.py conf/train.json
  • if eval.is_flat = false, hierarchical evaluation will be outputted.
  • eval.model_dir is the model to evaluate.
  • data.test_json_files is the input text file to evaluate.

The evaluation info will be outputed in eval.dir.

Prediction

python predict.py conf/train.json data/predict.json 
  • predict.json should be of json format, while each instance has a dummy label like "其他" or any other label in label map.
  • eval.model_dir is the model to predict.
  • eval.top_k is the number of labels to output.
  • eval.threshold is the probability threshold.

The predict info will be outputed in predict.txt.

Input Data Format

JSON example:

{
    "doc_label": ["Computer--MachineLearning--DeepLearning", "Neuro--ComputationalNeuro"],
    "doc_token": ["I", "love", "deep", "learning"],
    "doc_keyword": ["deep learning"],
    "doc_topic": ["AI", "Machine learning"]
}

"doc_keyword" and "doc_topic" are optional.

Performance

0. Dataset

DatasetTaxonomy#Label#Training#Test
RCV1Tree10323,149781,265
YelpDAG53987,37537,265

1. Compare with state-of-the-art

Text EncodersMicro-F1 on RCV1Micro-F1 on Yelp
HR-DGCNN (Peng et al., 2018)0.7610-
HMCN (Wehrmann et al., 2018)0.80800.6640
Ours0.83130.6704

2. Different text encoders

Text EncodersRCV1Yelp
Micro-F1Macro-F1Micro-F1Macro-F1
TextCNN0.77170.52460.62810.3657
TextRNN0.81520.54580.67040.4059
RCNN0.83130.60470.65690.3951
FastText0.68870.2701 0.60310.2323
DRNN0.7846 0.51470.65790.4401
DPCNN0.8220 0.5609 0.5671 0.2393
VDCNN0.7263 0.38600.63950.4035
AttentiveConvNet0.75330.43730.63670.4040
RegionEmbedding0.7780 0.4888 0.66010.4514
Transformer0.7603 0.42740.65330.4121
Star-Transformer0.7668 0.48400.64820.3895

3. Hierarchical vs Flat

Text EncodersHierarchicalFlat
Micro-F1Macro-F1Micro-F1Macro-F1
TextCNN0.77170.52460.73670.4224
TextRNN0.81520.54580.7546 0.4505
RCNN0.83130.60470.79550.5123
FastText0.68870.2701 0.68650.2816
DRNN0.7846 0.51470.75060.4450
DPCNN0.8220 0.5609 0.7423 0.4261
VDCNN0.7263 0.38600.71100.3593
AttentiveConvNet0.75330.43730.75110.4286
RegionEmbedding0.7780 0.4888 0.76400.4617
Transformer0.7603 0.42740.76020.4339
Star-Transformer0.7668 0.48400.76180.4745

Acknowledgement

Some public codes are referenced by our toolkit:

Update

  • 2019-04-29, init version

neuralnlp-neuralclassifier's People

Contributors

coderbyr avatar entropy2333 avatar github30 avatar jamestang0219 avatar jtyoui avatar liqunhit avatar magiasn avatar sannyzhou avatar yuwailaifeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neuralnlp-neuralclassifier's Issues

关于Multi-label text classification的疑问

请问对于 textcnn 而言,做 Binary-class text classifcation、Multi-class text classification、Multi-label text classification 这三个任务,实现区别有哪些不同?看了下代码,只看到 loss 和 evaluate 有点不一样

'is_flat' in evaluate function

The annotation in your 'classification_evaluate.py' indicates that it would calculate hierarchical result if is_flat is false. What is the difference between flat and hierarchical results?
if not is_flat: hierarchical_labels = label_name.split(sep)
Could you provide an example of input in the condition of hierarchical measurement results?

IndexError: tensors used as indices must be long, byte or bool tensors

Thanks for your jobs!
I want to use this framework to handle multi-label classification task without hierarchical and I set "task_info.hierarchical"=false in conf/train.json. However, I have encountered this problem. Can you tell me how can I use this framwork without hierarchical?

"AssertionError: Label is empty: xx"

请问为什么会出现这种情况呀,这个词是在rcv1_train.json里的,但还是会出现这个问题,我也把"min_token_count": 0, "min_char_count": 0, "token_ngram": 0, "min_token_ngram_count": 0, "min_keyword_count": 0, "min_topic_count": 0这些都调成0了还是不行

Sequence Labeling Task

Thank you all for this awesome framwork.

Do you have plans to support the "Sequence Labeling" task?

关于层次多标签分类算法的问题

你好,

我最近也在做层次多标签的相关研究,我大概看了下代码,这里面使用的方法好像就是Large-Scale Hierarchical Text Classification with Recursively Regularized Deep Graph-CNN里的方法,不知道为什么在结果对比的时候会差这么多?
截屏2020-02-27下午5 32 56
具体是做了什么改进呢?
谢谢!

How is hierarchical vs flat compared in section 3?

In section 3 of readme, the table shows the reuslt of hierarchical vs flat. Here does hierarchical mean that model has hierarchical regularization or just mean the evaluation value is the value with is_flat False in the code? Does flat means that the model does not have hierarchical regularization (hierar_penalty=0) or just mean that the evaluation value is caculated with is_flat True in the code?

About RCV1-v2 Dataset Train-Dev-Test Split

Hi,

Excellent work of providing this useful toolkit. I have some questions on the train-dev-split for RCV1-v2 dataset.

I noticed that you follow the standard split provided by Lewis et al. (2004). However, there is no standard dev set split.

Could you give the ID (or date range in the tag ) from raw data of dev set for me? Or you may use random split, could you tell me that where the dev set is drawn from (i.e. training set)?

请问.taxonomy文件怎么生成

你好,非常感谢你们的工作!我看到你们对于标签的表示是.taxonomy文件,请问这个文件是怎么生成的?谢谢

How to get the classification of data?

I have been using my own annotated data to train the model, and now if I want to know the classification of one documents without annotation, what should I do?

Reproduce results from paper

Thank you for making this code open and available to the community. It is easy to use. My issue is that I do not obtain the same results that you present in Table 4 of your paper.

When I train the TextCNN model on the RCV1 data set using the parameters you provide in config/train.json, I obtain a micro F1 score of 0.739. When I set hierarchical=false, I obtain a micro F1 score of 0.732. Your table shows a micro F1 score of 0.761 (hierarchical) and 0.737 (flat).

Similarly, when I train the TextRNN model using the default configuration file with model_name=TextRNN, I find a micro F1 score of 0.793 with hierarchical loss, and a micro F1 score of 0.792 without hierarchical loss. Your table shows a micro F1 score of 0.789 (hierarchical) and 0.755 (flat).

Are you able to directly reproduce Table 4 with the configuration in this repo, or is your configuration different (and if so, can you share it)?

Reproducing the results on RCV1

I've tried everything that was mentioned in reply to various issues but I am still not able to reproduce the results given in the README.

  • I used the complete RCV1 dataset consisting of 23149 train and 781265 test documents
  • Used GloVe 300d embeddings for initialization glove.6B.300d.txt

The results that I have got are:

-- Micro F1 Macro F1
Flat 0.8354 0.5801
Hierarchical 0.8360 0.5798

Can you share the json configuration files used for getting the values you have reported?

visible_device_list

Hi, in case of having multiple GPUs, how should we specify them as visible_device_list in config file? For example for GPUs with indexes 0 to 2, should we place them in a list like [0,1,2] or some special delimiter/format must be used?
Thank you

Clarification around rcv1.taxonomy file

Hi, Thanks for this really nice repository on text classification. Had a question regarding how the taxonomy file should be structured for any hierarchical classification problem (couldn't find anything on the readme regarding that).

For an example problem where the possible hierarchies looks as follows
Screenshot 2020-01-09 at 11 14 29 AM

All-Science
All-Science-NaturalScience
All-Science-NaturalScience-Biology
All-Humanities
All-Humanities-History
All-Humanities-History-WorldHistory
All-Vocabulary
All-Vocabulary-ReadingVocabulary

How should the taxonomy file be set up?

IndexError: index 96 is out of bounds for axis 0 with size 96

你好,我在自己的数据上跑时,总是显示题目中的错误:
File "/home/jsun/NeuralNLP-NeuralClassifier-master/evaluate/classification_evaluate.py", line 270, in evaluate
if prob_np[predict_label_idx[j]] > threshold:
然后这是我的数据格式:
{"doc_label": ["label_06"], "doc_token": ["右", "侧", "甲", "状", "腺", "叶", "切", "除", "术"], "doc_keyword": [], "doc_topic": []}
在rcv1中跑却没错。

Different formula used for Macro F1

The formula for macro F1 given in "Recursive Regularization for Large-scale Classification with Hierarchical and Graphical Dependencies" paper is
image

But your code uses
image

Is there any reason for this?

多分类问题,evaluate计算precision recall方式是不是有些问题

classification_evaluate.py 中注意到下面这几行代码,对于单标签的多分类问题predict_total和standard_total的值是不是一直都相等?计算出的precision和recall也是相等的,这样的指标好像没有太大意义

(precision_dict[self.MICRO_AVERAGE], recall_dict[self.MICRO_AVERAGE], fscore_dict[self.MICRO_AVERAGE]) = \ self._calculate_prf(right_total, predict_total, standard_total) return precision_dict, recall_dict, fscore_dict

f-score is equal to zero

I have run train.py with this config and after 13 epoch I still get 0 fscore.

Config:

{
  "task_info":{
    "label_type": "multi_label",
    "hierarchical": true,
    "hierar_taxonomy": "data/rcv1.taxonomy",
    "hierar_penalty": 0.000001
  },
  "device": "cuda",
  "model_name": "TextCNN",
  "checkpoint_dir": "checkpoint_dir_rcv1",
  "model_dir": "trained_model_rcv1",
  "data": {
    "train_json_files": [
      "data/rcv1_train.json"
    ],
    "validate_json_files": [
      "data/rcv1_dev.json"
    ],
    "test_json_files": [
      "data/rcv1_test.json"
    ],
    "generate_dict_using_json_files": false,
    "generate_dict_using_all_json_files": false,
    "generate_dict_using_pretrained_embedding": false,
    "dict_dir": "dict_rcv1",
    "num_worker": 4
  },
  "feature": {
    "feature_names": [
      "token"
    ],
    "min_token_count": 2,
    "min_char_count": 2,
    "token_ngram": 0,
    "min_token_ngram_count": 0,
    "min_keyword_count": 0,
    "min_topic_count": 2,
    "max_token_dict_size": 1000000,
    "max_char_dict_size": 150000,
    "max_token_ngram_dict_size": 10000000,
    "max_keyword_dict_size": 100,
    "max_topic_dict_size": 100,
    "max_token_len": 256,
    "max_char_len": 1024,
    "max_char_len_per_token": 4,
    "token_pretrained_file": "",
    "keyword_pretrained_file": ""
  },
  "train": {
    "batch_size": 64,
    "start_epoch": 1,
    "num_epochs": 20,
    "num_epochs_static_embedding": 0,
    "decay_steps": 1000,
    "decay_rate": 1.0,
    "clip_gradients": 100.0,
    "l2_lambda": 0.0,
    "loss_type": "BCEWithLogitsLoss",
    "sampler": "fixed",
    "num_sampled": 5,
    "visible_device_list": "0",
    "hidden_layer_dropout": 0.5
  },
  "embedding": {
    "type": "embedding",
    "dimension": 64,
    "region_embedding_type": "context_word",
    "region_size": 5,
    "initializer": "uniform",
    "fan_mode": "FAN_IN",
    "uniform_bound": 0.25,
    "random_stddev": 0.01,
    "dropout": 0.0
  },
  "optimizer": {
    "optimizer_type": "Adam",
    "learning_rate": 0.008,
    "adadelta_decay_rate": 0.95,
    "adadelta_epsilon": 1e-08
  },
  "TextCNN": {
    "kernel_sizes": [
      2,
      3,
      4
    ],
    "num_kernels": 100,
    "top_k_max_pooling": 1
  },
  "TextRNN": {
    "hidden_dimension": 64,
    "rnn_type": "GRU",
    "num_layers": 1,
    "doc_embedding_type": "Attention",
    "attention_dimension": 16,
    "bidirectional": true
  },
  "DRNN": {
    "hidden_dimension": 5,
    "window_size": 3,
    "rnn_type": "GRU",
    "bidirectional": true,
    "cell_hidden_dropout": 0.1
  },
  "eval": {
    "text_file": "data/rcv1_test.json",
    "threshold": 0.5,
    "dir": "eval_dir",
    "batch_size": 1024,
    "is_flat": true,
    "top_k": 30,
    "model_dir": "checkpoint_dir_rcv1/TextCNN_best"
  },
  "TextVDCNN": {
    "vdcnn_depth": 9,
    "top_k_max_pooling": 8
  },
  "DPCNN": {
    "kernel_size": 3,
    "pooling_stride": 2,
    "num_kernels": 16,
    "blocks": 2
  },
  "TextRCNN": {
    "kernel_sizes": [
        2,
        3,
        4
    ],
    "num_kernels": 100,
    "top_k_max_pooling": 1,
    "hidden_dimension":64,
    "rnn_type": "GRU",
    "num_layers": 1,
    "bidirectional": true
  },
  "Transformer": {
    "d_inner": 128,
    "d_k": 32,
    "d_v": 32,
    "n_head": 4,
    "n_layers": 1,
    "dropout": 0.1,
    "use_star": true
  },
  "AttentiveConvNet": {
    "attention_type": "bilinear",
    "margin_size": 3,
    "type": "advanced",
    "hidden_size": 64
  },
  "log": {
    "logger_file": "log_test_rcv1_hierar",
    "log_level": "warn"
  }
}

Result:

Size of doc_token dict is 0
Size of doc_char dict is 0
Size of doc_token_ngram dict is 0
Size of doc_keyword dict is 0
Size of doc_topic dict is 0
Shrink dict over.
Size of doc_label dict is 100
Size of doc_token dict is 0
Size of doc_char dict is 0
Size of doc_token_ngram dict is 0
Size of doc_keyword dict is 0
Size of doc_topic dict is 0
Train performance at epoch 1 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.176090.
Validate performance at epoch 1 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.175878.
test performance at epoch 1 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.176301.
Epoch 1 cost time: 273 second
Train performance at epoch 2 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.185657.
Validate performance at epoch 2 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.185401.
test performance at epoch 2 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.185863.
Epoch 2 cost time: 275 second
Train performance at epoch 3 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.179540.
Validate performance at epoch 3 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.179308.
test performance at epoch 3 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.179765.
Epoch 3 cost time: 274 second
Train performance at epoch 4 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.181358.
Validate performance at epoch 4 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.181102.
test performance at epoch 4 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.181564.
Epoch 4 cost time: 274 second
Train performance at epoch 5 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.177109.
Validate performance at epoch 5 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.176923.
test performance at epoch 5 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.177328.
Epoch 5 cost time: 274 second
Train performance at epoch 6 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.180688.
Validate performance at epoch 6 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.180476.
test performance at epoch 6 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.180903.
Epoch 6 cost time: 275 second
Train performance at epoch 7 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.177683.
Validate performance at epoch 7 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.177484.
test performance at epoch 7 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.177902.
Epoch 7 cost time: 278 second
Train performance at epoch 8 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.180226.
Validate performance at epoch 8 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.179987.
test performance at epoch 8 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.180454.
Epoch 8 cost time: 277 second
Train performance at epoch 9 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.176957.
Validate performance at epoch 9 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.176734.
test performance at epoch 9 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.177183.
Epoch 9 cost time: 277 second
Train performance at epoch 10 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.192425.
Validate performance at epoch 10 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.192209.
test performance at epoch 10 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.192622.
Epoch 10 cost time: 275 second
Train performance at epoch 11 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.181247.
Validate performance at epoch 11 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.181020.
test performance at epoch 11 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.181468.
Epoch 11 cost time: 277 second
Train performance at epoch 12 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.179442.
Validate performance at epoch 12 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.179230.
test performance at epoch 12 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.179660.
Epoch 12 cost time: 276 second
Train performance at epoch 13 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 259686.
Loss is: 0.182252.
Validate performance at epoch 13 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 28687.
Loss is: 0.182036.
test performance at epoch 13 is precision: 0.000000, recall: 0.000000, fscore: 0.000000, macro-fscore: 0.000000, right: 0, predict: 0, standard: 72472.
Loss is: 0.182464.```

doc_label的格式问题

你好!感谢你们的工作!我在跑hierarchical+multi-label模型的时候发现readme和paper的给的doc_label的格式跟data/rcv1_train.json和taxonomy有些出入,想请教一下正确的输入格式是什么:

readme里给的例子是这样的
"doc_label": ["Computer--MachineLearning--DeepLearning", "Neuro--ComputationalNeuro"]

我的理解为这个数据点有两个label,然后Computer为MachineLearning的上一层,MachineLearning为DeepLearning的上一层

但是在data/rcv1_train.json里面的doc_label是下面的格式
"doc_label": ["E131", "E13", "E211", "E21", "ECAT"]
这里没有用"--"做分割,而且我的理解是"E13"是"E131"的上一层,所以这里的doc_label包含了每一层的label,跟readme的格式是冲突的

如果我不用"--"的话,eval.py就无法对每一层分别做测评了

但是用"--"的话cal_recursive_regularize又无法正确使用,因为hierar_relations是直接根据label_map生成的,而label_map里只有"Computer--MachineLearning--DeepLearning"这样的label,而不会有"Computer"这样的label,这样一来cal_recursive_regularize不起作用,导致hierarchy的信息完全没用到。。。

About Focal Loss

您好,代码中有SIgmoidFocal Loss和 Softmax FocalLoss,请问有这两种loss的实验结果对比吗

Hierarchical can not work for the example

can you provide a version for hierarchical classification? The example is just for muti-label without hierar. The hierar_taxonomy is just for cal_recursive_regularize, which does not work for hierar.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.