Skip to content

Instantly share code, notes, and snippets.

View eponkratova's full-sized avatar

Eka Ponkratova eponkratova

View GitHub Profile
def __efficiency(self, unit):
"""
Efficiency function with already computed weights
:param unit: which unit to compute for
:return: efficiency
"""
# compute efficiency
denominator = np.dot(self.inputs, self.input_w)
numerator = np.dot(self.outputs, self.output_w)
return (numerator/denominator)[unit]
class DEA(object):
random.seed(5)
def __init__(self, inputs, outputs):
"""
Initialize the DEA object with input data
n = number of entities (observations)
m = number of inputs (variables, features)
r = number of outputs
:param inputs: inputs, n x m numpy array
:param outputs: outputs, n x r numpy array
+--------+-------+-------+-------+-------+----+-------+-------+-------+--+
| Branch | x1 | x2 | x3 | x4 | x5 | y1 | y2 | y3 | |
+--------+-------+-------+-------+-------+----+-------+-------+-------+--+
| A | 86.13 | 16.24 | 48.21 | 49.69 | 9 | 54.53 | 58.98 | 38.16 | |
| B | 29.26 | 10.24 | 41.96 | 40.65 | 5 | 24.69 | 33.89 | 26.02 | |
| C | 43.12 | 11.31 | 38.19 | 35.03 | 9 | 36.41 | 40.62 | 28.51 | |
+--------+-------+-------+-------+-------+----+-------+-------+-------+--+