55#
66# It is made available under the MIT License
77
8+ import os
9+ from data import CHART_DIR
10+
811import numpy as np
912from scipy .stats import norm
1013
@@ -35,7 +38,7 @@ def lr_model(clf, X):
3538pyplot .xlabel ("feature value" )
3639pyplot .ylabel ("class" )
3740pyplot .grid (True , linestyle = '-' , color = '0.75' )
38- pyplot .savefig ("log_reg_example_data.png" , bbox_inches = "tight" )
41+ pyplot .savefig (os . path . join ( CHART_DIR , "log_reg_example_data.png" ) , bbox_inches = "tight" )
3942
4043
4144def lin_model (clf , X ):
@@ -66,7 +69,7 @@ def lin_model(clf, X):
6669pyplot .ylabel ("class" )
6770pyplot .title ("linear fit on additional data" )
6871pyplot .grid (True , linestyle = '-' , color = '0.75' )
69- pyplot .savefig ("log_reg_log_linear_fit.png" , bbox_inches = "tight" )
72+ pyplot .savefig (os . path . join ( CHART_DIR , "log_reg_log_linear_fit.png" ) , bbox_inches = "tight" )
7073
7174pyplot .figure (figsize = (10 , 4 ))
7275pyplot .xlim ((- 5 , 20 ))
@@ -76,7 +79,7 @@ def lin_model(clf, X):
7679pyplot .xlabel ("feature value" )
7780pyplot .ylabel ("class" )
7881pyplot .grid (True , linestyle = '-' , color = '0.75' )
79- pyplot .savefig ("log_reg_example_fitted.png" , bbox_inches = "tight" )
82+ pyplot .savefig (os . path . join ( CHART_DIR , "log_reg_example_fitted.png" ) , bbox_inches = "tight" )
8083
8184X = np .arange (0 , 1 , 0.001 )
8285pyplot .figure (figsize = (10 , 4 ))
@@ -94,4 +97,4 @@ def lin_model(clf, X):
9497pyplot .xlabel ("P" )
9598pyplot .ylabel ("log(odds) = log(P / (1-P))" )
9699pyplot .grid (True , linestyle = '-' , color = '0.75' )
97- pyplot .savefig ("log_reg_log_odds.png" , bbox_inches = "tight" )
100+ pyplot .savefig (os . path . join ( CHART_DIR , "log_reg_log_odds.png" ) , bbox_inches = "tight" )
0 commit comments