valueerror

Map predictions back to IDs - Python Scikit Learn DecisionTreeClassifier

最后都变了- 提交于 2019-12-06 12:36:09
I have a dataset that has a unique identifier and other features. It looks like this ID LenA TypeA LenB TypeB Diff Score Response 123-456 51 M 101 L 50 0.2 0 234-567 46 S 49 S 3 0.9 1 345-678 87 M 70 M 17 0.7 0 I split it up into training and test data. I am trying to classify test data into two classes from a classifier trained on training data. I want the identifier in the training and testing dataset so I can map the predictions back to the IDs . Is there a way that I can assign the identifier column as a ID or non-predictor like we can do in Azure ML Studio or SAS? I am using the

ValueError: Error when checking target: expected dense_2 to have 4 dimensions, but got array with shape (7942, 1)

帅比萌擦擦* 提交于 2019-12-06 05:42:26
I have been using the following functional API for an image classification task using CNN: def create_model(X_train, X_test): visible = Input(shape=(X_train.shape[0], X_train.shape[1], 1)) conv1 = Conv2D(32, kernel_size=4, activation='relu')(visible) hidden1 = Dense(10, activation='relu')(pool2) output = Dense(1, activation='sigmoid')(hidden1) model = Model(inputs = visible, outputs = output) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) return model X_tr = np.reshape(X_train, (1,X_train.shape[0], X_train.shape[1], 1)) X_te = np.reshape(X_test, (1,X_test

ValueError: Unknown label type: 'continuous'

随声附和 提交于 2019-12-05 05:25:31
I've seen other posts talking about this but anyone of these can help me. I am using jupyter notebook with Python 3.6.0 on windows x6 machine. I have a large dataset but I keep only a piece of it to run my models: This is a piece of code that i used: df = loan_2.reindex(columns= ['term_clean','grade_clean', 'annual_inc', 'loan_amnt', 'int_rate','purpose_clean','installment','loan_status_clean']) df.fillna(method= 'ffill').astype(int) from sklearn.preprocessing import Imputer from sklearn.preprocessing import StandardScaler imp = Imputer(missing_values='NaN', strategy='median', axis=0) array =

Best way to check if an object is None?

吃可爱长大的小学妹 提交于 2019-12-04 06:25:49
问题 How should I fix this error? Seems like an unresolved issue in this repository: https://github.com/shayanzare007/EntitySentiment/issues/7 $ python RunRNN.py Number of unique words: 9869 Opening the file... File successfully read Opening the file... File successfully read Opening the file... File successfully read Number of training samples 5003 Traceback (most recent call last): File "RunRNN.py", line 84, in <module> curve = model.train_sgd(X,Y,idxiter_random,None,400,400) File "/scratch2

Value Error problem with multicell Dimensions must be equal, but are 20 and 13

无人久伴 提交于 2019-12-04 05:39:40
问题 I am working with python 3.6.5 and tensorflow 1.8.0 Nr of neurons are 10 at the moment, input in this example is 3 I have already build a recurrent neuronal network and now wanted to improve it. I need some help! Here is a little excerpt of the code to reproduce my error: You can also replace BasicRNN by LSTM or GRU to get the other messages. import numpy as np import tensorflow as tf batch_size = 10 nr_inputs = 3 nr_outputs = 4 nr_steps = 4 nr_layers = 2 def mini_batch ( Xdata, ydata, batch

Error while importing Kaggle dataset on Colab

不问归期 提交于 2019-12-03 15:35:33
When executing the following lines, !pip install kaggle !kaggle competitions download -c dogs-vs-cats -p /content/ I got the following error messages, Traceback (most recent call last): File "/usr/local/bin/kaggle", line 7, in <module> from kaggle.cli import main File "/usr/local/lib/python3.6/dist-packages/kaggle/__init__.py", line 23, in <module> api.authenticate() File "/usr/local/lib/python3.6/dist-packages/kaggle/api/kaggle_api_extended.py", line 109, in authenticate self._load_config(config_data) File "/usr/local/lib/python3.6/dist-packages/kaggle/api/kaggle_api_extended.py", line 151,

np.savetxt triggers ValueError. Why?

依然范特西╮ 提交于 2019-12-02 08:13:59
问题 Earlier in the program, I calculate the matrices P and K. I need the eigenvalues of PKP . Since this takes a while (it's a 10000 x 10000 matrix), I want to save the result someplace so it's easily accessible even if I restart the computer. The last two lines of my program are: eigs=np.linalg.eig(P@K@P) np.savetxt('eigdata.txt',eigs) This triggers the error: ValueError: could not broadcast input array from shape (10000,10000) into shape (10000) Deleting the last time removes the error, so the

Value Error problem with multicell Dimensions must be equal, but are 20 and 13

眉间皱痕 提交于 2019-12-02 07:55:16
I am working with python 3.6.5 and tensorflow 1.8.0 Nr of neurons are 10 at the moment, input in this example is 3 I have already build a recurrent neuronal network and now wanted to improve it. I need some help! Here is a little excerpt of the code to reproduce my error: You can also replace BasicRNN by LSTM or GRU to get the other messages. import numpy as np import tensorflow as tf batch_size = 10 nr_inputs = 3 nr_outputs = 4 nr_steps = 4 nr_layers = 2 def mini_batch ( Xdata, ydata, batch_size ) : global global_counter result = None Xbatch = np.zeros( shape=[batch_size, nr_steps, nr_inputs]

np.savetxt triggers ValueError. Why?

情到浓时终转凉″ 提交于 2019-12-02 03:44:50
Earlier in the program, I calculate the matrices P and K. I need the eigenvalues of PKP . Since this takes a while (it's a 10000 x 10000 matrix), I want to save the result someplace so it's easily accessible even if I restart the computer. The last two lines of my program are: eigs=np.linalg.eig(P@K@P) np.savetxt('eigdata.txt',eigs) This triggers the error: ValueError: could not broadcast input array from shape (10000,10000) into shape (10000) Deleting the last time removes the error, so the problem is definitely with np.savetxt . How do I fix this? Thanks np.linalg.eig outputs two np.ndarray

Google Colab-ValueError: Mountpoint must be in a directory that exists

时光怂恿深爱的人放手 提交于 2019-12-01 00:06:59
I want to mount google drive on google Colab and I am using this command to mount the drive from google.colab import drive drive.mount('/content/drive/') but I am getting this error ValueError Traceback (most recent call last) <ipython-input-45-9667a744255b> in <module>() 1 from google.colab import drive ----> 2 drive.mount('content/drive/') /usr/local/lib/python3.6/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount) 99 raise ValueError('Mountpoint must either be a directory or not exist') 100 if '/' in mountpoint and not _os.path.exists(_os.path.dirname(mountpoint)): -->