<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Basic principles of machine learning"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here is where we start diving into the field of machine learning.\n",
    "\n",
    "By the end of this section you will\n",
    "\n",
    "- Know the basic categories of supervised learning, including classification and regression problems.\n",
    "- Know the basic categories of unsupervised learning, including dimensionality reduction and clustering.\n",
    "- Know the basic syntax of the Scikit-learn **estimator** interface.\n",
    "- Know how features are extracted from real-world data.\n",
    "\n",
    "In addition, we will go over several basic tools within scikit-learn which can be used to accomplish the above tasks."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Problem setting"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### A simple definition of machine learning"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Machine Learning (ML) is about building programs with **tunable parameters** (typically an\n",
    "array of floating point values) that are adjusted automatically so as to improve\n",
    "their behavior by **adapting to previously seen data.**\n",
    "\n",
    "In most ML applications, the data is in a 2D array of shape ``[n_samples x n_features]``,\n",
    "where the number of features is the same for each object, and each feature column refers\n",
    "to a related piece of information about each sample.\n",
    "\n",
    "Machine learning can be broken into two broad regimes:\n",
    "*supervised learning* and *unsupervised learning*.\n",
    "We’ll introduce these concepts here, and discuss them in more detail below."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Introducing the scikit-learn estimator object"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Every algorithm is exposed in scikit-learn via an ''Estimator'' object. For instance a linear regression is:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Estimator parameters**: All the parameters of an estimator can be set when it is instantiated:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "model = LinearRegression(normalize=True)\n",
    "print model.normalize"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "print model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [<commit_msg>don't spent so much time on the "normalize" parameter of Linear Regression<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Basic principles of machine learning"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here is where we start diving into the field of machine learning.\n",
    "\n",
    "By the end of this section you will\n",
    "\n",
    "- Know the basic categories of supervised learning, including classification and regression problems.\n",
    "- Know the basic categories of unsupervised learning, including dimensionality reduction and clustering.\n",
    "- Know the basic syntax of the Scikit-learn **estimator** interface.\n",
    "- Know how features are extracted from real-world data.\n",
    "\n",
    "In addition, we will go over several basic tools within scikit-learn which can be used to accomplish the above tasks."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Problem setting"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### A simple definition of machine learning"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Machine Learning (ML) is about building programs with **tunable parameters** (typically an\n",
    "array of floating point values) that are adjusted automatically so as to improve\n",
    "their behavior by **adapting to previously seen data.**\n",
    "\n",
    "In most ML applications, the data is in a 2D array of shape ``[n_samples x n_features]``,\n",
    "where the number of features is the same for each object, and each feature column refers\n",
    "to a related piece of information about each sample.\n",
    "\n",
    "Machine learning can be broken into two broad regimes:\n",
    "*supervised learning* and *unsupervised learning*.\n",
    "We’ll introduce these concepts here, and discuss them in more detail below."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Introducing the scikit-learn estimator object"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Every algorithm is exposed in scikit-learn via an ''Estimator'' object. For instance a linear regression is:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "print model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
{'fraction_non_alphanumeric': 0.15180416467970115, 'fraction_numerical': 0.00031791448100460976, 'mean_word_length': 2.9325, 'pattern_counts': {'":': 95, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5709328', 'n_tokens_mistral': 2006, 'n_tokens_neox': 1944, 'n_words': 637}