Sami
Sami

Reputation: 1

Unable to solve AttributeError: 'list' object has no attribute 'shape'

I have exported cn2 model from orange and using it to predict some values, but each time I am getting this same error. For any kind of input whether correct or wrong format I give as input

My Dataset is:- dataset

import pickle
nn=pickle.load(open("model2.pkcls","rb"))
nn.predict([14, 0, 1, 0, 0, 0, 0, 1, 1, 1])

Error is:-

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-201-3389f95fd5db> in <module>
      2 #data345=np.array(data222)
      3 #data345[0]
----> 4 nn.predict([14, 0, 1, 0, 0, 0, 0, 1, 1, 1])

~/.local/lib/python3.6/site-packages/Orange/widgets/model/owrules.py in predict(self, X)
     31         if (self.rule_ordering == "ordered" and
     32                 self.covering_algorithm == "exclusive"):
---> 33             return self.ordered_predict(X)
     34 
     35         if (self.rule_ordering == "unordered" or

~/.local/lib/python3.6/site-packages/Orange/classification/rules.py in ordered_predict(self, X)
   1182         num_classes = len(self.domain.class_var.values)
   1183         probabilities = np.array([np.zeros(num_classes, dtype=float)
-> 1184                                   for _ in range(X.shape[0])])
   1185 
   1186         status = np.ones(X.shape[0], dtype=bool)

AttributeError: 'list' object has no attribute 'shape'

Upvotes: 0

Views: 276

Answers (1)

Nicolas Gervais
Nicolas Gervais

Reputation: 36604

convert your input to a numpy.array().

Upvotes: 2

Related Questions