Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
license: gpl-3.0 | |
redirect: https://observablehq.com/@d3/icicle |
Based on D3.JS and Dimple, ChartFactory provide the ability to build quickly D3.JS charts without coding any lines of javascript. Just define your dashboard in a JSON and voila !
charts: [
{id:'chart1',
width:800,height:250,
xAxis:{type:'Category',field: "Month",orderRule:'Date'},
import os | |
import gdata | |
import atom | |
import gdata.contacts | |
import gdata.contacts.service | |
import dataset | |
import requests | |
from lxml import html | |
from urlparse import urljoin, parse_qs |
import re | |
AFRICA = [u"Africa", u"Algeria", u"Angola", u"Benin", u"Botswana", | |
u"Burkina Faso", u"Burundi", u"Cameroon", u"Cape Verde", | |
u"Central African Republic", u"Chad", u"Comoros", u"Congo", | |
u"Djibouti", u"Egypt", u"Equatorial Guinea", u"Eritrea", | |
u"Ethiopia", u"Gabon", u"Gambia", u"Ghana", u"Guinea", | |
u"Guinea-Bissau", u"Ivory Coast", u"Kenya", u"Lesotho", | |
u"Liberia", u"Libya", u"Madagascar", u"Malawi", u"Mali", | |
u"Mauritania", u"Mauritius", u"Morocco", u"Mozambique", |
""" | |
The basic idea is that I loop through all characters and count the number of | |
pixels and make <Hashtable number of pixels as a key and character as value> | |
The table will not have 255 value so to cover this I had to calculate the | |
slope of change as a base step for the colors. | |
example, if we have 50 value and we need 255 value, then each 255/50 = 5.1 | |
Then with each gray color we will devied by 5 so we have index to | |
be fetched from the keys of the pixels table |
## Makes a monitor where the mean of last x oob improvements | |
## are used to determine early stopping. This can be ammended | |
## to any stopping criteria one sees as fit - consecutive x | |
## negatives, more negatives than positives in last x, etc. | |
def make_monitor(running_mean_len): | |
def monitor(i,self,args): | |
if np.mean(self.oob_improvement_[max(0,i-running_mean_len+1):i+1])<0: | |
return True | |
else: |
""" | |
Classifies sequences of length 10 with 20 features into 2 classes | |
with a single LSTM layer with 32 neurons. | |
See also a more involved example: | |
https://gist.github.com/bzamecnik/dccc1c4fdcf1c7a31757168b19c827a7 | |
""" | |
from keras.layers import Input, LSTM, Dense |