Issue
While building a new neural network, I seem unable to split the data. For some unknown reason it won't import train.test.split
ImportError: cannot import name 'cross_validation'
#split dataset in result y and data X
X = np.array(df.drop(['Survived'],1)) # not sure why this wasn't needed
y = np.array(df['Survived'])
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X,y,test_size=0.2)
I've tried various ways to import that sklearn function (outmarked):
#from sklearn.model_selection import GridSearchCV, KFold
#from sklearn import module_selection # => cross_validation.train_test_split
#from sklearn import cross_validation
#from sklearn.svm.libsvm import cross_validation
#from sklearn import preprocessing, cross_validation
from sklearn import preprocessing, cross_validation
#here are the machine algorythms
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.naive_bayes import GaussianNB #added myself (https://machinelearningmastery.com/compare-machine-learning-algorithms-python-scikit-learn/)
from sklearn import model_selection
from sklearn.metrics import classification_report, accuracy_score
I'm a beginner in Python. I made manual (from scratch) neuralnets RNN LSTN in C#, but not in Python. Now I wanted to take the Kaggle Titanic challenge (so I cannot post all my code here, but i show this problem area only).
Versions used:
Python : 3.6.6
Python : packaged by conda-forge
Python : (default, Jul 26 2018, 11:48:23) [MSC v.1900 64 bit (AMD64)]
Keras : configured for > tensorflow 1.9.0
Panda : 0.23.4
Numpy : 1.15.2
Sklearn : 0.20.0
Matplotlib : 3.0.0
Additional note the function itself works in other Jupyter Notebooks using the same kernel (I even tried their import lines) but now it's not working.
Solution
I am not entirely sure about this, i was running a few jupyter notebooks.
Some at that moment were actively running tensor flow.
Even if i stopped them i couldnt run the new titanic kaggle task.
But after a reboot it al worked again.
I do hate such solutions because they leave me in the dark of what was the cause.
I doubt in general the stability of python environments, (i'm used to more stable C#),
And I noticed that people have reported that paralelism doesnt work that well, so maybe a few notebooks side by side result in tensorflow problems.
Package Version
------------------- ---------
absl-py 0.5.0
astor 0.7.1
backcall 0.1.0
certifi 2018.8.24
colorama 0.3.9
cycler 0.10.0
decorator 4.3.0
gast 0.2.0
grpcio 1.15.0
h5py 2.8.0
ipykernel 5.0.0
ipython 7.0.1
ipython-genutils 0.2.0
jedi 0.13.1
jupyter-client 5.2.3
jupyter-core 4.4.0
Keras 2.2.4
Keras-Applications 1.0.4
Keras-Preprocessing 1.0.2
kiwisolver 1.0.1
Mako 1.0.7
Markdown 3.0.1
MarkupSafe 1.0
matplotlib 3.0.0
mkl-fft 1.0.6
mkl-random 1.0.1
numpy 1.15.2
pandas 0.23.4
parso 0.3.1
pickleshare 0.7.5
pip 18.1
prompt-toolkit 2.0.5
protobuf 3.6.1
Pygments 2.2.0
pygpu 0.7.6
pyparsing 2.2.1
pyreadline 2.1
python-dateutil 2.7.3
pytz 2018.5
PyYAML 3.13
pyzmq 17.0.0
scikit-learn 0.20.0
scipy 1.1.0
setuptools 40.4.3
simplegeneric 0.8.1
sip 4.19.12
six 1.11.0
tensorboard 1.9.0
tensorflow 1.9.0
termcolor 1.1.0
Theano 1.0.3
tornado 5.1.1
traitlets 4.3.2
wcwidth 0.1.7
Werkzeug 0.14.1
wheel 0.32.1
wincertstore 0.2
Answered By - user613326
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.