Skip to content

Instantly share code, notes, and snippets.

View fnielsen's full-sized avatar

Finn Årup Nielsen fnielsen

View GitHub Profile
@fnielsen
fnielsen / Nielsen2014Data_femalehurricanes.ipynb
Last active August 29, 2015 14:02
Modeling of Female Hurricanes dataset.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fnielsen
fnielsen / implication.py
Last active August 29, 2015 14:02
Self-referential implication
from math import exp
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(x):
return 1.0 / (1.0 + exp(-x))
def implication(a, b):
@fnielsen
fnielsen / awesome
Created July 17, 2014 19:35
Awesome
import re
import requests
import pandas as pd
import matplotlib.pyplot as plt
pd.Series({re.findall('^(.+)\n', section)[0]: len(re.findall('^\*', section, flags=re.MULTILINE)) for section in re.split('^##[^#]', requests.get('https://raw.githubusercontent.com/josephmisiti/awesome-machine-learning/master/README.md').text, flags=re.MULTILINE)[1:-1]}).plot(kind='barh', title="'Awesome' machine learning links")
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fnielsen
fnielsen / Nielsen2014Python_case.ipynb
Last active January 27, 2016 19:48
Nielsen2014Python_case.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fnielsen
fnielsen / tagcloud.py
Created September 19, 2014 15:40
Tag cloud with Python
from collections import Counter
from nltk.corpus import brown
from pytagcloud import create_tag_image, make_tags
from PIL import Image
# Developed from https://pypi.python.org/pypi/pytagcloud
create_tag_image(make_tags(Counter(brown.words()).most_common(150), maxsize=300), 'cloud.png', size=(900, 600), fontname='Lobster')
Image.open('cloud.png').show()
@fnielsen
fnielsen / string_for_tokenization.py
Created September 21, 2014 22:50
String for tokenization
s = u"""DTU course 02819 is taught by Mr. Finn Årup Nielsen,
Ph.D. Some of aspects of the course are: machine learning and web
2.0. The telephone to Finn is (+45) 4525 3921, and his email is
[email protected]. A book published by O'Reilly called 'Programming
Collective Intelligence' might be useful. It costs $39.99 or 285.00
kroner in Polyteknisk Boghandle. Is 'Text Processing in Python'
appropriate for the course? Perhaps! The constructor function in
Python is called "__init__()". fMRI will not be a topic of the
course."""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.