Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. from sklearn.model_selection import train_test_split
  2. from nltk.corpus import stopwords
  3. from RMDL import text_feature_extraction as txt
  4. from RMDL import RMDL_Text as RMDL
  5.  
  6.  
  7. nltk.download('stopwords')
  8. nltk.download('punkt')
  9.  
  10. articles_text = [txt.text_cleaner(a, deep_clean=True) for a in articles['text'].values]
  11.  
  12. np.random.seed(7)
  13. X_train, X_test, y_train, y_test = train_test_split(articles_text, labels, test_size=0.2, random_state=4)
  14.  
  15. batch_size = 64
  16. sparse_categorical = 0
  17. n_epochs = [50, 50, 50]  ## DNN--RNN-CNN
  18. Random_Deep = [3, 3, 3]  ## DNN--RNN-CNN
  19.  
  20. RMDL.Text_Classification(X_train, y_train, X_test, y_test,
  21.                          batch_size=batch_size,
  22.                          sparse_categorical=sparse_categorical,
  23.                          random_deep=Random_Deep,
  24.                          epochs=n_epochs,
  25.                          GloVe_file='/content/glove.6B.50d.txt',
  26.                          random_optimizor=False,
  27.                          plot=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement