Search code examples
pythonscikit-learnsvmlibsvmmulticlass-classification

Training SVC from scikit-learn shows that using -h 0 may be faster?


I am training an SVC model on a large dataset, and since I have set verbose=True, it is showing a Warning: using -h 0 may be faster.

I have two questions here:

  • what is this warning and how we can set any option of libsvm as it has mentioned in the warning?
  • Does the size of cache in sklearn.svm.SVC parameter setting can affect the speed of training? I have set it as cache_size=2000 .

Your expert view is appreciated


Solution

  • -h parameter controls shrinking: whether to use the shrinking heuristics, 0 or 1 (default 1)

    You can set it in the SVC constructor using shrinking argument. Shrinking is a heuristics to speed up the optimization problem.

    Check Original Paper and Similar Quesiton on shrinking

    Caching is technique for reducing the computational time of the decomposition method which is part of the training. This size is controlled via cache_size parameter.

    I higlhy recommend reading the original libsm paper, especially section 5.