alok-ai-lab / pyDeepInsight

A python implementation of the DeepInsight methodology.
GNU General Public License v3.0
157 stars 47 forks source link

How to know number of features and set up the size of image matrix? #20

Closed utkarsh0902311047 closed 2 years ago

utkarsh0902311047 commented 2 years ago

Hi, Can you help me how to know how many features are going to be used after imagetransformer and which are those features? Also how can i set up the size of the image, lets say I have 121 features and I need 11x11 image matrix. Actually I am looking for a method which can convert every row in my data frame into a nxn matrix image.

Thank you Utkarsh

kaboroevich commented 2 years ago

All features will be still be present and assigned to a pixel after image transformation. After training the image transformer, you can extract the pixel coordinates of the features using .coords() as a two column dataframe. The index of that dataframe will match the order of the input data.

However, I do not think DeepInsight is the correct method for you if you want to uniquely assign each feature to a pixel. DeepInsight will result in some overlapping features (features assigned to the same pixel) as well as empty pixels. I think reshaping your matrix rows is what you want. For example, if you have a numpy array of 10 rows and 121 features:

import numpy as np
a = np.random.rand(10, 121)
b = a.reshape(10,11,11)

b will be a numpy array of 10 11x11 matrices.