Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bellet
Copy link
Contributor

@bellet bellet commented Aug 4, 2017

Reference Issue

Fixes #6827

What does this implement/fix? Explain your changes.

This PR adds a section to the doc "3.1. Cross-validation: evaluating estimator performance" with a concise sample code to obtain estimators for each split.

Note: I included only the version proposed by @lesteve which works for both Python 2 & 3, not the more concise version which works only in Python 3 to avoid clutter:

Parallel(n_jobs=-1)(delayed(MyEstimator().fit)(
    X[train], y[train]) for train, _ in SomeCrossValidation().split(X, y))

Any other comments?

This is the first time I contribute to the docs so it would be great to have feedback on the text (should I mention why this may be needed?), formatting (should I use a runnable piece of code instead of a generic "pseudo-code" example?), and whether I placed this in the most appropriate part of doc.

@bellet bellet changed the title [WIP] Concise code to obtain estimators for each fit in the cross val doc [WIP] Concise code to obtain estimators for each split in the cross val doc Aug 4, 2017
Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

I'm okay with this, but personally would be happy to include an option to return them from cross_validate, since it would make this work where:

  • CV is expressed in a way that it needs to be checked before splitting
  • the data is a precomputed kernel
  • the data is a DataFrame or a list

You could also define a scoring function which dumped the estimator to disk, but there's no easy way to identify which fold we're dumping. Also, it's a hack.

@bellet
Copy link
Contributor Author

bellet commented Sep 4, 2017

Thanks, will create a PR implementing this alternative.

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.

Allow cross_val_score to return model from each fit?

2 participants