valueerror

ValueError: malformed node or string with ast.literal_eval() when adding a Keras layer

眉间皱痕 提交于 2020-08-07 05:49:18
问题 I want to build a Keras Model evaluating strings. If I do the following: from keras.models import Sequential from keras.layers import Dense model = Sequential() model.add(Dense(units=10, input_shape=(10,), activation='softmax')) It works fine. And I can see the model.summary() . But, when I add the layer with ast.literal_eval() from keras.models import Sequential from keras.layers import Dense import ast model = Sequential() code = "model.add( Dense( input_shape=(10,), units=10, activation=

ValueError: Unknown layer:name when loading a keras model

 ̄綄美尐妖づ 提交于 2020-08-06 12:31:35
问题 I have trained a CNN and saved it accordingly: model = Sequential() model.add(Flatten(input_shape=train_data.shape[1:])) model.add(Dense(256, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(1, activation='sigmoid')) model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy']) model.fit(train_data, train_labels, epochs=epochs, batch_size=batch_size, validation_data=(validation_data, validation_labels)) model.save('full_model.h5') I now try load the model in

ValueError: Unknown layer:name when loading a keras model

♀尐吖头ヾ 提交于 2020-08-06 12:28:08
问题 I have trained a CNN and saved it accordingly: model = Sequential() model.add(Flatten(input_shape=train_data.shape[1:])) model.add(Dense(256, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(1, activation='sigmoid')) model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy']) model.fit(train_data, train_labels, epochs=epochs, batch_size=batch_size, validation_data=(validation_data, validation_labels)) model.save('full_model.h5') I now try load the model in

Convolutional Neural Net Architecture - correct?

南笙酒味 提交于 2020-07-20 06:32:19
问题 I am trying to train a convolutional neural net. Therefore I am using a datset of 646 images/license plates which contains 8 characters (0-9, A-Z; without letter 'O' and blank spaces, in total 36 possible characters). These are my training data X_train . Their shape is (646, 40, 200, 3) with color code 3. I resized them to the same shape. I also have a dataset which contains the labels of this images, which I one-hot-encoded to a numpy array of shape (646, 8, 36) . This data is my y_train

raise ValueError(“Unknown label type: %s” % repr(ys)) ValueError: Unknown label type: (array

杀马特。学长 韩版系。学妹 提交于 2020-06-28 03:38:12
问题 Im trying to make a Machine Learning approach but I'm having some problems. This is my Code: import sys import scipy import numpy import matplotlib import pandas import sklearn from pandas.plotting import scatter_matrix import matplotlib.pyplot as plt from sklearn import model_selection from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score from sklearn.linear_model import LogisticRegression from sklearn.tree

raise ValueError(“Unknown label type: %s” % repr(ys)) ValueError: Unknown label type: (array

北城以北 提交于 2020-06-28 03:38:00
问题 Im trying to make a Machine Learning approach but I'm having some problems. This is my Code: import sys import scipy import numpy import matplotlib import pandas import sklearn from pandas.plotting import scatter_matrix import matplotlib.pyplot as plt from sklearn import model_selection from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score from sklearn.linear_model import LogisticRegression from sklearn.tree

PyInstaller “ValueError: source code string cannot contain null bytes”

情到浓时终转凉″ 提交于 2020-06-27 16:17:53
问题 I'm getting a ValueError: source code string cannot contain null bytes when executing a command pyinstaller main.py in a cmd both with and without administrator privileges. Traceback (most recent call last): File "c:\users\User\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\User\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\User

ValueError: operands could not be broadcast together with shapes (2501,201) (2501,)

家住魔仙堡 提交于 2020-06-01 05:38:38
问题 I am new to python so please be nice. I am trying to compare two Numpy arrays with the np.logical_or function. When I run the below code an error appears on the Percentile = np.logical_or(data2 > Per1, data2 < Per2) line stating ValueError: operands could not be broadcast together with shapes (2501,201) (2501,) data = 1st Array data2 = 2nd Array Per1 = np.percentile(data, 10, axis=1) Per2 = np.percentile(data, 90, axis=1) Percentile = np.logical_or(data2 > Per1, data2 < Per2) print(Percentile

Conditional data imputation in Python

孤者浪人 提交于 2020-05-17 06:24:48
问题 I am trying to impute values in my dataset conditionally. Say I have three columns, If Column 1 is 1 then Column 2 is 0 and Column 3 is 0; If column 1 is 2 then Column 2 is Mean () and Column 3 is Mean(). I tried running an if statement with the function any() and defined the conditions separately. However the conditions are not being fulfilled based on conditions, I am either getting all mean values or all zeroes. The exact code goes as below: if (df['Retention_Term'] == 6): df.cl_tot_calls

value error for simple definition to generate list of colors

人盡茶涼 提交于 2020-05-17 05:51:35
问题 I am making a simple definition to return a list of colors based on some intervals. Unfortunately I keep getting the following error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). I have seen the following discussion on stackoverflow but only had failed attempts to make it work. Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() This is my code: y = 5 std = pd.Series([1,1,1,1]) values = pd