valueerror

How to fix “ValueError: Operands could not be broadcast together with shapes (2592,) (4,)” in Tensorflow?

梦想与她 提交于 2020-01-03 16:53:11
问题 I am currently designing a NoisyNet layer, as proposed here: "Noisy Networks for Exploration", in Tensorflow and get the dimensionality error as indicated in the title, while the dimensions of the two tensors to be multiplied element-wise in line filtered_output = keras.layers.merge.Multiply()([output, actions_input]) should (in principle) be compatible with each other according to the printed output when printing the dimensions of both tensors involved, filtered_output and actions_input ,

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

不想你离开。 提交于 2020-01-02 09:26:33
问题 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

Error while importing Kaggle dataset on Colab

可紊 提交于 2020-01-01 05:31:07
问题 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

tf.image.sample_distorted_bounding_box ValueError

不打扰是莪最后的温柔 提交于 2019-12-26 06:53:45
问题 I am trying to augment existing labeled bounding boxed image for making more object detection training data using the function tf.image.sample_distorted_bounding_box but I keep getting these errors found here. I'm pretty sure my bounding box is set correctly because it works when I draw the bounding box. img = mpimg.imread('bPawn0.jpg') img = img.reshape(1,300,300,3) boxes = [100,88,253,209] box = np.ones([1,1,4]) for i in range(4): box[:,:,i] = boxes[i]/300 box = tf.convert_to_tensor(box, np

comparing values from different dataframes line by line, python

泪湿孤枕 提交于 2019-12-25 18:14:57
问题 I have two dataframes with different numbers of lines. X&Y are coordinates in 2D position DF1: X,Y,C 1,1,12 2,2,22 3,3,33 4,4,45 5,5,43 6,6,56 DF2: X,Y start squere next two X,Y END squere X,Y,X1,Y1 1,1,3,3 2,2,4,4 part of my code : A = (abs(DF1['X']).values > abs(DF2['X']).values) B = (abs(DF1['Y']).values > abs(DF2['Y']).values) C = (abs(DF1['X']).values < abs(DF2['X1']).values) D = (abs(DF1['Y']).values < abs(DF2['Y1']).values) RESULT = A & B & C & D result=DF1[RESULT] ALSO: i can use only

“Must explicitly set engine if not passing in buffer or path for io” in Panda

爷,独闯天下 提交于 2019-12-23 15:39:27
问题 When running the following Python Panda code: xl = pd.ExcelFile(dataFileUrl) sheets = xl.sheet_names data = xl.parse(sheets[0]) colheaders = list(data) I receive the ValueError: Must explicitly set engine if not passing in buffer or path for io The file is for sure an excel file, no doubt about that. What is happening? 回答1: I would try xl = pd.ExcelFile(dataFileUrl, engine='xlrd') 回答2: I had this same problem and it was because the code that generated dataFileUrl produced a list with only one

Map predictions back to IDs - Python Scikit Learn DecisionTreeClassifier

六眼飞鱼酱① 提交于 2019-12-22 17:17: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

Python Matplotlib Streamplot providing start points

耗尽温柔 提交于 2019-12-14 02:27:38
问题 I am trying to add start points to a streamline plot. I found an example code using start points here; at this link a different issue is discussed but the start_points argument works. From here I grabbed the streamline example code (images_contours_and_fields example code: streamplot_demo_features.py). I don't understand why I can define start points in one code and not the other. I get the following error when I try to define start points in the example code (streamplot_demo_features.py):

ValueError: Cannot copy sequence to array axis in Python for MatplotLib Animation

为君一笑 提交于 2019-12-13 03:49:26
问题 I am reading in a constantly updated data.txt file and am calculating a rolling standard deviation on the incoming data stream. I am storing that in std . I have a window size of 100 on the rolling standard deviation. I am receiving an error: ValueError: cannot copy sequence with size 78 to array axis with dimension 1 where the size corresponds to the number of items in the std array. (So this, of course, increases every time I hit Run). I was wondering why I am receiving this ValueError, and

ValueError: The truth value of an array… from dict key comparison

非 Y 不嫁゛ 提交于 2019-12-13 03:28:51
问题 I can't figure out why I keep getting this error: if node not in self.children: return path ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() def _select(self, node): "Find an unexplored descendent of `node`" path = [] while True: path.append(node) breakpoint() if node not in self.children: return path if node.is_terminal(): return path self.children is a dict() of set() of Nodes. node is obviously a Node I get the same error in debugger