Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python - Invalid Parameters Passed

Still on my GAN code for network traffic generation. My code is giving me the error that the parameters i passed for the train_test_split function is invalid. What do I do? Please see the code and error message below;

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-50-a2836ba27bc4> in <module>
      9     cross_validation_flg = False
     10     benign_file = '../data/attack_normal_data/benign_data.csv'
---> 11     benign_model, benign_test_loader = run_main(benign_file, num_features=41)
     12     # Save the model checkpoint
     13     torch.save(benign_model.state_dict(), 'benign_model_epoches%d.ckpt' % num_epochs)

<ipython-input-44-0a86075f4966> in run_main(input_file, num_features)
      6 
      7     # X_train, X_test, y_train, y_test = train_test_split(value_x, value_y, train_size=0.7, 
shuffle=True)
----> 8     train_sampler, test_sampler = train_test_split(dataset, split_percent=0.7, shuffle=True)
      9     cntr = Counter(dataset.y)
     10     print('dataset: ', len(dataset), ' y:', sorted(cntr.items()))

~anaconda3libsite-packagessklearnmodel_selection\_split.py in train_test_split(*arrays, 
**options)
   2123 
   2124     if options:
-> 2125         raise TypeError("Invalid parameters passed: %s" % str(options))
   2126 
   2127     arrays = indexable(*arrays)

TypeError: Invalid parameters passed: {'split_percent': 0.7}
question from:https://stackoverflow.com/questions/65906302/invalid-parameters-passed

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

1 Answer

0 votes
by (71.8m points)

I used train_size = 0.7 instead, and it worked.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...