# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Speed without Mini Part 2

run modules/venv_setup.ipynb

run modules/module.ipynb

run modules/model.ipynb

run modules/data_loader.ipynb

# +
params, layers = new_test(X_train, grad_check = False)
v, s = adam_init(params)
learning_rate=0.1
i=0
t=0
interval = 1180 #20 epochs = 1180 iterations
decay_rate = 0.01
accuracy = 0
start = time.time()
all_accs = []

while accuracy <= 0.988036976617727:
    
    if i==1000:
        break
    
    print(i, accuracy)
    
    AL, cache, cost = forward_prop_fix(X_train, y_train, params, lambda_value =0.1)
    
    grads = back_prop_fix(AL, X_train, y_train, layers, cache, lambda_value=0.1)
    
    t+=1
    
    params = update_params_adam(params, grads, v, s, t, learning_rate=learning_rate, beta1 = 0.9, beta2 = 0.999, epsilon = 1e-8)
    
    _, accuracy, _ = predict(X_test, y_test, params, lambda_value=0.1, threshold=0.5)
    
    if i % interval==0:
        
        new_lr = update_lr_time(learning_rate, i, decay_rate, interval)
        learning_rate = new_lr
    
    i+=1
    
    all_accs.append(accuracy)

end = time.time()

duration = (end-start)/60

with open('saved_data/compare/compare_no_mini_part2', 'wb') as f:
    pickle.dump([all_accs, duration], f)
# -

all_accs[np.argmax(all_accs)], np.argmax(all_accs)

duration

StarcoderdataJupyterScriptsDedupFiltered