我有一个下面列出的序列的原始数据帧,我尝试使用 one-hot 编码,然后将它们存储在一个新的数据帧中,我尝试使用以下代码执行此操作,但无法存储,因为我之后得到以下输出:
代码:
onehot_encoder = OneHotEncoder()
sequence = np.array(list(x_train['sequence'])).reshape(-1, 1)
encoded_sequence = onehot_encoder.fit_transform(sequence).toarray()
encoded_sequence
Run Code Online (Sandbox Code Playgroud)
但出现错误
ValueError: Wrong number of items passed 12755, placement implies 1
Run Code Online (Sandbox Code Playgroud) 我正在尝试按如下方式制作多输入模型,但在定义以下内容时遇到问题:
我想建立这样的东西:
-First Dense Layer- - First Dense layer -
| |
| |
Second Dense layer Second Dense layer
|
|
Final Dense layer (Single Output)
Run Code Online (Sandbox Code Playgroud)
但是,在运行模型时出现以下错误:
AttributeError: 'Concatenate' object has no attribute 'shape'
Run Code Online (Sandbox Code Playgroud)
def build_nn_model(x_input1_train, x_input2_train):
"""
Creates the a multi-channel ANN, capable of accepting multiple inputs.
:param: none
:return: the model of the ANN with a single output given
"""
x_input1= np.expand_dims(x_input1,1)
# define two sets of inputs for models
input1= Input(shape …Run Code Online (Sandbox Code Playgroud)