<jupyter_start><jupyter_text>Single layer net  Necessary imports<jupyter_code>import keras
from keras import backend as K
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
%matplotlib inline
from IPython.display import display
from keras.preprocessing import image
from keras.applications.xception import preprocess_input, decode_predictions<jupyter_output><empty_output><jupyter_text>Function to grab and flatten imagesAdditional function to read in images but not flatten<jupyter_code>def grab_image_flatten(img_path_base, index, numImages):
    #Desired image dimension (image will be square ie # by # pixels)
    imageDim = 100
    
    if (index<10):
        img_path = img_path_base+"000"+str(index)+"_model.png"
    elif (index<100 and index >=10):
        img_path = img_path_base+"00"+str(index)+"_model.png"
    elif (index<1000 and index>=100):
        img_path = img_path_base+"0"+str(index)+"_model.png"
    elif (index<10000 and index>=1000):
        img_path = img_path_base+str(index)+"_model.png"
        
    img = image.load_img(img_path, target_size=(imageDim, imageDim), color_mode = "grayscale")
    x = image.img_to_array(img)
    x = x.flatten()
    x = np.expand_dims(x, axis=0)
    x = preprocess_input(x)
    return x

def grab_image_full(img_path_base, index, numImages):
    #Desired image dimension (image will be square ie # by # pixels)
    imageDim = 100
    
    if (index<10):
        img_path = img_path_base+"000"+str(index)+"_model.png"
    elif (index<100 and index >=10):
        img_path = img_path_base+"00"+str(index)+"_model.png"
    elif (index<1000 and index>=100):
        img_path = img_path_base+"0"+str(index)+"_model.png"
    elif (index<10000 and index>=1000):
        img_path = img_path_base+str(index)+"_model.png"
        
    img = image.load_img(img_path, target_size=(imageDim, imageDim), color_mode = "grayscale")
    x = image.img_to_array(img)
    x = np.expand_dims(x, axis=0)
    x = preprocess_input(x)
    return x

#Num of images to read in
numImages = 600
X = np.concatenate([grab_image_flatten('/home/atm4w/Project/Data/miscImgs/',i, numImages) for i in range(numImages)]) 
X /= 255.0
Xoriginal = np.concatenate([grab_image_full('/home/atm4w/Project/Data/miscImgs/',i, numImages) for i in range(numImages)]) 
Xoriginal /= 255.0

display(X.shape)
display(Xoriginal.shape)<jupyter_output><empty_output><jupyter_text>Function to display weights<jupyter_code>def view_weights( model, saveLoc = None ):
    weights = model.get_weights()[0]
    l1 = weights[:,0]
    #(100,100) dependent on image size
    l1 = np.reshape( l1, (100,100) )

    plt.imshow(l1)
    
    if saveLoc != None:
        plt.savefig( saveLoc )
        
    plt.show()<jupyter_output><empty_output><jupyter_text>Load in model scores<jupyter_code>Y = np.loadtxt('/home/atm4w/Project/Data/miscImgs/scores/humanScores.txt')
Y=Y[0:600]
display(Y[0:10])
display(Y.shape)<jupyter_output><empty_output><jupyter_text>Create histogram to show distribution of scores<jupyter_code>n_bins = 10
n, bins, patches = plt.hist(Y, n_bins, facecolor='blue', alpha=0.75, rwidth=0.9)
plt.xlabel('Human Scores')
plt.ylabel('Number of Models')
plt.title("Distribution of Model Scores")
plt.savefig("distribution.png")
plt.show()<jupyter_output><empty_output><jupyter_text>Shuffle model images and scores<jupyter_code>p = np.random.permutation(len(X))
X_original_shuffled = Xoriginal[p]
Xshuffled = X[p]
Yshuffled = Y[p]

