0

Sklearn says about decision trees:

The cost of using the tree (i.e., predicting data) is logarithmic 
in the number of data points used to train the tree.

I know a logarithm as the inverse to an exponential function. What does it mean in this context? I have the feeling that it references an exponential function such as 2**n possible nodes or such.

However, my understanding it quite vague and I want to get a better picture.

shredding
  • 5,374
  • 3
  • 46
  • 77

2 Answers2

2

See What is a plain English explanation of "Big O" notation? or many other similar explanations first for what O(f(N)) means. In this case you have O(log N): when the number of data points doubles, the cost increases by a constant.

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
0

Very briefly:

O(1) < O(log N) < O(N) 

Logarithmic is cheaper than a linear (i.e. O(N)) cost.

Wikipedia has a nice table that orders the different big-O costs.

Phylyp
  • 1,659
  • 13
  • 16
  • 1
    using `<` in this context may be misleading. It may well be that for a certain N the O(1) algorithm is much worse than the O(N) one. The inequality becomes only true for large enough N. In fact, many theoretically good algorithms are practically irrelevant because the necessary problem sizes never occur in practice. – Henry Sep 30 '17 at 11:21