All Projects → DongjunLee → Text Cnn Tensorflow

DongjunLee / Text Cnn Tensorflow

Convolutional Neural Networks for Sentence Classification(TextCNN) implements by TensorFlow

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Text Cnn Tensorflow

COVID-19-Tweet-Classification-using-Roberta-and-Bert-Simple-Transformers
Rank 1 / 216
Stars: ✭ 24 (-89.66%)
Mutual labels:  sentiment-analysis, classification
XED
XED multilingual emotion datasets
Stars: ✭ 34 (-85.34%)
Mutual labels:  sentiment-analysis, classification
awesome-text-classification
Text classification meets word embeddings.
Stars: ✭ 27 (-88.36%)
Mutual labels:  sentiment-analysis, classification
Awesome-Tensorflow2
基于Tensorflow2开发的优秀扩展包及项目
Stars: ✭ 45 (-80.6%)
Mutual labels:  classification, tensorflow-models
Ml Classify Text Js
Machine learning based text classification in JavaScript using n-grams and cosine similarity
Stars: ✭ 38 (-83.62%)
Mutual labels:  classification, sentiment-analysis
textlytics
Text processing library for sentiment analysis and related tasks
Stars: ✭ 25 (-89.22%)
Mutual labels:  sentiment-analysis, classification
Aspect-Based-Sentiment-Analysis
A python program that implements Aspect Based Sentiment Analysis classification system for SemEval 2016 Dataset.
Stars: ✭ 57 (-75.43%)
Mutual labels:  sentiment-analysis, classification
Deep Atrous Cnn Sentiment
Deep-Atrous-CNN-Text-Network: End-to-end word level model for sentiment analysis and other text classifications
Stars: ✭ 64 (-72.41%)
Mutual labels:  classification, sentiment-analysis
DeepSentiPers
Repository for the experiments described in the paper named "DeepSentiPers: Novel Deep Learning Models Trained Over Proposed Augmented Persian Sentiment Corpus"
Stars: ✭ 17 (-92.67%)
Mutual labels:  sentiment-analysis, classification
FineGrainedVisualRecognition
Fine grained visual recognition tensorflow baseline on CUB, Stanford Cars, Dogs, Aircrafts, and Flower102.
Stars: ✭ 19 (-91.81%)
Mutual labels:  classification, tensorflow-models
Machine Learning From Scratch
Succinct Machine Learning algorithm implementations from scratch in Python, solving real-world problems (Notebooks and Book). Examples of Logistic Regression, Linear Regression, Decision Trees, K-means clustering, Sentiment Analysis, Recommender Systems, Neural Networks and Reinforcement Learning.
Stars: ✭ 42 (-81.9%)
Mutual labels:  classification, sentiment-analysis
Mem absa
Aspect Based Sentiment Analysis using End-to-End Memory Networks
Stars: ✭ 189 (-18.53%)
Mutual labels:  classification, sentiment-analysis
Shifterator
Interpretable data visualizations for understanding how texts differ at the word level
Stars: ✭ 209 (-9.91%)
Mutual labels:  sentiment-analysis
Timeseries fastai
fastai V2 implementation of Timeseries classification papers.
Stars: ✭ 221 (-4.74%)
Mutual labels:  classification
Deepsort
🧠 AI powered image tagger backed by DeepDetect
Stars: ✭ 209 (-9.91%)
Mutual labels:  classification
Chinese ulmfit
中文ULMFiT 情感分析 文本分类
Stars: ✭ 208 (-10.34%)
Mutual labels:  sentiment-analysis
Bayesian sentiment analysis
Pragmatic & Practical Bayesian Sentiment Classifier
Stars: ✭ 224 (-3.45%)
Mutual labels:  sentiment-analysis
Nncf
PyTorch*-based Neural Network Compression Framework for enhanced OpenVINO™ inference
Stars: ✭ 218 (-6.03%)
Mutual labels:  classification
Mobilenet V2
A Complete and Simple Implementation of MobileNet-V2 in PyTorch
Stars: ✭ 206 (-11.21%)
Mutual labels:  classification
Nlp4han
中文自然语言处理工具集【断句/分词/词性标注/组块/句法分析/语义分析/NER/N元语法/HMM/代词消解/情感分析/拼写检查】
Stars: ✭ 206 (-11.21%)
Mutual labels:  sentiment-analysis

text-cnn hb-research

This code implements Convolutional Neural Networks for Sentence Classification models.

  • Figure 1: Illustration of a CNN architecture for sentence classification

figure-1

Requirements

Project Structure

init Project by hb-base

.
├── config                  # Config files (.yml, .json) using with hb-config
├── data                    # dataset path
├── notebooks               # Prototyping with numpy or tf.interactivesession
├── scripts                 # download or prepare dataset using shell scripts
├── text-cnn                # text-cnn architecture graphs (from input to logits)
    ├── __init__.py             # Graph logic
├── data_loader.py          # raw_date -> precossed_data -> generate_batch (using Dataset)
├── hook.py                 # training or test hook feature (eg. print_variables)
├── main.py                 # define experiment_fn
├── model.py                # define EstimatorSpec
└── predict.py              # test trained model       

Reference : hb-config, Dataset, experiments_fn, EstimatorSpec

Todo

  • apply embed_type
    • CNN-rand
    • CNN-static
    • CNN-nonstatic
    • CNN-multichannel

Config

example: kaggle_movie_review.yml

data:
  type: 'kaggle_movie_review'
  base_path: 'data/'
  raw_data_path: 'kaggle_movie_reviews/'
  processed_path: 'kaggle_processed_data'
  testset_size: 25000
  num_classes: 5
  PAD_ID: 0

model:
  batch_size: 64
  embed_type: 'rand'     #(rand, static, non-static, multichannel)
  pretrained_embed: "" 
  embed_dim: 300
  num_filters: 256
  filter_sizes:
    - 2
    - 3
    - 4
    - 5
  dropout: 0.5

train:
  learning_rate: 0.00005
  
  train_steps: 100000
  model_dir: 'logs/kaggle_movie_review'
  
  save_checkpoints_steps: 1000
  loss_hook_n_iter: 1000
  check_hook_n_iter: 1000
  min_eval_frequency: 1000
  
slack:
  webhook_url: ""   # after training notify you using slack-webhook

Usage

Install requirements.

pip install -r requirements.txt

Then, prepare dataset and train it.

sh prepare_kaggle_movie_reviews.sh
python main.py --config kaggle_movie_review --mode train_and_evaluate

After training, you can try typing the sentences what you want using predict.py.

python python predict.py --config rt-polarity

Predict example

python predict.py --config rt-polarity
Setting max_seq_length to Config : 62
load vocab ...
Typing anything :)

> good
1
> bad
0

Experiments modes

✅ : Working
◽️ : Not tested yet.

  • evaluate : Evaluate on the evaluation data.
  • ◽️ extend_train_hooks : Extends the hooks for training.
  • ◽️ reset_export_strategies : Resets the export strategies with the new_export_strategies.
  • ◽️ run_std_server : Starts a TensorFlow server and joins the serving thread.
  • ◽️ test : Tests training, evaluating and exporting the estimator for a single step.
  • train : Fit the estimator using the training data.
  • train_and_evaluate : Interleaves training and evaluation.

Tensorboard

tensorboard --logdir logs

  • Category Color

category_image

  • rt-polarity (binary classification)

images

  • kaggle_movie_review (multiclass classification)

images

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].