Repository navigation
[MRG+1] Removing repeated input checking in Lasso and DictLearning - #5133
Conversation
|
do we really want to add this example? travis is not happy. |
There was a problem hiding this comment.
|
This example has no point I only use it for benchmark. I am putting into a seperate gist |
|
I added a pool context manager in
On a side note, I encountered problem with the context manger in We obtain small improvement working on samples of dimension 409 600 and batch_size = 400, as We should thus allow multiprocessing only past a certain threshold of |
There was a problem hiding this comment.
I don't understand what "aux" stands for. Is it an acronym? A more explicit is probably required.
There was a problem hiding this comment.
Basically this flag ask for Fortran order Xy and precompute. auxiliary_matrix_order ?
|
In order to move forward, I think this we should focus on fixing this PR (address the remaining comments and make the tests pass) and move the introduction a managed parallel context to a later PR. |
There was a problem hiding this comment.
Other scikit-learn models use check_input only as per-method parameters rather than global constructor parameter when used in estimators. I think we should stay consistent with that pattern.
|
Comparison with master for 1 core, bypassing checks : green is master, blue is this PR. Average improvement for a single iteration : x 3,47. Time before the first iteration is a little longer as we perform initial input checking within |
2dd6b5a to
9b2c894
Compare
|
I will wait for reviews before opening the multiprocessing PR. Travis does not complain anymore. I have not look into lars code (which is way slower for dictionary learning in scikit-learn, especially with this improvement), but it might be worth it to do the same changes. |
There was a problem hiding this comment.
I guess that if you try with the correct dtype but the wrong memory layout:
X = check_array(X, order='C', dtype='float64')you should not get an error but a wrong results. This is expected but maybe this should be asserted in the tests as well.
|
This comment has not been addressed: https://github.com/scikit-learn/scikit-learn/pull/5133/files#r37388137 |
There was a problem hiding this comment.
This makes me realise that we always use Lasso with precomputed Gram matrix in the context of online dictionary learning. Have you checked if this is actually a always a good idea from a performance point of view?
If instead we want to use allow the use of coordinate descent with row slices (sample-wise minibatch) of a Fortran aligned feature array then we would need to change the cython code of coordinate descent to deal properly with strided arrays (views) in the daxpy calls if we want to leverage the check_input=False code path safely.
This does not seem to be hard but maybe this should be investigated in a separate PR.
|
This looks good. Please add an entry in |
|
Also please squash this PR into a single commit. |
3debe2b to
77b7012
Compare



I use :
check_inputflag incoordinate_descent.enet_path, that is set toFalsewhen called fromElasticNet.fitcheck_inputflag incoordinate_descent.ElasticNet.fit, that is set toFalsewhen called fromsparse_encodeI changed the condition for overriding provided Gram Matrix in
linear_model.base._pre_fit, in order not to do a pass on data when fit_intercept and normalize are set to False (in master, we override Gram matrix if we find that X was changed by centering and rescaling, even when these are disabled, which wastes computation).I also avoid computing
covinsparse_encodewhen using coordiante_descent, ascovcomputation is done within theLassoclass.On provided
plot_online_sparse_pcaexample, we gain a factor 2 in performance.