AREnets
AREnets -- is an OpenNRE like project, but the kernel based on tensorflow
library, with implementation of neural networks on top of it, designed for Attitude and Relation Extraction tasks.
AREnets is a result of advances in Sentiment Attitude Extraction task
but introduced in generalized form and applicable for other relation-extraction related classification tasks.
It provides ready to use neural networks and API for subject→object pairs classification in a given samples.
This project is powered by
AREkit
core API, squeezed into a tiny
kernel.
Contents
Installation
pip install git+https://github.com/nicolay-r/AREnets@master
Quick Start
Simply just open and follow the google-colab version like IDE to modify the train and inference code of provided tutorial:
The complete examples are in tutorials folder.
First of all, prepare your _data folder with data required for training model and performing inference.
- Input samples: check out input data formatting guide.
- Embeddings could be obtained from NLPL repository,
with
model.txtfile placed at_datafolder;- See downloading script;
More on input features could be found here.
Train
from arenets.quickstart.train import train
from arenets.enum_name_types import ModelNames
train(input_data_dir="_data", labels_count=3, model_name=ModelNames.CNN, epochs_count=10)
Runs cnn model with 10 epochs for 3-class classification problem;
all the model-related details will be stored at _data model by default.
Predict
from arenets.quickstart.predict import predict
from arenets.arekit.common.data_type import DataType
from arenets.enum_name_types import ModelNames
predict(input_data_dir="_data", output_dir="_out", labels_count=3, model_name=ModelNames.CNN, data_type=DataType.Test)
Predict test results for pre-trained cnn model and saves them into _out folder
Models List
- Aspect-based Attentive encoders:
- Multilayer Perceptron (MLP) [code] / [github:nicolay-r];
- Self-based Attentive encoders:
- P. Zhou et. al. [code] / [github:SeoSangwoo];
- Z. Yang et. al. [code] / [github:ilivans];
- Single Sentence Based Architectures:
- CNN [code] / [github:roomylee];
- CNN + Aspect-based MLP Attention [code];
- PCNN [code] / [github:nicolay-r];
- PCNN + Aspect-based MLP Attention [code];
- RNN (LSTM/GRU/RNN) [code] / [github:roomylee];
- IAN (frames based) [code] / [github:lpq29743];
- RCNN (BiLSTM + CNN) [code] / [github:roomylee];
- RCNN + Self Attention [code];
- BiLSTM [code] / [github:roomylee];
- Bi-LSTM + Aspect-based MLP Attention [code]
- Bi-LSTM + Self Attention [code] / [github:roomylee];
- RCNN + Self Attention [code];
- Multi Sentence Based Encoders Architectures:
FAQ
How to prepare input data?
How to setup jsonl or csv data reader?
How to implement a custom model with attention?
How to customize the prediction output?
Test Details
This project has been tested under the following setup:
- NVidia GTX-1060/1080 TI
- CUDA compilation tools, release 10.0, V10.0.130
- Python 3.6.9
- Pandas 0.25.3 (Optional, only for
CSVreading) - Pip freeze package list
How to cite
Our one and my personal interest is to help you better explore and analyze attitude and relation extraction related tasks with AREnets. A great research is also accompanied with the faithful reference. if you use or extend our work, please cite as follows:
@misc{arenets2023,
author={Nicolay Rusnachenko},
title={{AREnets}: Tensorflow-based framework of attentive neural-network
models for text classfication and relation extraction tasks},
year={2023},
url={https://github.com/nicolay-r/AREnets},
}
Metadata
Release files for arenets 0.23.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| arenets-0.23.1.tar.gz | 155.9 kB | Without provenance | Details for arenets-0.23.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| arenets-0.23.1-py3-none-any.whl | Python 3 | none | any | Details for arenets-0.23.1-py3-none-any.whl |
Total release size: 380.4 kB
Release files / arenets-0.23.1.tar.gz
| Download URL | arenets-0.23.1.tar.gz |
|---|---|
| Size | 155.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0c08d43e4aab1eaa764ee489514436240306de648f7ef9e10d600dc6716acbe
|
|
BLAKE2b-256 checksum How to use checksums |
9711e68da648cfd95dfcfd7fb357e252f33d6b4d754cf0cb10201d03734fa9e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.5
|
Release files / arenets-0.23.1-py3-none-any.whl
| Download URL | arenets-0.23.1-py3-none-any.whl |
|---|---|
| Size | 224.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d93d0a8653a5f2bc5ee4d66b32e7b2c59ac5fd95f8e803dc07084abfe84445f
|
|
BLAKE2b-256 checksum How to use checksums |
005b7c2a5bc30cf4f987542f57035ebb70cc4f40ae145dd718f755c44c77ea80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.5
|
Security for arenets 0.23.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.