The easiest way to transition between pie charts with differently-sized datasets (while maintaining object constancy) is to set the missing values to zero.
function type(d) {
d.apples = +d.apples || 0;
d.oranges = +d.oranges || 0;
return d;
}
The easiest way to transition between pie charts with differently-sized datasets (while maintaining object constancy) is to set the missing values to zero.
function type(d) {
d.apples = +d.apples || 0;
d.oranges = +d.oranges || 0;
return d;
}
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
function getElementsByClassName2(className) { | |
const nodes = [] | |
function crawl(node) { | |
if (node.classList && node.classList.value.indexOf(className) > -1) { | |
nodes.push(node) | |
} | |
node.childNodes.forEach((child) => | |
crawl(child) | |
) |
function flatten(arr, flat) { | |
let output = !!flat ? flat : [] | |
arr.forEach((el) => { | |
if (typeof el === 'number') { | |
output.push(el) | |
} else { | |
flatten(el, output) | |
} |
class Network { | |
constructor(neuronsPerLayer = []) { | |
this.layers = neuronsPerLayer.length | |
this.neuronsPerLayer = neuronsPerLayer | |
this.biases = [] // call initialiseValues() | |
this.weights = [] // call initialiseValues() | |
} | |
// Train network with SGD |
const nj = require('numjs') | |
// The activation function of choice, for a given input x, the function will return either 0, if x < 0, or x. | |
// This is used to find the activation of the hidden layer nodes during forward propagation. | |
function relu(x) { | |
return iterator(x, x => ((x > 0) * x)) | |
} | |
// The derivative of the activation function above, this is used during the backward propagation and gradient descent process to find | |
// the updated for weights between the input and hidden layer nodes. | |
function reluDeriv(x) { |
const crypto = require('crypto') | |
class Block { | |
constructor(index, timestamp, data, previousHash) { | |
this.index = index | |
this.timestamp = timestamp | |
this.data = data | |
this.previousHash = previousHash | |
this.hash = this.hashBlock() |
import org.saddle._ | |
object Main { | |
def main(args: Array[String]) { | |
// Requires *.sbt file including saddle dependency to run. Run from command line with `sbt run frame.scala` | |
val height: Series[String, Double] = Series("Male" -> 6.0, "Male" -> 5.92, "Male" -> 5.58, "Male" -> 5.92, | |
"Female" -> 5.0, "Female" -> 5.5, "Female" -> 5.42, "Female" -> 5.75) | |
val weight: Series[String, Double] = Series("Male" -> 180.0, "Male" -> 190.0, "Male" -> 170.0, "Male" -> 165.0, | |
"Female" -> 100.0, "Female" -> 150.0, "Female" -> 130.0, "Female" -> 150.0) |
# main.py | |
from scipy.spatial import distance | |
from collections import Counter | |
class KNN(): | |
def __init__(self, n_neighbors=1): | |
self.n_neighbors = n_neighbors | |
def fit(self, X_train, y_train): |
I hereby claim:
To claim this, I am signing this object: