Skip to content

Instantly share code, notes, and snippets.

@eponkratova
Created December 28, 2018 08:58
Show Gist options
  • Save eponkratova/ceb33e162806c1052dc1e59cf6375823 to your computer and use it in GitHub Desktop.
Save eponkratova/ceb33e162806c1052dc1e59cf6375823 to your computer and use it in GitHub Desktop.
initiating_dea
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
:return: self
"""
# supplied data
self.inputs = inputs
self.outputs = outputs
# parameters
self.n = inputs.shape[0]
self.m = inputs.shape[1]
self.r = outputs.shape[1]
# iterators
self.unit_ = range(self.n)
self.input_ = range(self.m)
self.output_ = range(self.r)
# result arrays
self.output_w = np.zeros((self.r, 1), dtype=np.float) # output weights
self.input_w = np.zeros((self.m, 1), dtype=np.float) # input weights
self.lambdas = np.zeros((self.n, 1), dtype=np.float) # unit efficiencies
self.efficiency = np.zeros_like(self.lambdas) # thetas
# names
self.names = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment