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
View 2d-plot.tex
legend pos=south east,
legend cell align={left},
View pytest execution for set equality
def test_a():
assert set([1, 2, 3]) == set([2, 3])
$ pytest
============================= test session starts ==============================
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]


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()
>>> 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 (,
* Naive Bayes is linear for those PDFs that can be estimated in linear time (e.g. Poisson and Multinomial PDFs).
* Approximate SVM is linear (
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 / diff.txt
Created May 28, 2018
Difference between 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.
low : int
Lowest (signed) integer to be drawn from the distribution.
high : int
#!/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/", line 70
os.umask(022) # Don't allow others to write
SyntaxError: invalid token
#!/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)],
index=['India', 'France', 'England', 'Germany'])
You can’t perform that action at this time.