Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

shared.py 986 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  1. import os
  2. data_dir = os.path.join(os.path.dirname(__file__), '../data/')
  3. outputs_dir = os.path.join(os.path.dirname(__file__), '../outputs/')
  4. raw_data = os.path.join(data_dir, 'CrossValidated-Posts.csv')
  5. train_data = os.path.join(data_dir, 'train-raw.csv')
  6. test_data = os.path.join(data_dir, 'test-raw.csv')
  7. train_processed = os.path.join(data_dir, 'train-processed.csv')
  8. test_processed = os.path.join(data_dir, 'test-processed.csv')
  9. train_tfidf = os.path.join(data_dir, 'train-tfidf.pkl')
  10. test_tfidf = os.path.join(data_dir, 'test-tfidf.pkl')
  11. vectorizer_pkl = os.path.join(outputs_dir, 'tfidf-vectorizer.pkl')
  12. classifier_pkl = os.path.join(outputs_dir, 'classifier.pkl')
  13. col_id = 'Id'
  14. col_text = 'Text'
  15. col_title = 'Title'
  16. col_body = 'Body'
  17. col_tags = 'Tags'
  18. col_label = 'IsTaggedML'
  19. def save(obj, path):
  20. import pickle
  21. with open(path, 'wb') as f:
  22. pickle.dump(obj, f)
  23. def load(path):
  24. import pickle
  25. with open(path, 'rb') as f:
  26. return pickle.load(f)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...