Issue 1:
If I'm running the RANSAC-example code, everything works fine

import numpy as np
from matplotlib import pyplot as plt

from sklearn import linear_model, datasets

n_samples = 5

X, y, coef = datasets.make_regression(n_samples=n_samples, n_features=1,
n_informative=1, noise=10,
coef=True, random_state=0)
# X = array([[ 0.97873798],
# [ 2.2408932 ],
# [ 1.76405235],
# [ 1.86755799],
# [ 0.40015721]])
# y = array([ 37.7695571 , 123.51062836, 67.41989586, 92.53006841, 30.17155299])

model_ransac = linear_model.RANSACRegressor(linear_model.LinearRegression())
model_ransac.fit(X, y)

But as soon as I try model_ransac.fit(X, y) with my own y I'm getting an error

import numpy as np
from matplotlib import pyplot as plt

from sklearn import linear_model, datasets

n_samples = 5

X, _, coef = datasets.make_regression(n_samples=n_samples, n_features=1,
n_informative=1, noise=10,
coef=True, random_state=0)

y = np.array([1., 1., 2., 1., 1.])

# X = array([[ 0.97873798],
# [ 2.2408932 ],
# [ 1.76405235],
# [ 1.86755799],
# [ 0.40015721]])
# y = array([ 1., 1., 2., 1., 1.])
# y.shape = (5,)

model_ransac = linear_model.RANSACRegressor(linear_model.LinearRegression())
model_ransac.fit(X, y)

Error message

model_ransac.fit(X, y)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-14-218aaab43d92> in <module>()
----> 1 model_ransac.fit(X, y)

/home/clemens/.local/lib/python2.7/site-packages/sklearn/linear_model/ransac.pyc in fit(self, X, y)
299 # score of inlier data set
300 score_subset = base_estimator.score(X_inlier_subset,
--> 301 y_inlier_subset)
302
303 # same number of inliers but worse score -> skip current random

/home/clemens/.local/lib/python2.7/site-packages/sklearn/base.pyc in score(self, X, y, sample_weight)
326
327 from .metrics import r2_score
--> 328 return r2_score(y, self.predict(X), sample_weight=sample_weight)
329
330

/home/clemens/.local/lib/python2.7/site-packages/sklearn/linear_model/base.pyc in predict(self, X)
153 Returns predicted values.
154 """
--> 155 return self.decision_function(X)
156
157 _center_data = staticmethod(center_data)

/home/clemens/.local/lib/python2.7/site-packages/sklearn/linear_model/base.pyc in decision_function(self, X)
136 check_is_fitted(self, "coef_")
137
--> 138 X = check_array(X, accept_sparse=['csr', 'csc', 'coo'])
139 return safe_sparse_dot(X, self.coef_.T,
140 dense_output=True) + self.intercept_

/home/clemens/.local/lib/python2.7/site-packages/sklearn/utils/validation.pyc in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features)
358 raise ValueError("Found array with %d sample(s) (shape=%s) while a"
359 " minimum of %d is required."
--> 360 % (n_samples, shape_repr, ensure_min_samples))
361
362 if ensure_min_features > 0 and array.ndim == 2:

ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required.

BR Clemens

Issue 2:
If the "residual_threshold" argument in RANSACRegressor is set to zero, the regression will almost certainly fail. However, figuring out what is going on based on the error messages is not obvious:

ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required.

(I believe that when residual_threshold==0.0, one of the cross-validation classes is empty, and things break.)

Because (I think?) there is no legitimate reason to set residual_threshold==0.0, and to save some future soul the debugging journey I just went through, it might be helpful to throw an exception (or at least a clear warning) if residual_threshold==0.0.