зеркало из https://github.com/microsoft/SparseSC.git
minor fix
This commit is contained in:
Родитель
24bbd67f0b
Коммит
b9c16a73f0
|
@ -361,7 +361,7 @@ def joint_penalty_optimzation(X, Y, L1_pen_start, L2_pen_start, bounds, X_treat
|
|||
X_treat = X_treat, Y_treat = Y_treat,
|
||||
# if LAMBDA is a single value, we get a single score, If it's an array of values, we get an array of scores.
|
||||
LAMBDA = L1_pen_start * np.exp(x[0]),
|
||||
L2_PEN_W = L2_pen_start / np.exp(x[0]),
|
||||
L2_PEN_W = L2_pen_start * np.exp(x[1]),
|
||||
# suppress the analysis type message
|
||||
quiet = True)
|
||||
t2 = time.time();
|
||||
|
@ -372,6 +372,8 @@ def joint_penalty_optimzation(X, Y, L1_pen_start, L2_pen_start, bounds, X_treat
|
|||
|
||||
# the actual optimization
|
||||
diff_results = differential_evolution(L1_L2_obj_func, bounds = bounds)
|
||||
diff_results.x[0] = L1_pen_start * np.exp(diff_results.x[0])
|
||||
diff_results.x[1] = L2_pen_start * np.exp(diff_results.x[1])
|
||||
return diff_results
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
|
|
@ -381,8 +381,8 @@ if __name__ == "__main__":
|
|||
results = SC.joint_penalty_optimzation(X = X_control, Y = Y_pre_control, L1_pen_start = best_L1_penalty_ct, L2_pen_start = L2_pen_start_ct, bounds = ((-6,6,),)*2, X_treat = X_treated, Y_treat = Y_pre_treated)
|
||||
|
||||
import pdb; pdb.set_trace()
|
||||
NEW_best_L1_penalty_ct = best_L1_penalty_ct * np.exp(results.x[0])
|
||||
best_L2_penalty = L2_pen_start_ct * np.exp(results.x[1])
|
||||
NEW_best_L1_penalty_ct = results.x[0]
|
||||
best_L2_penalty = results.x[1]
|
||||
|
||||
print("DE optimized L2 Penalty: %s, DE optimized L1 penalty: %s" % (NEW_best_L1_penalty_ct, best_L2_penalty,) )
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче