from neuralpredictors.data.datasets import StaticImageSet, FileTreeDataset
import MEI
import matplotlib as mpl
import pandas as pd
import pickle
```
%%%% Output: error
Traceback (most recent call last):
File "C:\Users\Asus\miniconda3\envs\inception_loop\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-1e04c2cfd7de>", line 7, in <module>
import MEI
File "C:\Users\Asus\Desktop\Intership EMBL\Python docs\Inception_loop\Ines_code\inception_loop_asari_lab\MEI.py", line 468
self.MEIParameter =
^
SyntaxError: invalid syntax
%% Cell type:markdown id: tags:
# Build the dataloaders
%% Cell type:markdown id: tags:
The dataloaders object is a dictionary of 3 dictionaries: train, validation and test. Each of them contains the respective data from all datasets combined that were specified in paths. Here we only provide one dataset. While the responses are normalized, we exclude the input images from normalization. The following config was used in the paper (all arguments not in the config have the default value of the function).
%% Cell type:code id: tags:
``` python
#Use dataloaders with generated RGC data
from lurz2020.datasets.mouse_loaders import static_loaders
dat = FileTreeDataset('D://inception_loop/RGC_sim_data/data/static15032021_oval_RF', "images", "responses")
```
%% Cell type:markdown id: tags:
### Look at the data
%% Cell type:code id: tags:
``` python
tier = 'train'
dataset_name = '15032021_oval_RF'
images, responses = [], []
for x, y in dataloaders_RGCs[tier][dataset_name]:
images.append(x.squeeze().cpu().data.numpy())
responses.append(y.squeeze().cpu().data.numpy())
images = np.vstack(images)
responses = np.vstack(responses)
print('The \"{}\" set of dataset \"{}\" contains the responses of {} RGC neurons to {} images'.format(tier, dataset_name, responses.shape[1], responses.shape[0]))
```
%%%% Output: stream
The "train" set of dataset "15032021_oval_RF" contains the responses of 2304 RGC neurons to 4472 images
%% Cell type:code id: tags:
``` python
# show some example images and the neural responses
#Run optimization to maximize the target (corresponding to the correlation between the model predictions and the real responses for the validation set)
#init_points: number of random exploration points
#n_iter: number of exploitation points
optimizer_MEIS_.maximize(init_points=5, n_iter=5)
```
%%%% Output: stream
Working on neuron_id=1561
Working with images with mu=111.30036163330078, sigma=60.936492919921875