How to solve the error using RANSAC: "RANSAC could not find a valid consensus set. All"

I am using the versions below:

System:

    python: 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
executable: C:\ProgramData\Anaconda3\pythonw.exe
   machine: Windows-10-10.0.17763-SP0

BLAS:

    macros: 
  lib_dirs: 
cblas_libs: cblas

Python deps:

       pip: 18.1
setuptools: 40.6.3
   sklearn: 0.20.1
     numpy: 1.15.4
     scipy: 1.1.0
    Cython: 0.29.2
    pandas: 0.23.4

When I use the RANSAC method I am getting the following error:

ValueError: RANSAC could not find a valid consensus set. All max_trials iterations were skipped because each randomly chosen sub-sample failed the passing criteria. See estimator attributes for diagnostics (n_skips*).

Can someone help me?

Upvotes: 1

Views: 3291

Answers (2)

Matt Lafferty
Matt Lafferty

Reputation: 21

The default residual_threshold RANSAC uses to determine inliers is the median absolute deviation (MAD) of the target variable (RANSAC docs). What may have happened is that the MAD of your target variable is very small, perhaps even zero. In such a case, the algorithm would not be able to find any inliers.

You could try increasing the residual_threshold and see if that helps.

Upvotes: 2

Muriel
Muriel

Reputation: 591

You might have specified boundaries which the model is not able to satisfy. You need to loosen up your pass criteria. This article might help you to figure out better what's going on:

Upvotes: 0

Related Questions