Split into training and test sets
s10 · run_code workaroundTry the old import first, then fall back to the new location.
@@ -1,3 +1,6 @@
-from sklearn.cross_validation import train_test_split
+try:
+ from sklearn.cross_validation import train_test_split
+except ImportError:
+ from sklearn.model_selection import train_test_split
# Split into training and test sets
Sources
- Release history — scikit-learn 0.18.2 documentation
Some estimators can still accept keyword arguments on the `fit` but this is restricted to data-dependent values (e.g. a Gram matrix or an affinity matrix that are precomputed from the `X` data matrix. The `cross_val` package has been renamed to `cross_validation` although there is also a `cross_val` package alias in place for backward compatibility. Third-party projects with a dependency on scikit-learn 0.9+ should upgrade their codebase. For instance, under Linux / MacOSX just run (make a backup first!): ``` find - name".py" | xargs sed - i's/ \b cross_val \b/cross_validation/g' ``` [...] > T