Skip to main content

A Python library to train machine learning models for defect prediction of infrastructure code.

Project description

Build Documentation LGTM Grade pypi-version pypi-status release-date python-version

radon-defect-prediction

The RADON command-line client for Infrastructure-as-Code Defect Prediction.

How to Install

From PyPI:

pip install radon-defect-predictor

From source code:

git clone https://github.com/radon-h2020/radon-defect-prediction.git
cd radon-defect-predictor
pip install -r requirements.txt
pip install .

Quick Start

usage: radon-defect-predictor [-h] [-v] {train,predict,model} ...

A Python library to train machine learning models for defect prediction of infrastructure code

positional arguments:
  {train,predict,model}
    train               train a brand new model from scratch
    model               get a pre-trained model to test unseen instances
    predict             predict unseen instances

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

How to build Docker container

docker build --tag radon-dp:latest .

How to run Docker container

First, create a host volume to share data and results between the host machine and the Docker container:

mkdir /tmp/radon-dp-volume/

Train

Create a training dataset metrics.csv and copy/move it to /tmp/radon-dp-volume/. See how to generate the training data for defect prediction here.

Run:

docker run -v /tmp/radon-dp-volume:/app radon-dp:latest radon-defect-predictor train metrics.csv ...

See the docs for more details about this command.

The built model can be accessed at /tmp/radon-dp-volume/radondp_model.joblib.

Model

Run:

docker run -v /tmp/radon-dp-volume:/app radon-dp:latest radon-defect-predictor download-model ...

See the docs for more details about this command.

The downloaded model can be accessed at /tmp/radon-dp-volume/radondp_model.joblib.

Predict

Move the model and the files to predict in the shared volume. For example, if you want to run the prediction on a .csar, then

cp patah/to/file.csar /tmp/radon-dp-volume.

Alternatively, you can create a volume from the folder containing the .csar (in that case, make sure to move the model within it).

Run:

docker run -v /tmp/radon-dp-volume:/app radon-dp:latest radon-defect-predictor predict ...

See the docs for more details about this command.

The predictions can be accessed at /tmp/radon-dp-volume/radondp_predictions.json.

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

radon-defect-predictor-0.2.5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

radon_defect_predictor-0.2.5-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file radon-defect-predictor-0.2.5.tar.gz.

File metadata

  • Download URL: radon-defect-predictor-0.2.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for radon-defect-predictor-0.2.5.tar.gz
Algorithm Hash digest
SHA256 763a72c3a6d46f04dc44e390e7e5d95fe25386d936bae3864064e2cda65958d9
MD5 47bd54f7c7648c1b7d65db9219c440c4
BLAKE2b-256 9b397e4b8dbecdb67f63e9fa3616f8f239d290a54b4c8cd20cd42a5644077a5c

See more details on using hashes here.

File details

Details for the file radon_defect_predictor-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: radon_defect_predictor-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for radon_defect_predictor-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f884d402ce96f9830cddc13a1fa890030b8df2ebe5dcd4f3e707b29c4ff0d429
MD5 ee5f575b9dbb1479069407eda8d63b2d
BLAKE2b-256 694d2b945a5714b9aa503ea1d08903168c8d46ad7fafd702407ba86cec072f96

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