display(X_original_shuffled.shape)
display(Xshuffled.shape)
display(Yshuffled.shape)<jupyter_output><empty_output><jupyter_text>Split into training and test data (85% for training and validation)<jupyter_code>x_train = Xshuffled[0:(round(numImages*.85)),:]
y_train = Yshuffled[0:(round(numImages*.85))]
x_original_train = X_original_shuffled[0:(round(numImages*.85)),:,:]
x_test = Xshuffled[(round(numImages*.85)): , :]
y_test = Yshuffled[(round(numImages*.85)):]
x_original_test = X_original_shuffled[(round(numImages*.85)): , : , :]

display(x_train.shape)
display(y_train.shape)
display(x_original_train.shape)
display(x_test.shape)
display(y_test.shape)
display(x_original_test.shape)<jupyter_output><empty_output><jupyter_text>Build net<jupyter_code>model = keras.Sequential()

input_size = x_train.shape[1]
model.add(keras.layers.Dense(1, activation='sigmoid', input_shape=[input_size]))

model.compile(loss=keras.losses.mean_squared_error, optimizer=keras.optimizers.Adam(learning_rate=0.01), metrics=['mse'])
model.summary()<jupyter_output>Model: "sequential_31"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
dense_31 (Dense)             (None, 1)                 10001     
=================================================================
Total params: 10,001
Trainable params: 10,001
Non-trainable params: 0
_________________________________________________________________<jupyter_text>Train it<jupyter_code>batch_size = 4
epochs = 250
history = model.fit(x_train, y_train,
    batch_size=batch_size,
    epochs=epochs,
    verbose=0,
    validation_split = 0.3)<jupyter_output><empty_output><jupyter_text>Generate loss (MSE) plot<jupyter_code>plt.figure()
