Skip to content

Commit

Permalink
now compares linear vs svr vs rf
Browse files Browse the repository at this point in the history
  • Loading branch information
oddskool committed Nov 8, 2013
1 parent 4ae976b commit 87a01e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions doc/modules/computational_performance.rst
Expand Up @@ -130,10 +130,12 @@ values (and sparsity) will change depending on how the model was trained but
the type of operation is the same (a dot product).

For the SVM family of algorithms the latency is tied to the number of support
vectors (the fewer the faster).
vectors (the fewer the faster). Latency and throughput should (asymptotically)
grow linearly with the number of support vectors in a SVC or SVR model.

For tree or forest algorithms (e.g. RandomForest, GBT, ExternalTrees etc) the
number of trees and their depth play the most important role.
number of trees and their depth play the most important role. Latency and
throughput should scale linearly with the number of trees.

In any case be warned that playing with model complexity can hurt accuracy as
mentionned above. For instance a non-linearly separable problem can be dealt
Expand Down
6 changes: 4 additions & 2 deletions examples/applications/plot_prediction_latency.py
Expand Up @@ -29,6 +29,7 @@
from sklearn.ensemble.forest import RandomForestRegressor
from sklearn.linear_model.coordinate_descent import ElasticNet
from sklearn.linear_model.ridge import Ridge
from sklearn.svm.classes import SVR


def _not_in_sphinx():
Expand Down Expand Up @@ -266,8 +267,9 @@ def plot_benchmark_throughput(throughputs):
n_train = int(1e3)
n_test = int(1e2)
n_features = int(1e2)
estimators = {'elasticnet': ElasticNet(), 'ridge': Ridge(),
'randomforest': RandomForestRegressor()}
estimators = {'Linear Model': ElasticNet(),
'SVR': SVR(kernel='rbf'),
'RandomForest': RandomForestRegressor()}
benchmark(estimators, n_train, n_test, n_features)

# benchmark n_features influence on prediction speed
Expand Down

0 comments on commit 87a01e1

Please sign in to comment.