<jupyter_start><jupyter_text>Plotting Model Predictions<jupyter_code># Import necessary packages
import numpy as np
import pandas as pd
import tensorflow as tf
import scipy as scp
import matplotlib.pyplot as plt
import os
import dnnregressor_predictor as dnn_pred
import dnnregressor_model_and_input_fn as dnn_model_input
import make_data_wfpt as mdw
import make_data_sin as mds
hyper_params = pd.read_csv('/Users/admin/OneDrive/git_repos/nn_likelihoods/tensorflow_models/dnnregressor_mse_08_09_18_21_38_46/dnn_training_results_08_09_18_21_38_46.csv',
                          converters = {'hidden_units':eval,
                                        'activations':eval})

model_params = hyper_params.to_dict(orient = 'list')
for key in model_params.keys():
    model_params[key] = model_params[key][0]
# Get best checkpoint
with open('/Users/admin/OneDrive/git_repos/nn_likelihoods/tensorflow_models/dnnregressor_mse_08_06_18_17_40_28/best_checkpoint.txt', 'r') as myfile:
    best_checkpoint = myfile.read().replace('\n', '')
# Generate a dataset wfpt
dataset,_, __ = mdw.make_data_rt_choice(v_range = [3,3], # uniform [0.6, 0.6]
                              a_range = [0.1,0.1], # unifor
                              w_range = [0.9, 0.9],  # uniform
                              rt_params = [1,2], # gamma(1,2)
                              n_samples = 10000,
                              write_to_file = False)

# Generate a dataset sin
features_sin, labels_sin = mds.make_data()
# Make dataset feedable to tensorflow (wfpt)
features, labels, __, ___ = mdw.train_test_split_rt_choice(data = dataset,
                                                           p_train = 1,
                                                           write_to_file = False,
                                                           from_file = False)

# Make dataset feedable to tensorflow (sin)
# features_sin, labels_sin, __, __ = mds.train_test_split(features_sin, 
#                                                        labels_sin, 
#                                                        p = 1)
# Make feature columns (wfpt)
feature_columns = dnn_model_input.make_feature_columns_numeric(features = features)
model_params['feature_columns'] = feature_columns
# Make feature columns (sin)
feature_columns_sin = dnn_model_input.make_feature_columns_numeric(features = features_sin)
model_params['feature_columns'] = feature_columns_sin
# Reinstantiate model
my_predictor = dnn_pred.get_dnnreg_predictor(model_directory = '/Users/admin/OneDrive/git_repos/nn_likelihoods/tensorflow_models/dnnregressor_mse_08_09_18_21_38_46/',
                                             params = model_params)
# Get Predictions (wfpt)
my_predictions = dnn_pred.get_predictions(regressor = my_predictor,
                                         features = features,
                                         labels = labels,
                                         checkpoint = "/Users/admin/OneDrive/git_repos/nn_likelihoods/tensorflow_models/dnnregressor_mse_08_09_18_21_38_46/model.ckpt-96000")




# Plot outcome (wfpt)
plt.plot(dataset['rt'], dataset['nf_likelihood'], '.')
plt.plot(dataset['rt'], my_predictions.flatten(), '.')
plt.xlim((0,0.2))
plt.show()
# Get Predictions (sin)
my_predictions = dnn_pred.get_predictions(regressor = my_predictor,
                                         features = features_sin,
                                         labels = labels_sin)
# Plot outcome (sin)
plt.plot(features_sin['x_0'][features_sin['x_1'] == 0], labels_sin[features_sin['x_1'] == 0], '.')
plt.plot(features_sin['x_0'][features_sin['x_1'] == 1], labels_sin[features_sin['x_1'] == 1], '.')
plt.plot(features_sin['x_0'], my_predictions.flatten(), '.', color = 'yellow')
plt.xlim((-10,10))
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10107357947106572, 'fraction_numerical': 0.028541503011259493, 'mean_word_length': 2.407671721677074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '151748', 'license': 'MIT', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1147, 'n_words': 200, 'path': 'deprecated/.ipynb_checkpoints/visualize_predictions_wfpt-checkpoint.ipynb', 'repo_name': 'prashantramnani/nn_likelihoods', 'size': '3819'}