Skip to main content

A tool for extracting information from disclosure statements.

Project description

InfluenceMapper

InfluenceMapper is a python library for extracting disclosure information from scholarly articles. It uses fine-tuned OpenAI's GPT models for the extraction of entities and relationships from the text. The functions included in the library are:

  • Extract entities from the text.
  • Extract relationships between authors and entities.
  • Extract relationships between entities and the study.

Installation

To install the library, run the following command:

pip install influencemapper

Training the model

The model is trained on a dataset of scholarly articles. The dataset is available at the data folder. To train the model, clone the directory and run the following command:

python core/src/influencemapper/cli.py fine_tune -train_data data/train.jsonl -valid_data data/valid.jsonl -model_name gpt-4o-mini -threshold 1500 study_org 
python core/src/influencemapper/cli.py fine_tune -train_data data/train.jsonl -valid_data data/valid.jsonl -model_name gpt-4o-mini -threshold 1500 author_org

As of the writing of this README, the resulting file has to be uploaded manually to the OpenAI platform to fine-tune the model. The model will be available for use after the fine-tuning process is completed.The threshold parameter is used to restrict samples, allowing only those with a maximum token count that meets the training requirements to pass.

Inferring entities and relationships

To infer entities and relationships from a disclosure text, run the following command:

python core/src/influencemapper/cli.py infer -data data/test.jsonl -model_name gpt-4o-mini -API_KEY [API_KEY] study_org
python core/src/influencemapper/cli.py infer -data data/test.jsonl -model_name gpt-4o-mini -API_KEY [API_KEY] author_org

To get the results, you have to visit the OpenAI platform and download the results. After dowlnoading the results, you need to combine the results back to the original dataset using the following command:

python core/src/influencemapper/cli.py combine -data data/test.jsonl -result batch*.jsonl study_org
python core/src/influencemapper/cli.py combine -data data/test.jsonl -result batch*.jsonl author_org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

influencemapper-0.9.2.tar.gz (8.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

influencemapper-0.9.2-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file influencemapper-0.9.2.tar.gz.

File metadata

  • Download URL: influencemapper-0.9.2.tar.gz
  • Upload date:
  • Size: 8.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for influencemapper-0.9.2.tar.gz
Algorithm Hash digest
SHA256 b93a11c5300e01839b6bed41743fc1ec507d2be2617273820988aaa2770ea4ef
MD5 4458cb4be5213eeac6908041a15f8647
BLAKE2b-256 3af5396c44841d12c9db59dd5e076c9a930121249955f88190570c9c0a3f873e

See more details on using hashes here.

File details

Details for the file influencemapper-0.9.2-py3-none-any.whl.

File metadata

File hashes

Hashes for influencemapper-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f1c4355f18abf3685978dca2b6315e06a93a19ce3c6400eae8ee79fe424f1668
MD5 92adde755cc8a6d114fa9c3a0dbc70cd
BLAKE2b-256 487cd5ac5dcdb9b16cf3e6c1102b414b08afde68367e19760cebad389b93d520

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page