<p><em>edit 03/30/2020: adding a link to the the <a href="https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/scikit_learn_randomforest/Sklearn_on_SageMaker_end2end.ipynb" rel="noreferrer">SageMaker Sklearn random forest demo</a></em></p>

<p><br/></p>

<p>in SageMaker you have 3 options to write scientific code:</p>

<ul>
<li><strong>Built-in algorithms</strong></li>
<li><strong>Open-source pre-written containers</strong> (available
for sklearn, tensorflow, pytorch, mxnet, chainer. Keras can be
written in the tensorflow and mxnet containers)</li>
<li><strong>Bring your own container</strong> (for R for example)</li>
</ul>

<p><strong>At the time of writing this post there is no random forest classifier nor regressor in the built-in library</strong>. There is an algorithm called <a href="https://aws.amazon.com/blogs/machine-learning/use-the-built-in-amazon-sagemaker-random-cut-forest-algorithm-for-anomaly-detection/" rel="noreferrer">Random Cut Forest</a> in the built-in library but it is an unsupervised algorithm for anomaly detection, a different use-case than the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html" rel="noreferrer">scikit-learn random forest</a> used in a supervised fashion (also <a href="https://stackoverflow.com/questions/56728230/aws-sagemaker-randomcutforest-rcf-vs-scikit-lean-randomforest-rf?noredirect=1&amp;lq=1">answered in StackOverflow here</a>). But it is easy to use the open-source pre-written scikit-learn container to implement your own. There is a <a href="https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/scikit_learn_randomforest/Sklearn_on_SageMaker_end2end.ipynb" rel="noreferrer">demo showing how to use Sklearn's random forest in SageMaker</a>, with training orchestration bother from the high-level SDK and <code>boto3</code>. You can also use this other <a href="https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/scikit_learn_iris/Scikit-learn%20Estimator%20Example%20With%20Batch%20Transform.ipynb" rel="noreferrer">public sklearn-on-sagemaker demo</a> and change the model. A benefit of the pre-written containers over the "Bring your own" option is that the dockerfile is already written, and web serving stack too.</p>

<p>Regarding your surprise that Random Forest is not featured in the built-in algos, the library and its 18 algos already cover a rich set of use-cases. For example for supervised learning over structured data (the usual use-case for the random forest), if you want to stick to the built-ins, depending on your priorities (accuracy, inference latency, training scale, costs...) you can use SageMaker XGBoost (XGBoost has been winning tons of datamining competitions - every winning team in the top10 of the KDDcup 2015 used XGBoost <a href="https://arxiv.org/pdf/1603.02754.pdf" rel="noreferrer">according to the XGBoost paper</a> - and scales well) and linear learner, which is extremely fast at inference and can be trained at scale, in mini-batch fashion over GPU(s). <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/fact-machines-howitworks.html" rel="noreferrer">Factorization Machines</a> (linear + 2nd degree interaction with weights being column embedding dot-products) and <a href="https://aws.amazon.com/blogs/machine-learning/amazon-sagemaker-supports-knn-classification-and-regression/" rel="noreferrer">SageMaker kNN</a> are other options. Also, things are not frozen in stone, and the list of built-in algorithms is being improved fast.</p>
Randomforest in amazon aws sagemaker?
<p>I am looking to recreate a randomforest model built locally, and deploy it through sagemaker. The model is very basic, but for comparison I would like to use the same in sagemaker. I don't see randomforest among sagemaker's built in algorithms (which seems weird) - is my only option to go the route of <a href="https://aws.amazon.com/blogs/machine-learning/train-and-host-scikit-learn-models-in-amazon-sagemaker-by-building-a-scikit-docker-container/" rel="nofollow noreferrer">deploying my own custom model</a>? Still learning about containers, and it seems like a lot of work for something that is just a simple randomforestclassifier() call locally. I just want to baseline against the out of the box randomforest model, and show that it works the same when deployed through AWS sagemaker.</p>