{ "cells": [ { "cell_type": "markdown", "id": "de6912c1-1f92-4b34-85a2-fcbf4cfa4ec8", "metadata": {}, "source": [ "# Scikit Learn\n", "\n", "## Installation\n", "\n", "https://scikit-learn.org/stable/install.html#installation-instructions\n", "\n", "## Overview \n", "\n", "Scikit Learn has modules for classification, regression, clustering, dimensionality reduction, model selection, and preprocessing. We have already seen preprocessing and dimensionality reduction examples when we looked at [PCA](../unit2/pca).\n", "\n", "Practice (follwoing, https://scikit-learn.org/stable/getting_started.html)" ] }, { "cell_type": "code", "execution_count": 1, "id": "300e29ed-a200-4967-963b-a4122219ba8d", "metadata": {}, "outputs": [], "source": [ "from sklearn.ensemble import RandomForestClassifier" ] }, { "cell_type": "code", "execution_count": 2, "id": "53584565-fbd6-4d6f-bae2-d204ca89afe2", "metadata": {}, "outputs": [], "source": [ "clf = RandomForestClassifier(random_state=0)\n", "X = [[ 1, 2, 3], # 2 samples, 3 features\n", " [11, 12, 13]]\n", "y = [0, 1] # classes of each sample" ] }, { "cell_type": "code", "execution_count": 3, "id": "049fe409-3f15-4adc-8b3e-6da4ebdc9aae", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
RandomForestClassifier(random_state=0)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
RandomForestClassifier(random_state=0)