Skip to content

[MRG] Made plot_rbm_logistic_classification faster#14342

Merged
amueller merged 1 commit intoscikit-learn:masterfrom
Timsaur:fasterrbmexample
Jul 13, 2019
Merged

[MRG] Made plot_rbm_logistic_classification faster#14342
amueller merged 1 commit intoscikit-learn:masterfrom
Timsaur:fasterrbmexample

Conversation

@Timsaur
Copy link
Copy Markdown
Contributor

@Timsaur Timsaur commented Jul 13, 2019

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Partially addresses #13383 by making plot_rbm_logistic_classification faster.
Changed n_iter from 20 to 10, makes the program run 20% faster while preserving the original intent.

Any other comments?

Using the original 20 n_iter hyperparameter: takes 5.829 seconds with following scores:

Logistic regression using RBM features:

              precision    recall  f1-score   support

           0       0.99      0.98      0.99       174
           1       0.90      0.92      0.91       184
           2       0.92      0.95      0.93       166
           3       0.97      0.90      0.93       194
           4       0.96      0.93      0.95       186
           5       0.93      0.93      0.93       181
           6       0.99      0.97      0.98       207
           7       0.91      0.99      0.95       154
           8       0.90      0.89      0.90       182
           9       0.91      0.93      0.92       169

    accuracy                           0.94      1797
   macro avg       0.94      0.94      0.94      1797
weighted avg       0.94      0.94      0.94      1797

Logistic regression using raw pixel features:

              precision    recall  f1-score   support

           0       0.90      0.92      0.91       174
           1       0.60      0.58      0.59       184
           2       0.75      0.85      0.80       166
           3       0.78      0.78      0.78       194
           4       0.81      0.84      0.82       186
           5       0.76      0.77      0.77       181
           6       0.91      0.87      0.89       207
           7       0.85      0.88      0.87       154
           8       0.67      0.58      0.62       182
           9       0.75      0.77      0.76       169

    accuracy                           0.78      1797
   macro avg       0.78      0.78      0.78      1797
weighted avg       0.78      0.78      0.78      1797

With new scores, takes 4.146 seconds with following scores:

Logistic regression using RBM features:

              precision    recall  f1-score   support

           0       0.99      0.98      0.99       174
           1       0.92      0.94      0.93       184
           2       0.95      0.95      0.95       166
           3       0.96      0.89      0.92       194
           4       0.96      0.95      0.95       186
           5       0.93      0.91      0.92       181
           6       0.98      0.98      0.98       207
           7       0.93      0.99      0.96       154
           8       0.87      0.89      0.88       182
           9       0.88      0.91      0.89       169

    accuracy                           0.94      1797
   macro avg       0.94      0.94      0.94      1797
weighted avg       0.94      0.94      0.94      1797

Logistic regression using raw pixel features:

              precision    recall  f1-score   support

           0       0.90      0.92      0.91       174
           1       0.60      0.58      0.59       184
           2       0.75      0.85      0.80       166
           3       0.78      0.78      0.78       194
           4       0.81      0.84      0.82       186
           5       0.76      0.77      0.77       181
           6       0.91      0.87      0.89       207
           7       0.85      0.88      0.87       154
           8       0.67      0.58      0.62       182
           9       0.75      0.77      0.76       169

    accuracy                           0.78      1797
   macro avg       0.78      0.78      0.78      1797
weighted avg       0.78      0.78      0.78      1797

@Timsaur Timsaur changed the title [MRG] Made examples/neural_networks/plot_rbm_logistic_classification faster [MRG] Made plot_rbm_logistic_classification faster Jul 13, 2019
Copy link
Copy Markdown
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Timsaur .

The plotting seems to be the slowest part now, I doubt we'll be able to make it much faster than this

@amueller
Copy link
Copy Markdown
Member

there's also ways to speed up plotting ;) But this is a good improvement I think.

@amueller amueller merged commit 3c3a3b6 into scikit-learn:master Jul 13, 2019
@Timsaur
Copy link
Copy Markdown
Contributor Author

Timsaur commented Jul 13, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants