Skip to content

Commit

Permalink
Create data_saver.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 7, 2024
1 parent 6b40bf7 commit 83c9f70
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions projects/DAPIO/data-processing/data-storage/data_saver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pandas as pd
from sklearn.externals import joblib

class DataSaver:
def __init__(self, data: pd.DataFrame, model: RandomForestClassifier):
self.data = data
self.model = model

def save_data(self, file_path: str) -> None:
self.data.to_csv(file_path, index=False)

def save_model(self, file_path: str) -> None:
joblib.dump(self.model, file_path)

0 comments on commit 83c9f70

Please sign in to comment.