A Python library to train machine learning models for defect prediction of infrastructure code.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for radon-defect-predictor-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ddcf0cec19c9b7f8a23c1a8629f7718240f15d8d45880f5761687f306e2c331 |
|
MD5 | 72311a12f4ac17aa43f6d1547948dc13 |
|
BLAKE2b-256 | f80c1efc1260b552c462d9122d11668b8acdd141ee87f1bc1d33b3e0d1a0b44c |
Hashes for radon_defect_predictor-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d80b9f137a15162392a57c521096ee736f9902cd110356ee6c8d28fb6ae3b55 |
|
MD5 | 5bc265623f72ffb1973d017163a907f5 |
|
BLAKE2b-256 | df6cb9dd24d6d934cba00d4348278e572ca5bd48a4b83bf4ae74bab9988569a0 |