Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. from mpl_toolkits.mplot3d import Axes3D
  4.  
  5. from sklearn import datasets, linear_model
  6.  
  7. diabetes = datasets.load_diabetes()
  8. X_train = diabetes.data[:-20, (0,1)]
  9.  
  10. y_train = diabetes.target[:-20]
  11.  
  12. ransac = linear_model.RANSACRegressor(
  13. linear_model.LinearRegression()
  14. )
  15.  
  16. ransac.fit(X_train, y_train)
  17.  
  18. fig = plt.figure()
  19. plt.clf()
  20.  
  21. ax = Axes3D(fig)
  22.  
  23. ax.plot_surface([-5,5],[-5,5], ransac.predict(X_train))
  24.  
  25. ValueError: shape mismatch: objects cannot be broadcast to a single shape
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement