Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

python - How to fix "TypeError fit_generator() got an unexpected keyword argument 'samples_per_epoch'"

defining the samples per epoch = 1212 and nb_val_samples = 20 nb_epoch=20, validation_data=test_set, nb_val_samples=300 then in am getting the error


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Note that fit_generator() is deprecated. You can use fit() directly with Python generators.

An example for a batch size of 1

history = model.fit(generate_data(), steps_per_epoch=len(x_train), epochs=100, 
callbacks = [callback],class_weight={0:4, 1:1}, validation_data=generate_val(), 
 validation_steps=len(x_test))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...