osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ERROR in loading data


On 04/02/2020 14:49, laiba.zubair96 at gmail.com wrote:
> #load the training and testing data, then scale it into the
> 	# range [0, 1]
> 	print("[INFO] loading  ADNI data...")
> 	((trainX, trainY), (testX, testY)) = '/content/gdrive/My Drive/3_Classes/'.loads_data()
> 	trainX = trainX.astype("float") / 255.0
> 	testX = testX.astype("float") / 255.0
>   
> 	# initialize the label names for the  ADNI dataset
> 	labelNames = ["outAD", "outCN", "outMCI"]
> When i try to run this code I got the following error.
> 
> [INFO] loading  ADNI data...
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
> <ipython-input-8-fb9724017cc0> in <module>()
>        1 print("[INFO] loading  ADNI data...")
> ----> 2 ((trainX, trainY), (testX, testY)) = '/content/gdrive/My Drive/3_Classes/'.loads_data()
>        3 trainX = trainX.astype("float") / 255.0
>        4 testX = testX.astype("float") / 255.0
>        5

So that error is saying that something on line 2 is trying to use an 
attribute incorrectly, probably one that doesn't exist (there really 
should be more explanatory information in the error, by the way).  The 
only thing on line 2 that tries to access an attribute is the string 
'/content/gdrive/My Drive/3_Classes/', which tries to run the method 
loads_data().  Fair enough.  A quick test on the interactive command 
line or a look in the documents will tell you that strings indeed do not 
have a loads_data() method.

I don't know what library you are intending to use, but you need to open 
your file with that first.

-- 
Rhodri James *-* Kynesim Ltd