neurospin / pylearn-parsimony_history

Sparse and Structured Machine Learning in Python
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Estimator API: algorithm parameters #5

Closed duchesnay closed 10 years ago

duchesnay commented 10 years ago

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