model.addlayers.MaxPooling1Dpool_size = 3^ SyntaxError:语法无效

问题描述

import numpy as np
import pandas as pd
import plotly.express as px
from pandas import Timestamp

all_dwellings=pd.DataFrame(<yourData>)
first_timebuyers = pd.DataFrame(<yourData>)

# datagrab 1
lineplt_all = px.line(data_frame = all_dwellings,x='Date',y='Average House Price (£)',color= 'Country',hover_name='Country',color_discrete_sequence=['rgb(23,153,59)','rgb(214,163,21)','rgb(40,48,165)','rgb(210,38)']
              )

# datagrab 2
lineplt_first = px.line(data_frame = first_timebuyers,38)']
              )

### Your original setup
lineplt = px.line(data_frame = all_dwellings,38)']
              )
updatemenus = [
{'buttons': [
            {
            'method': 'restyle','label': 'All Dwellings','args': [{'y': [dat.y for dat in lineplt_all.data]}]
            },{
            'method': 'restyle','label': 'First Time Buyers','args': [{'y': [dat.y for dat in lineplt_first.data]}]
            }
            ],'direction': 'down','showactive': True,}
]

lineplt = lineplt.update_layout(
            title_text='Average House Price in UK (£)',title_x=0.5,#plot_bgcolor= 'rgb(194,208,209)',xaxis_showgrid=False,yaxis_showgrid=False,hoverlabel=dict(font_size=10,bgcolor='rgb(69,95,154)',bordercolor= 'whitesmoke'),legend=dict(title='Please click legend item to remove <br>or add to plot',x=0,y=1,traceorder='normal',bgcolor='LightSteelBlue',xanchor = 'auto'),updatemenus=updatemenus
            )
lineplt = lineplt.update_traces(mode="lines",hovertemplate= 'Date = %{x} <br>' + 'Price = £%{y:.2f}')
lineplt.show()

我收到此错误。问题是什么?我已经搜索了它,但是几乎到处都发现了相同的语法

这是我的整个模特。模型中还有其他问题吗?我正在音素上进行语音识别

   model.add(layers.MaxPooling1D(pool_size=3))
        ^
SyntaxError: invalid syntax

解决方法

在此行

#Second Conv1D layer

model.add(layers.Conv1D(16,11,activation='relu',padding='valid',strides=1)

您忘记关闭括号。

将其更改为此

model.add(layers.Conv1D(16,strides=1))

下一行出现相同的错误

#Third Conv1D layer
model.add(layers.Conv1D(32,9,strides=1)

要解决此问题,只需添加最后一个括号

#Third Conv1D layer
model.add(layers.Conv1D(32,strides=1))

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...