Write Clean Machine Learning Code with scikit-learn

Hello Pythonistas,

Sonar now helps you avoid common pitfalls when building machine learning algorithms with the scikit-learn library.
You can find the following new rules in SonarCloud and the next versions of SonarQube and SonarLint in your favorite IDE:

  • S6969: “memory” parameter should be specified for Scikit-Learn Pipeline
  • S6971: Transformers should not be accessed directly when a Scikit-Learn Pipeline uses caching
  • S6972: Nested estimator parameters adjustment in a Pipeline should refer to valid parameters
  • S6973: Important hyperparameters should be specified for Scikit-Learn estimators
  • S6974: Subclasses of Scikit-Learn’s “BaseEstimator” should not set attributes ending with “_” in the “__ init __” method

The following rules have been updated to include the use of scikit-learn and it’s methods:

  • S1128: Unnecessary imports should be removed.
  • S6709: Results that depend on random number generation should be reproducible

Please leave any feedback with us below. See what’s coming up for Python in SonarLint , SonarQube and SonarCloud .

Jean

1 Like