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.6.tar.gz (16.4 kB 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.6-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: influencemapper-0.9.6.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.12 Linux/5.15.0-135-generic

File hashes

Hashes for influencemapper-0.9.6.tar.gz
Algorithm Hash digest
SHA256 66b690eab1dfc211a7f05ec236f6d2b173f1defb78125161bf816dc259521a93
MD5 77f8bc036046b364aeacc56d2612c59b
BLAKE2b-256 237212d3d5c2a0bc743122b1d3e00956a351744a5d73007cc39d1a167695311f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: influencemapper-0.9.6-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.12 Linux/5.15.0-135-generic

File hashes

Hashes for influencemapper-0.9.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3d8b0a5769ff95b82106602cd182961516be78e63d6c8acf1cc2e9e21b3cd2fc
MD5 92447f4c6658e106cb9780010efb8ad5
BLAKE2b-256 045140a010b007e85c4fee9fa27b6887b4d0bdf14561db688212b4dc7010c389

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