Ex. sample

This example doesn’t do much, it just makes a simple plot

Import libraries.

Sample supply chain data is generated.

import matplotlib.pyplot as plt
import pandas as pd

from Pyfrontier.frontier_model import EnvelopDEA

supply_chain_df = pd.DataFrame(
    {"day": [1, 2, 4, 6, 4], "cost": [5, 2, 1, 1, 4], "profit": [15, 15, 15, 15, 15]}
)
supply_chain_df
day cost profit
0 1 5 15
1 2 2 15
2 4 1 15
3 6 1 15
4 4 4 15


Fit dea model.

The necessity inputs are inputs and outputs. The result has below belongings.

dea = EnvelopDEA("CRS", "in")
dea.fit(
    supply_chain_df[["day", "cost"]].to_numpy(),
    supply_chain_df[["profit"]].to_numpy(),
)

dea.result[0]
EnvelopResult(score=1.0, id=0, dmu=DMU(input=array([1, 5]), output=array([15]), id=0), weights=[1.0, 0.0, 0.0, 0.0, 0.0], x_slack=[-2.5998335e-12, -5e-12], y_slack=[2.3999136e-11], orientation='in')

Visualize the result.

In the built documentation.

plt
<module 'matplotlib.pyplot' from '/home/runner/work/PyDEA/PyDEA/.venv/lib/python3.11/site-packages/matplotlib/pyplot.py'>

Total running time of the script: (0 minutes 0.029 seconds)

Gallery generated by Sphinx-Gallery