相关疑难解决方法(0)

无法将DataFrame保存到HDF5("对象标头消息太大")

我在Pandas中有一个DataFrame:

In [7]: my_df
Out[7]: 
<class 'pandas.core.frame.DataFrame'>
Int64Index: 34 entries, 0 to 0
Columns: 2661 entries, airplane to zoo
dtypes: float64(2659), object(2)
Run Code Online (Sandbox Code Playgroud)

当我尝试将其保存到磁盘时:

store = pd.HDFStore(p_full_h5)
store.append('my_df', my_df)
Run Code Online (Sandbox Code Playgroud)

我明白了:

  File "H5A.c", line 254, in H5Acreate2
    unable to create attribute
  File "H5A.c", line 503, in H5A_create
    unable to create attribute in object header
  File "H5Oattribute.c", line 347, in H5O_attr_create
    unable to create new attribute in header
  File "H5Omessage.c", line 224, in H5O_msg_append_real
    unable to create new message
  File "H5Omessage.c", line 1945, …
Run Code Online (Sandbox Code Playgroud)

python hdf5 pytables pandas

7
推荐指数
3
解决办法
4949
查看次数

TypeError:无法为深度学习模型腌制弱引用对象

当我运行 pickle.dump(model,open('modelDL.pkl','wb')) 时,我收到 TypeError: can't pickle weakref objects。

我创建了一个深度学习模型,我正在尝试保存它。下面是模型。

model = Sequential()

model.add( Dense(30,activation='relu') )
model.add( Dropout(0.5) ) 
model.add( Dense(20,activation='relu') )
model.add( Dropout(0.5) ) 
model.add( Dense(20,activation='relu') )
model.add( Dropout(0.5) )     
model.add( Dense(1,activation='sigmoid') )

model.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy']) 
Run Code Online (Sandbox Code Playgroud)

classification python-3.x deep-learning tf.keras tensorflow2.0

7
推荐指数
1
解决办法
7442
查看次数