<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Set the fn variable to the filename of either the training or test dataset
Step1:  After running the cell below, you can move the slider to visualize the various instances of the dataset, change factor slider to increase the sharpness of the image
<ASSISTANT_TASK:>
Python Code:
#training data
#fn = 'data/ocr/optdigits.tra'
#testing data
fn = 'data/ocr/optdigits.tes'
header="x11,x12,x13,x14,x15,x16,x17,x18,x21,x22,x23,x24,x25,x26,x27,x28,x31,x32,x33,x34,x35,x36,x37,x38,x41,x42,x43,x44,x45,x46,x47,x48,x51,x52,x53,x54,x55,x56,x57,x58,x61,x62,x63,x64,x65,x66,x67,x68,x71,x72,x73,x74,x75,x76,x77,x78,x81,x82,x83,x84,x85,x86,x87,x88,digit".split(",")
df = pd.read_csv(fn, header=None)
df.columns = header
df.head()
y = df.digit.copy().values
X = df.drop("digit", axis=1).values
X.shape, y.shape
X = X.reshape((-1, 8,8))
X.shape
Explanation: Set the fn variable to the filename of either the training or test dataset
End of explanation
@interact(X=fixed(X), y=fixed(y), idx=(0,X.shape[0]), factor=(1,50))
def show_item(X, y, idx=0, factor=5):
    x = X[idx]
    print("Instance %s:\t[%s]" % (
            idx+1, ", ".join("'%s'" % str(k) for k in 
                list(x.flatten()) + [y[idx]])))
    x = (((x-16)/16.0)*255).astype("int")
    x = blowUp(x, factor)
    fig, ax = plt.subplots(figsize=(5,5))
    ax.imshow(x, cmap="Greys")
    ax.set_title("Instance=%s, Digit=%s" % (idx+1, y[idx]))
    plt.axis('off')
Explanation: After running the cell below, you can move the slider to visualize the various instances of the dataset, change factor slider to increase the sharpness of the image
End of explanation
<END_TASK>