TypeError: 'SArray' object does not support item assignment In [10] not In[9] ?

User 2470 | 10/23/2015, 2:46:33 AM

` In [9]: extracted = pretrainedmodel.extractfeatures(shoesimages_sf) PROGRESS: Images being resized. Out[9]: dtype: array Rows: 30169 [array('d', [0.0, 0.0, 0.0, 0.0, 1.9555416107177734, 0.0, 2.180605173110962, 0.07782214879989624, 0.8234546780586243, 0.0, 0.0, 1.1969618797302246, 0.0, 0.44462066888809204, 0.5932644605636597, 0.0, 3.1007626056671143, 0.0, 0.0, 1.375330924987793, 0.7327097654342651, 0.0, 0.0, 0.0, 0.0, 0.0, 2.2129578590393066, 0.0, 0.0, 0.0, 0.0, 1.2433948516845703, 0.27601343393..... In [22]:

In [10}: extracted['features'] = pretrainedmodel.extractfeatures(shoesimages_sf)

PROGRESS: Images being resized.

TypeError Traceback (most recent call last) <ipython-input-22-92061fd4f91f> in <module>() ----> 1 extracted['features'] = pretrainedmodel.extractfeatures(shoesimages_sf)

TypeError: 'SArray' object does not support item assignment `

Comments

User 1592 | 10/24/2015, 12:08:21 PM

Hi extractfeatures returns an SArray, which our scalable array, i.e. one column in an SFrame. Thus you can not access extracted['features'] as this is an SFrame command accessing the 'features' column. The example you are probably looking at is this: https://dato.com/products/create/docs/generated/graphlab.neuralnetclassifier.NeuralNetClassifier.extract_features.html where data is an SFrame and thus you can access a column inside. If you like to use the column simply use extracted instead.