Skip to content

Instantly share code, notes, and snippets.

Martin Thoma MartinThoma

Block or report user

Report or block MartinThoma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MartinThoma
MartinThoma / xception_summary.txt
Created Feb 11, 2019
Keras model summary of Xception (Image classification deep learning model)
View xception_summary.txt
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) (None, None, None, 3 0
__________________________________________________________________________________________________
block1_conv1 (Conv2D) (None, None, None, 3 864 input_1[0][0]
__________________________________________________________________________________________________
block1_conv1_bn (BatchNormaliza (None, None, None, 3 128 block1_conv1[0][0]
__________________________________________________________________________________________________
block1_conv1_act (Activation) (None, None, None, 3 0 block1_conv1_bn[0][0]
View amentment.md

Code

UTC time with offset:

>>> import pytz
>>> tz = pytz.timezone('Pacific/Apia')
>>> import datetime
>>> datetime.datetime(2011, 12, 30, 9, 59, tzinfo=datetime.timezone.utc).astimezone(tz).isoformat()
'2011-12-29T23:59:00-10:00'
>>> datetime.datetime(2011, 12, 30, 10, 00, tzinfo=datetime.timezone.utc).astimezone(tz).isoformat()
View gist:85080a53f73661f971a7ef4dba48364b
Decision trees might even be in $\mathcal{O}(1)$. I have to give impurity measures a closer thought.
# Time Complexity of Training and Testing
## By training samples ($n$) and samples features ($m$) and number of classes ($c$).
The following classifiers potentially have computational complexities less than or equal with $\mathcal{O}(mnc)$ complexity) in both of the training and testing phases.
* k-nearest neighbors is linear (https://stats.stackexchange.com/questions/219655/k-nn-computational-complexity),
* Naive Bayes is linear for those PDFs that can be estimated in linear time (e.g. Poisson and Multinomial PDFs).
* Approximate SVM is linear (https://stats.stackexchange.com/questions/96995/machine-learning-classifiers-big-o-or-complexity)
View data-science-wordcloud.txt
11 Python #509e2f
10 Computer~Science
10 Mathematics
9 R #509e2f
8 machine~learning #651d32
7 Big~Data #41b6e6
6 Java #509e2f
5 Databases
5 Hadoop #41b6e6
4 Tensorflow/Keras/Theano #651d32
@MartinThoma
MartinThoma / diff.txt
Created May 28, 2018
Difference between mtrand.cpython-36m-x86_64-linux-gnu.so of numpy 1.14.0 vs numpy 1.14.1
View diff.txt
_rand_bool(low, high, size, rngstate)
Return random np.bool_ integers between ``low`` and ``high``, inclusive.
Return random integers from the "discrete uniform" distribution in the
closed interval [``low``, ``high``). On entry the arguments are presumed
to have been validated for size and order for the np.bool_ type.
Parameters
----------
low : int
Lowest (signed) integer to be drawn from the distribution.
high : int
View linear_regression.py
#!/usr/bin/env python
import numpy as np
from sklearn.linear_model import LinearRegression
import sklearn.metrics
regressor = LinearRegression()
n = 4
feature_dim = 2
View gist:fa4deb2b4c71ffcd726b24b7ab581ae2
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import daemon
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/daemon.py", line 70
os.umask(022) # Don't allow others to write
^
SyntaxError: invalid token
View pandas_example.py
#!/usr/bin/env python
"""What is the difference between map and apply?"""
import pandas as pd
df = pd.DataFrame([(1, 2, 3), (5, 6, 7), (9, 0, 1), (3, 4, 5)],
columns=list('abc'),
index=['India', 'France', 'England', 'Germany'])
View gist:e9b072c5314d3d5d2507aba8a86b0d6e
>>> df = pd.DataFrame([{'id': 1, 'price': 123, 'name': 'anna', 'amount': 1},
... {'id': 1, 'price': 7, 'name': 'anna', 'amount': 2},
... {'id': 2, 'price': 42, 'name': 'bob', 'amount': 30},
... {'id': 3, 'price': 1, 'name': 'charlie', 'amount': 10},
... {'id': 3, 'price': 2, 'name': 'david', 'amount': 100}])
>>> df
amount id name price
0 1 1 anna 123
1 2 1 anna 7
View .config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:MartinThoma/scipy.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
You can’t perform that action at this time.