<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Exploring Weights
Here we train the LNN on various task and see how the weights are
Step1:  Let us create an LNN with 2 dimension input.
Step2:  Schooling
Let us send this young classifier to school to be taught functions like and, or and xor
Step3:  Looks like our LNN was a good student scoring perfect F1 score of 1.0 in each task.
Plotting weights
Let us plot the learnt weights. The weights will be of shape (classifiers_count, input_dimension + classifiers_count)
<ASSISTANT_TASK:>
Python Code:
import sys
import os
sys.path.insert(0,'..')
sys.path.insert(0,'../layeredneuralnetwork/')
Explanation: Exploring Weights
Here we train the LNN on various task and see how the weights are
End of explanation
from layered_neural_network import LayeredNeuralNetwork
input_dimension = 2
lnn = LayeredNeuralNetwork(input_dimension=input_dimension)
Explanation: Let us create an LNN with 2 dimension input.
End of explanation
from school.binary import Binary
Binary.teach_and(lnn)
Binary.teach_or(lnn)
Binary.teach_xor(lnn)
Explanation: Schooling
Let us send this young classifier to school to be taught functions like and, or and xor
End of explanation
%pylab inline
weights = lnn.get_weights()
print(weights.shape)
plt.imshow(weights, cmap='gray', interpolation='none')
plt.title('Weights of LNN')
plt.xlabel('Inputs')
plt.ylabel('Classifiers')
Explanation: Looks like our LNN was a good student scoring perfect F1 score of 1.0 in each task.
Plotting weights
Let us plot the learnt weights. The weights will be of shape (classifiers_count, input_dimension + classifiers_count)
End of explanation
<END_TASK>