Lower bound of Wilson score confidence interval for a Bernoulli parameter
All implementations use 95% probability.
pos
is the number of positive votes, n
is the total number of votes.
public static class ObjectToDictionaryHelper | |
{ | |
public static IDictionary<string, object> ToDictionary(this object source) | |
{ | |
return source.ToDictionary<object>(); | |
} | |
public static IDictionary<string, T> ToDictionary<T>(this object source) | |
{ | |
if (source == null) |
//adapted from the LoessInterpolator in org.apache.commons.math | |
function loess_pairs(pairs, bandwidth) | |
{ | |
var xval = pairs.map(function(pair){return pair[0]}); | |
var yval = pairs.map(function(pair){return pair[1]}); | |
console.log(xval); | |
console.log(yval); | |
var res = loess(xval, yval, bandwidth); | |
console.log(res); | |
return xval.map(function(x,i){return [x, res[i]]}); |
Lower bound of Wilson score confidence interval for a Bernoulli parameter
All implementations use 95% probability.
pos
is the number of positive votes, n
is the total number of votes.
#Transform web.config on build
</Project>
; v12.0 my change depending on your version of Visual Studiopublic static IEnumerable<Tuple<double, double>> LargestTriangleThreeBuckets(List<Tuple<double, double>> data, int threshold) | |
{ | |
int dataLength = data.Count; | |
if (threshold >= dataLength || threshold == 0) | |
return data; // Nothing to do | |
List<Tuple<double, double>> sampled = new List<Tuple<double, double>>(threshold); | |
// Bucket size. Leave room for start and end data points | |
double every = (double)(dataLength - 2) / (threshold - 2); |
module MyModule { | |
export class MyClass extends Vue { | |
// define instance methods | |
myMethod() { | |
// the TS-Type of "this" is defined as Instance of MyClass | |
console.log("myMethod"); | |
} | |
myOtherMethod() { | |
console.log("myOtherMethod"); |
from scipy.spatial.distance import pdist, squareform | |
import numpy as np | |
import copy | |
def distcorr(Xval, Yval, pval=True, nruns=500): | |
""" Compute the distance correlation function, returning the p-value. | |
Based on Satra/distcorr.py (gist aa3d19a12b74e9ab7941) | |
>>> a = [1,2,3,4,5] |
public float[] Downsample(float[] array, int Length) | |
{ | |
int insert = 0; | |
float[] window = new float[Length]; | |
float[] window_x = new float[Length]; | |
int bucket_size_less_start_and_end = Length - 2; | |
float bucket_size = (float)(array.Length - 2) / bucket_size_less_start_and_end; | |
int a = 0; | |
int next_a = 0; |
I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.
In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.
While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.
Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent