Skip to content

Instantly share code, notes, and snippets.

@rhattersley
Last active August 29, 2015 14:22
Show Gist options
  • Save rhattersley/8bd75e05c61b25d6170f to your computer and use it in GitHub Desktop.
Save rhattersley/8bd75e05c61b25d6170f to your computer and use it in GitHub Desktop.
Simple biggus use case
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:8a5fdb89f201aebb8221ca45e1e806f1aa53854a118ab2982b1c7fd358695055"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import biggus\n",
"import numpy as np\n",
"\n",
"measured = biggus.NumpyArrayAdapter(np.ones((2, 3, 4)) * 2.5)\n",
"predicted = biggus.NumpyArrayAdapter(np.ones((2, 3, 4)))\n",
"\n",
"error = predicted - measured\n",
"mean_error = biggus.mean(error, axis=0)\n",
"std_error = biggus.std(error, axis=0)\n",
"biggus.ndarrays([mean_error, std_error])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"text": [
"[array([[-1.5, -1.5, -1.5, -1.5],\n",
" [-1.5, -1.5, -1.5, -1.5],\n",
" [-1.5, -1.5, -1.5, -1.5]]), array([[ 0., 0., 0., 0.],\n",
" [ 0., 0., 0., 0.],\n",
" [ 0., 0., 0., 0.]])]"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"mean_error._streams_handler_class"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
"biggus._MeanStreamsHandler"
]
}
],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"mean_error.sources"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"text": [
"(<_Elementwise shape=(2, 3, 4) dtype=dtype('float64')>,)"
]
}
],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"mean_error._axis"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"text": [
"0"
]
}
],
"prompt_number": 12
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment