Skip to content

Commit

Permalink
update playground
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 authored Oct 28, 2024
1 parent db74ad0 commit f36615c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 168 deletions.
179 changes: 12 additions & 167 deletions docs/exercises/playground.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"vscode": {
"languageId": "markdown"
}
},
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand All @@ -46,175 +42,24 @@
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"vscode": {
"languageId": "markdown"
}
},
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"from sklearn.linear_model import LinearRegression\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.metrics import accuracy_score\n",
"from sklearn.metrics import confusion_matrix\n",
"import seaborn as sns\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "markdown"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;31mDocstring:\u001b[0m\n",
"array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0,\n",
" like=None)\n",
"\n",
"Create an array.\n",
"\n",
"Parameters\n",
"----------\n",
"object : array_like\n",
" An array, any object exposing the array interface, an object whose\n",
" __array__ method returns an array, or any (nested) sequence.\n",
" If object is a scalar, a 0-dimensional array containing object is\n",
" returned.\n",
"dtype : data-type, optional\n",
" The desired data-type for the array. If not given, then the type will\n",
" be determined as the minimum type required to hold the objects in the\n",
" sequence.\n",
"copy : bool, optional\n",
" If true (default), then the object is copied. Otherwise, a copy will\n",
" only be made if __array__ returns a copy, if obj is a nested sequence,\n",
" or if a copy is needed to satisfy any of the other requirements\n",
" (`dtype`, `order`, etc.).\n",
"order : {'K', 'A', 'C', 'F'}, optional\n",
" Specify the memory layout of the array. If object is not an array, the\n",
" newly created array will be in C order (row major) unless 'F' is\n",
" specified, in which case it will be in Fortran order (column major).\n",
" If object is an array the following holds.\n",
"\n",
" ===== ========= ===================================================\n",
" order no copy copy=True\n",
" ===== ========= ===================================================\n",
" 'K' unchanged F & C order preserved, otherwise most similar order\n",
" 'A' unchanged F order if input is F and not C, otherwise C order\n",
" 'C' C order C order\n",
" 'F' F order F order\n",
" ===== ========= ===================================================\n",
"\n",
" When ``copy=False`` and a copy is made for other reasons, the result is\n",
" the same as if ``copy=True``, with some exceptions for 'A', see the\n",
" Notes section. The default order is 'K'.\n",
"subok : bool, optional\n",
" If True, then sub-classes will be passed-through, otherwise\n",
" the returned array will be forced to be a base-class array (default).\n",
"ndmin : int, optional\n",
" Specifies the minimum number of dimensions that the resulting\n",
" array should have. Ones will be prepended to the shape as\n",
" needed to meet this requirement.\n",
"like : array_like, optional\n",
" Reference object to allow the creation of arrays which are not\n",
" NumPy arrays. If an array-like passed in as ``like`` supports\n",
" the ``__array_function__`` protocol, the result will be defined\n",
" by it. In this case, it ensures the creation of an array object\n",
" compatible with that passed in via this argument.\n",
"\n",
" .. versionadded:: 1.20.0\n",
"\n",
"Returns\n",
"-------\n",
"out : ndarray\n",
" An array object satisfying the specified requirements.\n",
"\n",
"See Also\n",
"--------\n",
"empty_like : Return an empty array with shape and type of input.\n",
"ones_like : Return an array of ones with shape and type of input.\n",
"zeros_like : Return an array of zeros with shape and type of input.\n",
"full_like : Return a new array with shape of input filled with value.\n",
"empty : Return a new uninitialized array.\n",
"ones : Return a new array setting values to one.\n",
"zeros : Return a new array setting values to zero.\n",
"full : Return a new array of given shape filled with value.\n",
"\n",
"\n",
"Notes\n",
"-----\n",
"When order is 'A' and `object` is an array in neither 'C' nor 'F' order,\n",
"and a copy is forced by a change in dtype, then the order of the result is\n",
"not necessarily 'C' as expected. This is likely a bug.\n",
"\n",
"Examples\n",
"--------\n",
">>> np.array([1, 2, 3])\n",
"array([1, 2, 3])\n",
"\n",
"Upcasting:\n",
"\n",
">>> np.array([1, 2, 3.0])\n",
"array([ 1., 2., 3.])\n",
"\n",
"More than one dimension:\n",
"\n",
">>> np.array([[1, 2], [3, 4]])\n",
"array([[1, 2],\n",
" [3, 4]])\n",
"\n",
"Minimum dimensions 2:\n",
"\n",
">>> np.array([1, 2, 3], ndmin=2)\n",
"array([[1, 2, 3]])\n",
"\n",
"Type provided:\n",
"\n",
">>> np.array([1, 2, 3], dtype=complex)\n",
"array([ 1.+0.j, 2.+0.j, 3.+0.j])\n",
"\n",
"Data-type consisting of more than one element:\n",
"\n",
">>> x = np.array([(1,2),(3,4)],dtype=[('a','<i4'),('b','<i4')])\n",
">>> x['a']\n",
"array([1, 3])\n",
"\n",
"Creating an array from sub-classes:\n",
"\n",
">>> np.array(np.mat('1 2; 3 4'))\n",
"array([[1, 2],\n",
" [3, 4]])\n",
"\n",
">>> np.array(np.mat('1 2; 3 4'), subok=True)\n",
"matrix([[1, 2],\n",
" [3, 4]])\n",
"\u001b[0;31mType:\u001b[0m builtin_function_or_method"
]
}
],
"source": [
"?np.array"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "markdown"
}
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -228,7 +73,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.10.15"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pykdtree
fsspec
scikit-learn
requests
aiohttp
aiohttp
seaborn

0 comments on commit f36615c

Please sign in to comment.