Closed jscuds closed 3 years ago
@jscuds
self.grad_func_specs
. We don't need to iterate for each aux_function because ff.forward
evaluates every aux_function all at once. The only loop in default_finite_differences
iterates through the input dimensionality, but that functionality doesn't currently work.
I think all you need to add to default_finite_diff
is something along the lines of:
if 'random' in self.grad_func_specs:
random_indices = np.random.int(0,x.shape[1], grad_func_specs['random'] ) # where, grad_func_specs['random'] equals the number of indices we want to sample
x = x[:,random_indices]
All the aux_functions should be evaluated, regardless of which observations we sample. You shouldn't change similarity_score
We currently don't have that functionality. @mcembalest @mecunha we should add functionality to spit out the MSE for ff, NLM, and LUNA. Ideally in the 24 hours.
@jscuds awesome work with the finite diff demos. Some feedback:
Scalar Delta Demo
Proposed next steps:
arrange the plots in a multi plot figure. See NLM.demo. A 3 by 1 plot would look good. Some code to accomplish this:
fig,ax = plt.subplots(1,3 ,figsize=(15,5))
i = 0
for model in lunas:
predictives, predictive_samples = model.predict(x_test)
log_l = model.get_log_l(x_train,y_train,x_valid,y_valid)
name = f"Luna: Diff = {diffs[i]}" + f"\n Log Likelihood: {round(log_l,2)}" + f"\n Time: {round(times[i]/(60*60))} Hours"
ax[i]=bh.viz_pp_samples(x_train, y_train,x_test.flatten(),predictive_samples,name, ax[i])
i +=1
plt.legend()
fig.savefig("figs/LUNA_fixed_finite_diff.png")
Gonna review the sampling thing now.
@jscuds
On the sampling analysis: again, this looks great. A few things to note:
grad_func_spec["random"]
is 0.1, we want to make sure we get at least one sample. print(random_indices)
below the line to test, and then remove once confirmed
@msbutler , I thought I'd be able to finish both of these...but I ran into some issues with the latter case.
UPDATES:
_Scalar_DeltaDemo:
I changed LUNA to include the dictionary
grad_func_specs
we discussed. I added the comment #JACK to anything I modified for easy identification and/or removal.fixed
corresponds to a scalar step. I used your LUNADemo parameters, and then added my dictionary. I graphed 3 different cases compared to the LUNADemo case._Cosine_Similarity_RandomIndex:
If you have 20 minutes to go over the
cos_sim_sq
…I don’t think I understand the implementation like I thought I did.[x] How many indices are enough? Is the LUNADemo only using 1 output dimension (I know what it says in “luna_architecture” but if
cos_sim_sq
is based onrange(D_out)
I feel like it should iterate through 5 aux_functions…but the loop only seems to iterate twice).[x] Should the random indices just be choosing 2 random aux functions to compare? Or should there be a user-defined set of the number of pairwise comparisons to make?
General Question Related to Performance Measures:
.train()
method.@vsavram @mecunha for your awareness.