LL_test = numx.mean(estimator.log_likelihood_v(rbm, logZ, test_data)) print 'reverse AIS \t%0.5f \t%0.5f' % (LL_train, LL_test) # Reorder RBM features by average activity decreasingly rbmReordered = vis.reorder_filter_by_hidden_activation(rbm, train_data) # Display RBM parameters vis.imshow_standard_rbm_parameters(rbmReordered, v1, v2, h1, h2) # Sample some steps and show results samples = vis.generate_samples(rbm, train_data[0:30], 30, 1, v1, v2, False, None) vis.imshow_matrix(samples, 'Samples') # Get the optimal gabor wavelet frequency and angle for the filters opt_frq, opt_ang = vis.filter_frequency_and_angle(rbm.w, num_of_angles=40) # Show some tuning curves num_filters = 20 vis.imshow_filter_tuning_curve(rbm.w[:, 0:num_filters], num_of_ang=40) # Show some optima grating vis.imshow_filter_optimal_gratings(rbm.w[:, 0:num_filters], opt_frq[0:num_filters], opt_ang[0:num_filters]) # Show histograms of frequencies and angles. vis.imshow_filter_frequency_angle_histogram(opt_frq=opt_frq, opt_ang=opt_ang, max_wavelength=14)
vis.imshow_matrix(matrix=images, windowtitle='First 100 image patches whitened') # Show the ICA filters/bases ica_filters = vis.tile_matrix_rows(matrix=ica.projection_matrix, tile_width=width, tile_height=height, num_tiles_x=width, num_tiles_y=height, border_size=1, normalized=True) vis.imshow_matrix(matrix=ica_filters, windowtitle='Filters learned by ICA') # Get the optimal gabor wavelet frequency and angle for the filters opt_frq, opt_ang = vis.filter_frequency_and_angle(ica.projection_matrix, num_of_angles=40) # Show some tuning curves num_filters = 20 vis.imshow_filter_tuning_curve(ica.projection_matrix[:,0:num_filters], num_of_ang=40) # Show some optima grating vis.imshow_filter_optimal_gratings(ica.projection_matrix[:,0:num_filters], opt_frq[0:num_filters], opt_ang[0:num_filters]) # Show histograms of frequencies and angles. vis.imshow_filter_frequency_angle_histogram(opt_frq=opt_frq, opt_ang=opt_ang, max_wavelength=14)