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

predict.py 530 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
  1. import numpy as np
  2. import pandas as pd
  3. import os
  4. import pickle
  5. import warnings
  6. test_df = pd.read_csv('../readonly/final_project_data/testing_data.csv')
  7. file_name = '../readonly/models/lightgbm_model_1.sav'
  8. fin_model = pickle.load(file_name, 'rb')
  9. preds = fin_model.predict(test_df.loc[:, ["date_block_num", "shop_id", "item_id", "cat_id", "item_price"]])
  10. dt = {'ID' : test_df.iloc[:, 0].values, 'item_cnt_month' : preds}
  11. res_df = pd.DataFrame(data=dt)
  12. res_df.to_csv('../readonly/final_project_data/result.csv', index=False)
Tip!

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

Comments

Loading...