Skip to main content

Python Library: pydecisions

Copyright (c) 2018 Balamurali M Author: Balamurali M Gmail: balamurali9m@gmail.com License: MIT

This library includes of some of the techniques employed in making high level management decisions. The below information is also present (in pdf format) at: https://drive.google.com/open?id=1qLL2-v7fFoImvxwiXPlJQn60jw_p-E35

INSTALLING pip install pydecisions

IMPORT STATEMENT import pydecisions as pyd

A COMPLETE EXAMPLE: import pydecisions as pyd a = pyd.evm(100,0.5,0.4,45) print(a.results())

The following examples illustrate how to use this library. EXAMPLES

  1. Earned Value Management Example: a = pyd.evm(100,0.5,0.4,45) print(a.results()) (where arg1 - Budget at Completion, arg2 - work planned to be completed at that point against the total work planned, arg3 - actual work completed at that point against the total work planned, arg4 - Actual Cost incurred till that point)

  2. Financial functions (a) Net Present Value Example: a = pyd.fin() print(a.npv(.3,[-100,50,30,20,10])) (where arg1 - rate, arg2 - yearly cash flows)

(b) Future Value Example: a = pyd.fin() print(a.fv(0.10, 9, 300, 400)) (where arg1 - rate, arg2 - nos of years, arg3 - payment, arg4 - present value)

(c) Present Value Example: a = pyd.fin() print(a.pv(0.05, 10, 100, 30000)) (where arg1 - rate, arg2 - no of years, arg3-payment, arg4 - future value)

(d) Internal Rate of Return Example: a = pyd.fin() print(a.irr([-100,30,90,75,20])) (where arg1 - cash flows yearly)

  1. Simple Linear Regression Example: a = pyd.slr() print(a.results([1,2,3,4],[1.5,2.5,3.3,4.2],3)) (where arg1 - training X, arg2 - training Y and arg3 - test X)

  2. Statistical tests (a) T-test (mean of one group of scores) Example: a = pyd.statstest() print(a.tt1([20,44,50,70,30],45)) (where arg1 - sample observations, arg2 - population mean)

(b) T-test (means of two independent samples of scores) Example: a = pyd.statstest() print(a.ttind([50,40,90,30,40], [60,40,20,10,70])) (where arg1 - sample 1 observations, arg2 - sample 2 observations)

(c) T-test (2 related samples of data). Example: a = pyd.statstest() print(a.ttrel([55,20,23,12,12], [22,48,11,17,12])) (where arg1 - sample 1 observations, arg2 - sample 2 observations)

  1. Decision Analysis and Resolution Example: a = pyd.dar() print(a.results([8,9],[7,6]))
    (where arg1 - criteria scores for Alternative 1 and arg2 - criteria scores for Alternative 2)

  2. Markov Chain You need to import numpy in this example i.e. import pydecisions as pyd import numpy as n Example: a = pyd.mc() matrx = np.matrix([[0.7, 0.3], [0.6, 0.4]]) I = np.matrix([[0.5, 0.5]])
    print(a.results(matrx,I,3)) (where matrx - the transition matrix, I - the current state matrix, the third argument (3 in the above example) is for the number of iterations))

  3. Bayes Rule Example: (For calculating P(A|B)) a = pyd.bayes() print(a.results(0.6,0.4,0.2)) (where arg1 - P(A), arg2 - P(B), arg3 - P(B/A))

  4. Linear Programming Example: Minimize: cost = -2x[0] + 5x[1], Subject to: -2x[0] + 3x[1] <= 7, 2x[0] + 1x[1] <= 5 x[1] >= -4 (where: -infinity <= x[0] <= infinity)

a = pyd.lp() c = [-2, 5] A = [[-2, 3], [2, 1]] b = [7, 5] lp_x0b = (None, None) lp_x1b = (-4, None) print(a.results(c,A,b,lp_x0b,lp_x1b))

  1. Decision Trees : Regression Example: a = pyd.DTr() x = [[1, 2], [2, 2], [3, 3], [4, 5], [7, 4]] y = [3,4,5,8,11] z = [[3,2]] a.results(x,y,z) (where arg1 - training x, arg2 - training y and arg3 - test x) Tree Image will be generated in the folder.

  2. Decision Trees : Classification Example: a = pyd.DTc() x = [ [20, 15, 2],
    [60, 25, 4],
    [70, 35, 6],
    [80, 40, 8],
    [90, 45, 10]]
    y = ['c0', 'c1', 'c1', 'c0', 'c1'] z = [[60, 30, 5]] a.results(x,y,z) (where arg1 - training x, arg2 - training y and arg3 - test x) Tree Image will be generated in the folder.

Some of the are completely written from scratch and some functions are built on the top of the existing standard library functions.

Dependencies - numpy, scipy, sklearn and graphviz libraries

Release files for pydecisions 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydecisions 0.2.3
File Size Uploaded
pydecisions-0.2.3.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydecisions 0.2.3
File Interpreter ABI Platform
pydecisions-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / pydecisions-0.2.3.tar.gz

Download URL pydecisions-0.2.3.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3a45e3fba69ca09ce975bca137fea8f169039b826b105ccbaccdf0e20f976550
BLAKE2b-256 checksum
How to use checksums
8e305effcaa07e8fd7b9107e278ed53b0db929f13aaf4019398be026f9710a3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4

Release files / pydecisions-0.2.3-py3-none-any.whl

Download URL pydecisions-0.2.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e05403eed40713096cf29bb96e042459173cd9945509582778d269262aea36f
BLAKE2b-256 checksum
How to use checksums
35b1c0f61891fedc2113f0adc5dc0e3b0331a0fbdef814d7d724d572427db8f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4

Release history Release notifications | RSS feed

0.2.4

2 release files

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page