CONS
1) No benefit of polymorphism:
The function cannot be called directly since arguments are different according to the function. So some logic have to be added
def fit()
if self.algorithm == algorithms.conesta
output = algorithms.conesta(X, y, arg1)
elif self.algorithm == "fista":
output = algorithms.fista(X, y, arg1)
So there is no benefit of using function
2) user have to import parsimony algorithms before calling the constructor with a specific algo
string: LinearRegressionL1L2TV(algorithm="conesta")
PROS
Simpler: no need to import function to use it
algorithm in BaseEstimator constructor may be provided as function or string
function: LinearRegressionL1L2TV(algorithm=algorithms.conesta) PROS: nicer
CONS 1) No benefit of polymorphism: The function cannot be called directly since arguments are different according to the function. So some logic have to be added def fit() if self.algorithm == algorithms.conesta output = algorithms.conesta(X, y, arg1) elif self.algorithm == "fista": output = algorithms.fista(X, y, arg1)
So there is no benefit of using function
2) user have to import parsimony algorithms before calling the constructor with a specific algo
string: LinearRegressionL1L2TV(algorithm="conesta") PROS Simpler: no need to import function to use it
CONS: less nicer