stevenpawley / Pyspatialml

Machine learning modelling for spatial data
GNU General Public License v3.0
145 stars 29 forks source link

Prediction part in README file fails with: TypeError: read() got multiple values for argument 'masked' #9

Closed sparkvilla closed 5 years ago

sparkvilla commented 5 years ago

Hi there, I am going through your README file testing your examples. When executing this code:

# prediction
result = stack.predict(estimator=lr, dtype='int16', nodata=0)
result_probs = stack.predict_proba(estimator=lr)
plt.imshow(result.read(1, masked=True))
plt.show()

I am getting:

TypeErrorTraceback (most recent call last)
<ipython-input-32-f642cd7e4250> in <module>
  2 result = stack.predict(estimator=lr, dtype='int16', nodata=0)
  3 result_probs = stack.predict_proba(estimator=lr)
----> 4 plt.imshow(result.read(1, masked=True))
   5 plt.show()

TypeError: read() got multiple values for argument 'masked'

I could visualize the result modifying the previous snippet as:

# prediction
result = stack.predict(estimator=lr, dtype='int16', nodata=0)
result_probs = stack.predict_proba(estimator=lr)
mask_result = result.read(masked=True)
plt.imshow(mask_result[0])
plt.show() 
stevenpawley commented 5 years ago

Thanks, that was an error in the example - updated the README