用于拟合Keras模型的Dask数据帧
我有一个Dask数据帧,我想用于安装Keras自动编码器型号: 数据帧:用于拟合Keras模型的Dask数据帧,keras,dask,Keras,Dask,我有一个Dask数据帧,我想用于安装Keras自动编码器型号: 数据帧: import dask.dataframe as dd input_df = dd.read_csv(file_path) input_df.dtypes _2.64 _3.64 _4.64 _5.64 Keras型号: autoencoder = Sequential() autoencoder.add(Dense(dense[0], input_shape=(dense[0],), activation = 'rel
import dask.dataframe as dd
input_df = dd.read_csv(file_path)
input_df.dtypes
_2.64
_3.64
_4.64
_5.64
Keras型号:
autoencoder = Sequential()
autoencoder.add(Dense(dense[0], input_shape=(dense[0],), activation = 'relu' ))
autoencoder.add(Dense(dense[1], activation = 'relu' ))
autoencoder.add(Dense(dense[2], activation = 'relu' ))
autoencoder.add(Dense(dense[3], activation = 'relu' ))
autoencoder.add(Dense(dense[0], activation = 'relu' ))
autoencoder.compile(loss='mse',
optimizer='adam',
metrics=['mse'])
当我传递数据框进行装配时:
autoencoder.fit(input_df, input_df,
batch_size=batch_size,
epochs=epochs,
verbose=1,
validation_split = val_split)
我得到一个错误:
TypeError Traceback (most recent call last)
<ipython-input-23-d0480d8a460d> in <module>()
3 epochs=epochs,
4 verbose=1,
----> 5 validation_split = val_split)
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, **kwargs)
950 sample_weight=sample_weight,
951 class_weight=class_weight,
--> 952 batch_size=batch_size)
953 # Prepare validation data.
954 do_validation = False
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size)
799 for (ref, sw, cw, mode) in
800 zip(y, sample_weights, class_weights,
--> 801 feed_sample_weight_modes)
802 ]
803 # Check that all arrays have the same length.
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py in <listcomp>(.0)
797 sample_weights = [
798 standardize_weights(ref, sw, cw, mode)
--> 799 for (ref, sw, cw, mode) in
800 zip(y, sample_weights, class_weights,
801 feed_sample_weight_modes)
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training_utils.py in standardize_weights(y, sample_weight, class_weight, sample_weight_mode)
522 else:
523 if sample_weight_mode is None:
--> 524 return np.ones((y.shape[0],), dtype=K.floatx())
525 else:
526 return np.ones((y.shape[0], y.shape[1]), dtype=K.floatx())
~/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/numeric.py in ones(shape, dtype, order)
201
202 """
--> 203 a = empty(shape, dtype, order)
204 multiarray.copyto(a, 1, casting='unsafe')
205 return a
TypeError: 'float' object cannot be interpreted as an integer
TypeError回溯(最近一次调用)
在()
3个时代=时代,
4详细=1,
---->5验证分割=价值分割)
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py-in-fit(self、x、y、批大小、历元、冗余、回调、验证分割、验证数据、随机排列、类权重、样本权重、初始历元、每历元的步数、验证步数、**kwargs)
950样品重量=样品重量,
951类重量=类重量,
-->952批次大小=批次大小)
953#准备验证数据。
954 do_验证=错误
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py in\u-standard\u-user\u数据(自身、x、y、样本重量、类别重量、检查数组长度、批次大小)
799(参考、开关、连续、模式)输入
800拉链(y、样品重量、等级重量、,
-->801进料(样品重量模式)
802 ]
803#检查所有阵列的长度是否相同。
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py in(.0)
797样本重量=[
798标准化重量(参考、开关、连续、模式)
-->799(参考、开关、连续、模式)输入
800拉链(y、样品重量、等级重量、,
801进料(样品重量模式)
~/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training\u utils.py标准化权重(y、样本权重、等级权重、样本权重模式)
522其他:
523如果样本重量模式为无:
-->524返回np.one((y.shape[0],),dtype=K.floatx()
525其他:
526返回np.one((y.shape[0],y.shape[1]),dtype=K.floatx()
~/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/numeric.py(形状、数据类型、顺序)
201
202 """
-->203 a=空(形状、数据类型、顺序)
204 multiarray.copyto(a,1,casting='unsafe')
205返回a
TypeError:“float”对象不能解释为整数
非常感谢您的帮助!谢谢!请包含完整的回溯,不清楚是什么导致了此错误。@MatiasValdenegro添加了完整的错误日志