forked from jakevdp/PythonDataScienceHandbook
-
Notifications
You must be signed in to change notification settings - Fork 7
Cross repository pull request #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amit2rrr
wants to merge
3
commits into
amit1rrr:master
Choose a base branch
from
amit2rrr:trial
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
"cell_type": "markdown", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. T2- Post from ReviewNB
amit1rrr marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. T12 |
||
"metadata": {}, | ||
"source": [ | ||
"Up to this point we have been concerned mainly with tools to access and operate on array data with NumPy.\n", | ||
"Up to this point we have ever been concerned mainly with tools to access and operate on array data with NumPy.\n", | ||
"This section covers algorithms related to sorting values in NumPy arrays.\n", | ||
"These algorithms are a favorite topic in introductory computer science courses: if you've ever taken one, you probably have had dreams (or, depending on your temperament, nightmares) about *insertion sorts*, *selection sorts*, *merge sorts*, *quick sorts*, *bubble sorts*, and many, many more.\n", | ||
"All are means of accomplishing a similar task: sorting the values in a list or array.\n", | ||
|
@@ -41,26 +41,24 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import os\n", | ||
"\n", | ||
"def selection_sort(x):\n", | ||
" for i in range(len(x)):\n", | ||
" swap = i + np.argmin(x[i:])\n", | ||
" (x[i], x[swap]) = (x[swap], x[i])\n", | ||
" i += 1\n", | ||
" (x[x], x[swap]) = (x[swap], x[i])\n", | ||
" return x" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -92,9 +90,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def bogosort(x):\n", | ||
|
@@ -106,9 +102,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -151,9 +145,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -181,9 +173,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
|
@@ -208,9 +198,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
|
@@ -237,9 +225,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -273,9 +259,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
|
@@ -297,9 +281,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -323,9 +305,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -365,9 +345,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -398,9 +376,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -444,9 +420,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"X = rand.rand(10, 2)" | ||
|
@@ -462,9 +436,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -496,9 +468,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 16, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"dist_sq = np.sum((X[:, np.newaxis, :] - X[np.newaxis, :, :]) ** 2, axis=-1)" | ||
|
@@ -514,9 +484,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 17, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -538,9 +506,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 18, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -562,9 +528,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 19, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -593,9 +557,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 20, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -623,9 +585,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 21, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
|
@@ -661,9 +621,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 22, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"K = 2\n", | ||
|
@@ -680,9 +638,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 23, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
|
@@ -773,9 +729,9 @@ | |
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.5.1" | ||
"version": "3.6.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
"nbformat_minor": 1 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T1- Post from ReviewNB