scikit learn

This commit is contained in:
rasbt 2014-06-29 22:21:05 -04:00
parent e5c221a3bf
commit d0ded09a55
3 changed files with 103 additions and 17 deletions

View File

@ -149,4 +149,6 @@ GitHub repository [One-Python-benchmark-per-day](https://github.com/rasbt/One-Py
- [Cython](http://cython.org) - C-extensions for Python, an optimizing static compiler to combine Python and C code
- [Numba](http://numba.pydata.org) - an just-in-time specializing compiler which compiles annotated Python and NumPy code to LLVM (through decorators)
- [Numba](http://numba.pydata.org) - an just-in-time specializing compiler which compiles annotated Python and NumPy code to LLVM (through decorators)
- [scikit-learn](http://scikit-learn.org/stable/) - a powerful machine learning library for Python and tools for efficient data mining and analysis

View File

@ -299,7 +299,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
"%debug \n",
"def some_func():\n",
" var = 'hello world'\n",
" for i in range(5):\n",
@ -309,6 +308,18 @@
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%debug\n",
"some_func()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
@ -320,21 +331,6 @@
"\u001b[0m\u001b[0;32m 6 \u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;34m'finished'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"ipdb> var\n"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"'hello world'\n"
]
}
]
},
@ -858,6 +854,91 @@
],
"prompt_number": 55
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def hello_world():\n",
" \"\"\"This is a hello world example function.\"\"\"\n",
" print('Hello, World!')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%pdoc hello_world"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%pdef hello_world"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" \u001b[0mhello_world\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
" "
]
}
],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%psource math.mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Object `math.mean()` not found.\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import sqrt"
],
"language": "python",
"metadata": {},
"outputs": [
{
"ename": "ImportError",
"evalue": "cannot import name 'mean'",
"output_type": "pyerr",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-16-fdd1a06c836a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmath\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmean\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mImportError\u001b[0m: cannot import name 'mean'"
]
}
],
"prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,

3
tutorials/hello_world.py Normal file
View File

@ -0,0 +1,3 @@
def hello_world():
"""This is a hello world example function."""
print('Hello, World!')