#* summarize history for loss
plt.subplot(212)
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('single layer model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['training', 'validation'], loc='upper left')
plt.tight_layout()
plt.savefig("SingleModelLoss.png")
plt.show()<jupyter_output><empty_output><jupyter_text>Test on remaining 90 images and calculate mean difference between predicted and actual scores<jupyter_code>loss = history.history['loss']
val_loss = history.history['val_loss']
print("Training loss final")
print(loss[-1])
print("Validation loss final")
print(val_loss[-1])
preds = model.predict(x_test)
diff = preds.flatten() - (y_test)
print("Mean difference")
print("---------------")
display(np.mean(np.abs(diff)))<jupyter_output>Mean difference
---------------<jupyter_text>Various data plots<jupyter_code>shuffledInd = np.linspace(0,(numImages-round(numImages*.85))-1,num = numImages-(round(numImages*.85)))

plt.figure()
plt.scatter(shuffledInd, y_test)
plt.scatter(shuffledInd, preds)
plt.title("Predictions/Actual Comparison")
plt.ylabel("score")
plt.xlabel("image num")
plt.legend(['actual', 'prediction'], loc='upper left')
plt.figure(figsize=(200,20))
plt.show()
plt.figure()
plt.scatter(y_test, preds)
plt.title("Predicted vs Actual value")
plt.ylabel("predicted value")
plt.xlabel("actual value")
plt.axis('square')
plt.savefig("SinglePredictedVAct.png")
plt.show()
plt.figure()
plt.scatter(y_test, diff)
plt.title("Difference vs Actual value")
plt.ylabel("Difference")
plt.xlabel("actual value")
plt.axis('square')
plt.savefig("SingleDiffVAct.png")
plt.show()<jupyter_output><empty_output><jupyter_text>Find the 10 worst and 5 best predictions<jupyter_code>absDiff = np.abs(diff)

top10 = np.argpartition(absDiff, -10)[-10:]
bottom5= np.argpartition(absDiff, 5)[:5]
display(top10)
display(bottom5)<jupyter_output><empty_output><jupyter_text>Show the 10 worst predictions<jupyter_code>for i in range (10):
    print("Human Score")
    display(y_test[top10[i]])
    print("Prediction")
    display(preds[top10[i]][0])
    print("---------------")<jupyter_output><empty_output><jupyter_text>Show the 10 models that had the largest difference between predicted and human score (worst predictions)<jupyter_code>plt.imshow(image.array_to_img(x_original_test[top10[0],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[0]])
print("Prediction")
display(preds[top10[0]][0])
plt.imshow(image.array_to_img(x_original_test[top10[1],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[1]])
print("Prediction")
display(preds[top10[1]][0])
plt.imshow(image.array_to_img(x_original_test[top10[2],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[2]])
print("Prediction")
display(preds[top10[2]][0])
plt.imshow(image.array_to_img(x_original_test[top10[3],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[3]])
print("Prediction")
display(preds[top10[3]][0])
plt.imshow(image.array_to_img(x_original_test[top10[4],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[4]])
print("Prediction")
display(preds[top10[4]][0])
plt.imshow(image.array_to_img(x_original_test[top10[5],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[5]])
print("Prediction")
display(preds[top10[5]][0])
plt.imshow(image.array_to_img(x_original_test[top10[6],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[6]])
print("Prediction")
display(preds[top10[6]][0])
plt.imshow(image.array_to_img(x_original_test[top10[7],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[7]])
print("Prediction")
display(preds[top10[7]][0])
plt.imshow(image.array_to_img(x_original_test[top10[8],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[8]])
print("Prediction")
display(preds[top10[8]][0])
plt.imshow(image.array_to_img(x_original_test[top10[9],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[9]])
print("Prediction")
display(preds[top10[9]][0])<jupyter_output><empty_output><jupyter_text>Show the 5 models that the net had the closest prediction on<jupyter_code>plt.imshow(image.array_to_img(x_original_test[bottom5[0],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[0]])
print("Prediction")
display(preds[bottom5[0]][0])
plt.imshow(image.array_to_img(x_original_test[bottom5[1],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[1]])
print("Prediction")
display(preds[bottom5[1]][0])
plt.imshow(image.array_to_img(x_original_test[bottom5[2],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[2]])
print("Prediction")
display(preds[bottom5[2]][0])
plt.imshow(image.array_to_img(x_original_test[bottom5[3],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[3]])
print("Prediction")
display(preds[bottom5[3]][0])
plt.imshow(image.array_to_img(x_original_test[bottom5[4],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[4]])
print("Prediction")
display(preds[bottom5[4]][0])<jupyter_output><empty_output><jupyter_text>Show model with highest predicted score<jupyter_code>maxPred = np.amax(preds, axis=0)
maxPredIndex = np.where(preds == maxPred)
display(maxPred[0])
display(maxPredIndex[0][0])
plt.imshow(image.array_to_img(x_original_test[maxPredIndex[0][0],:,:,:]), cmap='Greys_r') 
plt.savefig("SinglePredictedBest.png")
plt.show()

print("Human Score")
display(y_test[maxPredIndex[0][0]])
print("Prediction")
display(preds[maxPredIndex[0][0]][0])
weights = model.get_weights()[0]
display(weights.shape)
l1 = weights[:,0]
display(l1.shape)<jupyter_output><empty_output><jupyter_text>Show weights and save image<jupyter_code>view_weights(model, saveLoc = "singleWeights.png")<jupyter_output><empty_output><jupyter_text>Save model<jupyter_code>model.save("atm4wCurSingleModel")<jupyter_output><empty_output><jupyter_text>Convolution Net  Necessary imports<jupyter_code>import keras
from keras import backend as K
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import display
from keras.utils.vis_utils import plot_model
from keras.preprocessing import image
from keras.applications.xception import preprocess_input, decode_predictions<jupyter_output>Using TensorFlow backend.<jupyter_text>Grab images<jupyter_code>numImages = 600
X=np.concatenate([grab_image_full('/home/atm4w/Project/Data/miscImgs/',i, numImages) for i in range(numImages)]) 
X /= 255.0

X.shape<jupyter_output><empty_output><jupyter_text>Check an image to make sure it was read in right<jupyter_code>plt.imshow(image.array_to_img(X[45,:,:,:]), cmap='Greys_r')
plt.show()<jupyter_output><empty_output><jupyter_text>Load in model scores<jupyter_code>Y = np.loadtxt('/home/atm4w/Project/Data/miscImgs/scores/humanScores.txt')
Y=Y[0:600]
display(Y[0:10])
display(Y.shape)<jupyter_output><empty_output><jupyter_text>Shuffle model images and scores<jupyter_code>p = np.random.permutation(len(X))
Xshuffled = X[p]
Yshuffled = Y[p]

display(Xshuffled.shape)
display(Yshuffled.shape)<jupyter_output><empty_output><jupyter_text>Show image and score to verify that they were shuffled with link between model and corresponding score intact<jupyter_code>plt.imshow(image.array_to_img(Xshuffled[0,:,:,:]), cmap='Greys_r')
plt.show()
display(Yshuffled[0])<jupyter_output><empty_output><jupyter_text>Split into training and test data (85% for training and validation)<jupyter_code>x_train = Xshuffled[0:(round(numImages*.85)),:,:]
y_train = Yshuffled[0:(round(numImages*.85))]
x_test = Xshuffled[(round(numImages*.85)): , : , :]
y_test = Yshuffled[(round(numImages*.85)):]

display(x_train.shape)
display(y_train.shape)
display(x_test.shape)
display(y_test.shape)<jupyter_output><empty_output><jupyter_text>Build net and generate image of architecture<jupyter_code>model = keras.Sequential()
model.add(keras.layers.Conv2D(16, kernel_size=(12, 12),
                activation='relu',
                input_shape=[x_test.shape[1],
                x_test.shape[2],
                x_test.shape[3]]))
model.add(keras.layers.Conv2D(32, kernel_size=(8, 8), activation='relu'))
model.add(keras.layers.MaxPooling2D(pool_size=(2, 2)))
model.add(keras.layers.Dropout(.5))

model.add(keras.layers.Flatten())
model.add(keras.layers.Dense(32, activation='relu'))
model.add(keras.layers.Dropout(0.5))
model.add(keras.layers.Dense(1, activation='sigmoid'))


model.compile(loss=keras.losses.mean_squared_error, optimizer=keras.optimizers.Adam(learning_rate=0.0001), metrics=['mse'])
model.summary()
plot_model(model,to_file='convNet.png',show_shapes=True,expand_nested=True)<jupyter_output><empty_output><jupyter_text>Train it<jupyter_code>batch_size = 4
epochs = 120
history = model.fit(x_train, y_train,
    batch_size=batch_size,
    epochs=epochs,
    verbose=1,
    validation_split = 0.3)<jupyter_output>Train on 357 samples, validate on 153 samples
Epoch 1/120
357/357 [==============================] - 15s 42ms/step - loss: 0.0575 - mse: 0.0575 - val_loss: 0.0556 - val_mse: 0.0556
Epoch 2/120
357/357 [==============================] - 14s 40ms/step - loss: 0.0502 - mse: 0.0502 - val_loss: 0.0577 - val_mse: 0.0577
Epoch 3/120
357/357 [==============================] - 14s 40ms/step - loss: 0.0482 - mse: 0.0482 - val_loss: 0.0555 - val_mse: 0.0555
Epoch 4/120
357/357 [==============================] - 14s 40ms/step - loss: 0.0496 - mse: 0.0496 - val_loss: 0.0586 - val_mse: 0.0586
Epoch 5/120
357/357 [==============================] - 15s 41ms/step - loss: 0.0491 - mse: 0.0491 - val_loss: 0.0571 - val_mse: 0.0571
Epoch 6/120
357/357 [==============================] - 15s 41ms/step - loss: 0.0482 - mse: 0.0482 - val_loss: 0.0557 - val_mse: 0.0557
Epoch 7/120
357/357 [==============================] - 14s 41ms/step - loss: 0.0475 - mse: 0.0475 - val_loss: 0.0556 - val_mse: 0.0556
Epoch 8/1[...]<jupyter_text>Generate loss (MSE) plot<jupyter_code>plt.figure()
plt.subplot(212)
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('convolution model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['training', 'validation'], loc='upper left')
plt.tight_layout()
plt.savefig("ConvModelLoss.png")
plt.show()<jupyter_output><empty_output><jupyter_text>Test on remaining 90 images and calculate mean difference between predicted and actual scores<jupyter_code>preds = model.predict(x_test)
diff = preds.flatten() - (y_test)
print("Mean difference")
print("---------------")
display(np.mean(np.abs(diff)))<jupyter_output>Mean difference
---------------<jupyter_text>Save model<jupyter_code>model.save("atm4wCurModel")<jupyter_output><empty_output><jupyter_text>Various data plots<jupyter_code>shuffledInd = np.linspace(0,89,num = 90)

plt.figure()
plt.scatter(shuffledInd, y_test)
plt.scatter(shuffledInd, preds)
plt.title("Predictions/Actual Comparison")
plt.ylabel("score")
plt.xlabel("image num")
plt.legend(['actual', 'prediction'], loc='upper left')
plt.figure(figsize=(200,20))
plt.show()
plt.figure()
plt.scatter(y_test, preds)
plt.title("Predicted vs Actual value")
plt.ylabel("predicted value")
plt.xlabel("actual value")
plt.savefig("ConvPredictedVAct.png")
plt.axis('square')
plt.show()
plt.figure()
plt.scatter(y_test, diff)
plt.title("Difference vs Actual value")
plt.ylabel("Difference")
plt.xlabel("actual value")
plt.axis('square')
plt.savefig("ConvDiffVAct.png")
plt.show()<jupyter_output><empty_output><jupyter_text>Find the 10 worst and 5 best predictions<jupyter_code>absDiff = np.abs(diff)

top10 = np.argpartition(absDiff, -10)[-10:]
bottom5= np.argpartition(absDiff, 5)[:5]
display(top10)
display(bottom5)<jupyter_output><empty_output><jupyter_text>Show the 10 worst predictions<jupyter_code>for i in range (10):
    print("Human Score")
    display(y_test[top10[i]])
    print("Prediction")
    display(preds[top10[i]][0])
    print("---------------")<jupyter_output><empty_output><jupyter_text>Show the 10 models that had the largest difference between predicted and human score<jupyter_code>plt.imshow(image.array_to_img(x_test[top10[0],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[0]])
print("Prediction")
display(preds[top10[0]][0])
plt.imshow(image.array_to_img(x_test[top10[1],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[1]])
print("Prediction")
display(preds[top10[1]][0])
plt.imshow(image.array_to_img(x_test[top10[2],:,:,:]), cmap='Greys_r') 
plt.savefig("ConvHumanNoiseExample2.png")
plt.show()

print("Human Score")
display(y_test[top10[2]])
print("Prediction")
display(preds[top10[2]][0])
plt.imshow(image.array_to_img(x_test[top10[3],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[3]])
print("Prediction")
display(preds[top10[3]][0])
plt.imshow(image.array_to_img(x_test[top10[4],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[4]])
print("Prediction")
display(preds[top10[4]][0])
plt.imshow(image.array_to_img(x_test[top10[5],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[5]])
print("Prediction")
display(preds[top10[5]][0])
plt.imshow(image.array_to_img(x_test[top10[6],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[6]])
print("Prediction")
display(preds[top10[6]][0])
plt.imshow(image.array_to_img(x_test[top10[7],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[7]])
print("Prediction")
display(preds[top10[7]][0])
plt.imshow(image.array_to_img(x_test[top10[8],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[top10[8]])
print("Prediction")
display(preds[top10[8]][0])
plt.imshow(image.array_to_img(x_test[top10[9],:,:,:]), cmap='Greys_r') 
plt.savefig("ConvHumanNoiseExample.png")
plt.show()

print("Human Score")
display(y_test[top10[9]])
print("Prediction")
display(preds[top10[9]][0])<jupyter_output><empty_output><jupyter_text>Show the 5 models that the net had the closest prediction on<jupyter_code>plt.imshow(image.array_to_img(x_test[bottom5[0],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[0]])
print("Prediction")
display(preds[bottom5[0]][0])
plt.imshow(image.array_to_img(x_test[bottom5[1],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[1]])
print("Prediction")
display(preds[bottom5[1]][0])
plt.imshow(image.array_to_img(x_test[bottom5[2],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[2]])
print("Prediction")
display(preds[bottom5[2]][0])
plt.imshow(image.array_to_img(x_test[bottom5[3],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[3]])
print("Prediction")
display(preds[bottom5[3]][0])
plt.imshow(image.array_to_img(x_test[bottom5[4],:,:,:]), cmap='Greys_r') 
plt.show()

print("Human Score")
display(y_test[bottom5[4]])
print("Prediction")
display(preds[bottom5[4]][0])
maxPred = np.amax(preds, axis=0)
maxPredIndex = np.where(preds == maxPred)
display(maxPred[0])
display(maxPredIndex[0][0])<jupyter_output><empty_output><jupyter_text>Show the model that the net gave the highest score<jupyter_code>plt.imshow(image.array_to_img(x_test[maxPredIndex[0][0],:,:,:]), cmap='Greys_r') 
plt.savefig("ConvPredictedBest.png")
plt.show()

print("Human Score")
display(y_test[maxPredIndex[0][0]])
print("Prediction")
display(preds[maxPredIndex[0][0]][0])
weights = model.get_weights()
len(weights)
# What's the shape of the tensor
# for the connection weights at
# the -first- Conv2D layer?
weights[0].shape
fig,axes = plt.subplots(4,4)
fig.set_figwidth(12)
fig.set_figheight(12)
for x in range(4):
    for y in range(4):
        data = weights[0][:,:,:,(x*4)+y].reshape(12,12)
        
        axes[x,y].imshow(data)
plt.savefig("convWeight1.png")
plt.show()
weights[2].shape
fig,axes = plt.subplots(4,4)
fig.set_figwidth(12)
fig.set_figheight(12)
for x in range(4):
    for y in range(4):
        data = weights[2][:,:,(x*4)+y,0].reshape(8,8)
        
        axes[x,y].imshow(data)
plt.savefig("convWeight2.png")
plt.show()
inp = model.input
outputs = [layer.output for layer in model.layers]
functor = K.function([inp,K.learning_phase()], outputs)
layer_outputs = functor([x_test[10:11,:,:,:],1])
len(layer_outputs)
layer_outputs[0].shape
fig,axes = plt.subplots(4,4)
fig.set_figwidth(12)
fig.set_figheight(12)
for x in range(4):
    for y in range(4):
        axes[x,y].imshow(layer_outputs[0][0,:,:,(x*4)+y])
plt.savefig("layer1activations")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18733557107865373, 'fraction_numerical': 0.04145876803048172, 'mean_word_length': 7.269692423105776, 'pattern_counts': {'":': 0, '<': 152, '<?xml version=': 0, '>': 150, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '37', 'dir': 'jupyter-structured-clean-dedup', 'id': '85621', 'license': 'MIT', 'n_tokens_mistral': 9171, 'n_tokens_neox': 8489, 'n_words': 1284, 'path': 'ProjectCombined.ipynb', 'repo_name': 'CSCI4850/S20-team2-project', 'size': '22046'}