<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#!/usr/bin/env python\n",
    "from effective_quadratures.PolyParams import PolynomialParam\n",
    "from effective_quadratures.PolyParentFile import PolyParent\n",
    "from effective_quadratures.IndexSets import IndexSet\n",
    "import effective_quadratures.MatrixRoutines as matrix\n",
    "import effective_quadratures.ComputeStats as stats\n",
    "from mpl_toolkits.mplot3d import Axes3D\n",
    "import matplotlib.pyplot as plt\n",
    "from matplotlib.pyplot import cm\n",
    "import numpy as np\n",
    "import numpy.ma as maogle\n",
    "import os\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "19.609375 73.2976200582\n",
      "[[ 0.97157707  0.02842293]]\n"
     ]
    }
   ],
   "source": [
    "# Create a \"model\"\n",
    "def fun(x):\n",
    "    return x[0]**5 + x[1]\n",
    "\n",
    "def main():\n",
    "    order = 3\n",
    "    derivative_flag = 0 # derivative flag\n",
    "\n",
    "    # Parameter 1\n",
    "    c1 = PolynomialParam(\"Uniform\", 0.5, 2.0, 0, 0, derivative_flag, order)\n",
    "\n",
    "    # Parameter 2\n",
    "    c2 = PolynomialParam(\"Uniform\", 10.0, 15.0, 0, 0, derivative_flag, order)\n",
    "\n",
    "    # Method for computing polynomial\n",
    "    method = \"tensor grid\"\n",
    "\n",
    "    # Append c1 and c2 to 'model_inputs'\n",
    "    model_inputs = []\n",
    "    model_inputs.append(c1)\n",
    "    model_inputs.append(c2)\n",
    "\n",
    "    # Create a Polynomial object\n",
    "    polyObject = PolyParent(model_inputs, method)\n",
    "\n",
    "    # Compute the points and weights at which I need to evaluate my model\n",
    "    pts, wts, = PolyParent.getPointsAndWeights(polyObject)\n",
    "\n",
    "    # Compute the coefficients of this polynomial expansion\n",
    "    X, I, F = PolyParent.getCoefficients(polyObject, fun)\n",
    "\n",
    "    # Now compute the stats!\n",
    "    mean, variance = stats.compute_mean_variance(X, I)\n",
    "    sobol_indices = stats.compute_first_order_Sobol_indices(X, I)\n",
    "    \n",
    "    print mean, variance\n",
    "    print sobol_indices\n",
    "    \n",
    "main()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
<commit_msg>Update BasicOutline.ipynb<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#!/usr/bin/env python\n",
    "from effective_quadratures.PolyParams import PolynomialParam\n",
    "from effective_quadratures.PolyParentFile import PolyParent\n",
    "import effective_quadratures.ComputeStats as stats\n",
    "import numpy as np\n",
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "19.609375 73.2976200582\n",
      "[[ 0.97157707  0.02842293]]\n"
     ]
    }
   ],
   "source": [
    "# Create a \"model\"\n",
    "def fun(x):\n",
    "    return x[0]**5 + x[1]\n",
    "\n",
    "def main():\n",
    "    order = 3\n",
    "    derivative_flag = 0 # derivative flag\n",
    "\n",
    "    # Parameter 1\n",
    "    c1 = PolynomialParam(\"Uniform\", 0.5, 2.0, 0, 0, derivative_flag, order)\n",
    "\n",
    "    # Parameter 2\n",
    "    c2 = PolynomialParam(\"Uniform\", 10.0, 15.0, 0, 0, derivative_flag, order)\n",
    "\n",
    "    # Method for computing polynomial\n",
    "    method = \"tensor grid\"\n",
    "\n",
    "    # Append c1 and c2 to 'model_inputs'\n",
    "    model_inputs = []\n",
    "    model_inputs.append(c1)\n",
    "    model_inputs.append(c2)\n",
    "\n",
    "    # Create a Polynomial object\n",
    "    polyObject = PolyParent(model_inputs, method)\n",
    "\n",
    "    # Compute the points and weights at which I need to evaluate my model\n",
    "    pts, wts, = PolyParent.getPointsAndWeights(polyObject)\n",
    "\n",
    "    # Compute the coefficients of this polynomial expansion\n",
    "    X, I, F = PolyParent.getCoefficients(polyObject, fun)\n",
    "\n",
    "    # Now compute the stats!\n",
    "    mean, variance = stats.compute_mean_variance(X, I)\n",
    "    sobol_indices = stats.compute_first_order_Sobol_indices(X, I)\n",
    "    \n",
    "    print mean, variance\n",
    "    print sobol_indices\n",
    "    \n",
    "main()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}

{'fraction_non_alphanumeric': 0.1908220534829977, 'fraction_numerical': 0.025420931000330143, 'mean_word_length': 2.4465301478953356, 'pattern_counts': {'":': 90, '<': 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': '2474874', 'n_tokens_mistral': 2387, 'n_tokens_neox': 2282, 'n_words': 451}