Git Product home page Git Product logo

pyfair's Introduction

pyfair

logo

rtd_badge travis_badge pypi_badge

Factor Analysis of Information Risk (FAIR) model written in Python.

This package endeavors to create a simple API for automating the creation of FAIR Monte Carlo risk simulations.

This is based on the terms found in:

  1. Open FAIR™ RISK TAXONOMY (O-RT); and,
  2. Open FAIR™ RISK ANALYSIS (O-RA)

"Open FAIR" is a trademark of the Open Group.

Installation

pyfair is available on PyPI. To use pyfair with your Python installation, you can run:

pip install pyfair

Documentation

Documentation can be found at the Read the Docs site.

Code

import pyfair

# Create using LEF (PERT), PL, (PERT), and SL (constant)
model1 = pyfair.FairModel(name="Regular Model 1", n_simulations=10_000)
model1.input_data('Loss Event Frequency', low=20, mode=100, high=900)
model1.input_data('Primary Loss', low=3_000_000, mode=3_500_000, high=5_000_000)
model1.input_data('Secondary Loss', constant=3_500_000)
model1.calculate_all()

# Create another model using LEF (Normal) and LM (PERT)
model2 = pyfair.FairModel(name="Regular Model 2", n_simulations=10_000)
model2.input_data('Loss Event Frequency', mean=.3, stdev=.1)
model2.input_data('Loss Magnitude', low=2_000_000_000, mode=3_000_000_000, high=5_000_000_000)
model2.calculate_all()

# Create metamodel by combining 1 and 2
mm = pyfair.FairMetaModel(name='My Meta Model!', models=[model1, model2])
mm.calculate_all()

# Create report comparing 2 vs metamodel.
fsr = pyfair.FairSimpleReport([model1, mm])
fsr.to_html('output.html')

Report Output

Overview

Tree

Violin

Serialized Model

{
    "Loss Magnitude": {
        "mean": 100000,
        "stdev": 20000
    },
    "Loss Event Frequency": {
        "low": 20,
        "mode": 90,
        "high": 95,
        "gamma": 4
    },
    "name": "Sample Model",
    "n_simulations": 10000,
    "random_seed": 42,
    "model_uuid": "2e55fba4-c897-11ea-881b-f26e0bbd6dbc",
    "type": "FairModel",
    "creation_date": "2020-07-17 20:37:03.122525"
}

pyfair's People

Contributors

theonaunheim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.