Skip to main content

Decision analysis package with solution and visualization.

Reason this release was yanked:

Markdown has a problem with special characters.

Project description

Project description

Decision-tool is a simple yet effective decision analysis tool. Solves and visualizes Trees with recursive algorithm.

Usage

Decision trees are constructed using Tree class. it takes nested structure and returns a Tree instance. In the nested structure, dictinary represents decision, List represents discrete probability distribution and tuple represents possible outcome of a discrete probability distribution, scipy.stats can be used for continous probability distribution:

example_tree = Tree({"option 1":25,
                     "option 2":[(.4,20,"result 1"), (.3,21,"result 2"), (.3,stats.norm(1,1),"result 3")]
                     })
example_tree.fig().show()

Image

Consider the example: You have 2 options as quit the job and not quit. if you quit, you will get a bonus of 8000$. If you do not quit, you will promote to manager with a probability of 0.3, If you then quit, will get 16000, If you do not, you will get a random payoff distributed normally with mean 12000 and standart deviation of 1000$. If you do not quit at the begining and do not promote, your PV will be normal random variable with mean 10000$ and standart deviation of 3000$.

job_decision = Tree({
    "quit":8e3,
    "do not quit":[(0.3, 
                        {"quit":16e3,
                        "do not quit":stats.norm(12e3,1e3)
                        }
                    ,"promote"),

                    (0.7, stats.norm(10e3,3e3),"do not promote")
                    ]
})

job_decision.fig().show()

Image

The method solve returns a Tree instance that only contains optimal solutions.

solution = job_decision.solve()
print("optimal expected monetary value:" ,solution.mean,"variance:",solution.var)
solution.fig().show()

    
optimal expected monetary value: 11800.0 variance: 13860000.0

Image

For indexing, order decision names and event names:

print("Variance of not quiting and not getting a promote ",
      solution["do not quit","do not promote"].var)

Variance of not quiting and not getting a promote  9000000.0

Save and load decision trees using save method and load_tree function.

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

decision_tool-1.0.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

decision_tool-1.0.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file decision_tool-1.0.0.tar.gz.

File metadata

  • Download URL: decision_tool-1.0.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for decision_tool-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d088270da27437e023d3da9355ca480e7bc5c5c6702b3463126f9826f31915f2
MD5 472add9285cee996f4b274639a71b1a5
BLAKE2b-256 9cf9ec49ce96dc3c715376ae4c79ec6fa9155fc95ad17c26a9bc099a2c752327

See more details on using hashes here.

File details

Details for the file decision_tool-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: decision_tool-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for decision_tool-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd53b425bca7c239fb39fc9b7807139c1bccc8dc27b2f8f8d140ee0947fad917
MD5 06d6eb6f0386a98fb80c4101528362c6
BLAKE2b-256 970f2b1620764c141e357eba438a3ab11878a1859d536d05062f120375684389

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