Advertisement
Leamich

Untitled

Mar 31st, 2023
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import pandas as pd
  2. import pickle
  3. import catboost
  4.  
  5.  
  6. class Solver:
  7.     def __init__(self):
  8.         pd.options.mode.chained_assignment = None
  9.         self.ship = None
  10.         self.logs = None
  11.        
  12.         with open(__file__[:-7] + "model.pkl", "rb") as f:
  13.             self.model = pickle.load(f)
  14.  
  15.     def new_mission(self, ship):
  16.         self.ship = ship.drop(columns=["ship_id"])
  17.         self.logs = []
  18.    
  19.     def append_predict(self, log):
  20.         for cl in self.ship.columns:
  21.             log.loc[:, cl] = self.ship.loc[:, cl]
  22.         self.logs.append(log)
  23.         return max(1, self.model.predict(log)[0])
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement