Пример #1
0
 def get_variance(self,df):
     ## A dataframe object is needed for this function. 
     ## This access the explode_yield function from the load_format_data.py file. The explode_yield() function returns three dataframe objects 
     ## the first an exploded_df data frame 
     exploded_df,_,_=load_format_data.explode_yield(df)
     ## The above dataframe is turned into an array where each element is squared and then then the squared standard deviation is averaged. 
     ## This value is returned.
     return np.average(np.square(np.array(exploded_df['y_std'])))
Пример #2
0
            test_loss = mdl.model_stats['test_avg_loss']
            test_std = mdl.model_stats['test_std_loss']
    loss_per_model.append(test_loss)
    std_per_model.append(test_std)

seq_model = modelbank.seq_to_yield_model('forest', 1)
seq_loss = seq_model.model_stats['test_avg_loss']
seq_std = seq_model.model_stats['test_std_loss']
x = [-0.3, 0.8]
seq_plus = [seq_loss + seq_std] * 2
seq_min = [seq_loss - seq_std] * 2

control_model = modelbank.control_to_yield_model('ridge', 1)
control_loss = control_model.model_stats['test_avg_loss']
control_model.limit_test_set([1, 8, 10])
exploded_df, _, _ = load_format_data.explode_yield(control_model.testing_df)
exp_var = np.average(np.square(np.array(exploded_df['y_std'])))

fig, ax = plt.subplots(1, 1, figsize=[2, 2], dpi=300)

xloc = [0, 0.5]
ax.axhline(seq_loss,
           -0.5,
           4.5,
           color='green',
           linestyle='--',
           label='Sequence Model')
ax.axhline(control_loss,
           -0.5,
           2.5,
           color='red',
Пример #3
0
 def get_variance(self, df):
     exploded_df, _, _ = load_format_data.explode_yield(df)
     return np.average(np.square(np.array(exploded_df['y_std'])))