File size: 543 Bytes
0aa9c34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import sys

import numpy as np 
import pandas as pd
import dill
import pickle
from sklearn.metrics import r2_score
from sklearn.model_selection import GridSearchCV

from src.exception import CustomException

def save_object(file_path , obj):
        try:
            dir_path = os.path.dirname(file_path)

            os.makedirs(dir_path,exist_ok= True)

            with open(file_path,"wb") as file_obj:
                  pickle.dump(obj,file_obj)
        except Exception as e:
              raise CustomException(e,sys)