-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97d115e
commit 1dea48b
Showing
93 changed files
with
22,340 additions
and
1,849 deletions.
There are no files selected for viewing
1,033 changes: 1,033 additions & 0 deletions
1,033
.ipynb_checkpoints/Ch1_Introduction_PyMC3-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -0,0 +1,165 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 92, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"cancer.keys(): /ndict_keys(['feature_names', 'DESCR', 'data', 'target', 'target_names'])\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from sklearn.datasets import load_breast_cancer, load_boston\n", | ||
"\n", | ||
"cancer = load_breast_cancer()\n", | ||
"print('cancer.keys(): /n{}'.format(cancer.keys()))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 93, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"shape of cancer is (569, 30)\n", | ||
"Sample counts per class: \n", | ||
"{'benign': 357, 'malignant': 212}\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print('shape of cancer is {}'.format(cancer.data.shape))\n", | ||
"print('Sample counts per class: \\n{}'.format({n: v for n,v in zip(cancer.target_names, np.bincount(cancer.target))}))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 94, | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(569,)" | ||
] | ||
}, | ||
"execution_count": 94, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"cancer.target.shape" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 95, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"#custom test train split function\n", | ||
"def test_train_split(ndmatrix, test_size = .3):\n", | ||
" import numpy as np\n", | ||
" rows = ndmatrix.data.shape[0]\n", | ||
" rand_inx = np.random.choice(range(rows), rows, False) #another strategy, randomize everything, then just split by position\n", | ||
" data = ndmatrix.data[rand_inx]\n", | ||
" target = ndmatrix.target[rand_inx]\n", | ||
" split_inx = int(rows*test_size)\n", | ||
" X_train, X_test = data[split_inx:], data[:split_inx]\n", | ||
" y_train, y_test = target[split_inx:], target[:split_inx]\n", | ||
" return X_train, y_train, X_test, y_test" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 120, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"SVC scores: \n", | ||
"0.6235294117647059\n", | ||
"Naive Bayes scores: \n", | ||
"0.9176470588235294\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from sklearn.naive_bayes import GaussianNB\n", | ||
"from sklearn.svm import SVC\n", | ||
"\n", | ||
"svc = SVC(C=.001)\n", | ||
"svc.fit(X_train, y_train)\n", | ||
"\n", | ||
"print(\"SVC scores: \\n{}\".format(svc.score(X_test, y_test)))\n", | ||
"\n", | ||
"X_train, y_train, X_test, y_test = test_train_split(cancer)\n", | ||
"nb = GaussianNB()\n", | ||
"nb.fit(X_train, y_train)\n", | ||
"print(\"Naive Bayes scores: \\n{}\".format(nb.score(X_test, y_test)))\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 91, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"399 170\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(len(X_train),len(X_test))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.5.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-5.11 MB
Career Dev and Books/Think Stats - Probability and Statistics for Programmers [BIG].pdf
Binary file not shown.
File renamed without changes.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Submodule courses
added at
22b07d
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
User name,Password,Access key ID,Secret access key,Console login link | ||
ctivan,TvxCp$r#NEGA,AKIAIXOLXICVHP6X7VSA,XdFzw+qWPYwOqiCAwKDRXjBtIEmkSCxf6rrDEH+S,https://137009966217.signin.aws.amazon.com/console | ||
,,,, | ||
,,,, | ||
Connect to your instance: ssh -i /home/nodal/.ssh/aws-key-fast-ai.pem [email protected],,,, |
This file contains 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Connect to your instance: | ||
ssh -i /home/nodal/.ssh/aws-key-fast-ai.pem [email protected] | ||
# Stop your instance: : | ||
aws ec2 stop-instances --instance-ids i-0532431a82b095705 | ||
# Start your instance: | ||
aws ec2 start-instances --instance-ids i-0532431a82b095705 | ||
# Reboot your instance: | ||
aws ec2 reboot-instances --instance-ids i-0532431a82b095705 | ||
export instanceId=i-0532431a82b095705 | ||
export subnetId=subnet-9b70e0d3 | ||
export securityGroupId=sg-8b144bf6 | ||
export instanceUrl=ec2-54-69-62-69.us-west-2.compute.amazonaws.com | ||
export routeTableId=rtb-19f49360 | ||
export name=fast-ai | ||
export vpcId=vpc-9c527cfa | ||
export internetGatewayId=igw-ff9ea198 | ||
export subnetId=subnet-9b70e0d3 | ||
export allocAddr=eipalloc-4e86e773 | ||
export assocId=eipassoc-5fee7c60 | ||
export routeTableAssoc=rtbassoc-f618108e |
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
aws ec2 disassociate-address --association-id eipassoc-5fee7c60 | ||
aws ec2 release-address --allocation-id eipalloc-4e86e773 | ||
aws ec2 terminate-instances --instance-ids i-0532431a82b095705 | ||
aws ec2 wait instance-terminated --instance-ids i-0532431a82b095705 | ||
aws ec2 delete-security-group --group-id sg-8b144bf6 | ||
aws ec2 disassociate-route-table --association-id rtbassoc-f618108e | ||
aws ec2 delete-route-table --route-table-id rtb-19f49360 | ||
aws ec2 detach-internet-gateway --internet-gateway-id igw-ff9ea198 --vpc-id vpc-9c527cfa | ||
aws ec2 delete-internet-gateway --internet-gateway-id igw-ff9ea198 | ||
aws ec2 delete-subnet --subnet-id subnet-9b70e0d3 | ||
aws ec2 delete-vpc --vpc-id vpc-9c527cfa | ||
echo If you want to delete the key-pair, please do it manually. |
Oops, something went wrong.