@@ -100,13 +100,16 @@ def drop_static_cols(self):
100
100
if df1 [c ].nunique () == 1 :
101
101
cols_to_be_dropped .append (c )
102
102
df2 = df1 .drop (cols_to_be_dropped , axis = 1 )
103
- if len (cols_to_be_dropped ) > 0 :
103
+ if len (cols_to_be_dropped ) == 0 :
104
+ print ("Nothing to be dropped" )
105
+ if len (cols_to_be_dropped ) == 1 :
106
+ print ("Dropped the following column:" , cols_to_be_dropped [0 ])
107
+ if len (cols_to_be_dropped ) > 1 :
104
108
print ("Dropped the following columns:" , end = " " )
105
109
for i in cols_to_be_dropped [:- 1 ]:
106
110
print (i , end = ", " )
107
111
print ("and " + cols_to_be_dropped [- 1 ], end = "." )
108
- else :
109
- print ("Nothing to be dropped" )
112
+
110
113
df2 = df1
111
114
self .df = df2
112
115
@@ -496,14 +499,17 @@ def rmse_test(self):
496
499
497
500
return round (error ,3 )
498
501
499
- def save_model (self ):
502
+ def save_model (self , filename = None ):
500
503
"""
501
504
Saves the fitted model in a h5 file
502
505
"""
503
506
if self .fitted_ :
504
507
model = self .model
505
- var = str (self .output_var )
506
- filename = var + "_model" + ".h5"
508
+ if filename is not None :
509
+ filename = filename
510
+ else :
511
+ var = str (self .output_var )
512
+ filename = "model_" + var + ".h5"
507
513
model .save (filename )
508
514
else :
509
515
print ("Nothing to be saved. Model not fitted yet!" )
0 commit comments