StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1010 B
62 lines
1010 B
"use strict"
|
|
|
|
var inSphere = require("../in-sphere.js")
|
|
var twoProduct = require("two-product")
|
|
|
|
function sgn(x) {
|
|
if(x < 0) {
|
|
return -1
|
|
}
|
|
if(x > 0) {
|
|
return 1
|
|
}
|
|
return 0
|
|
}
|
|
|
|
require("tape")(function(t) {
|
|
|
|
t.equals(sgn(inSphere([0], [1], [0.5])), -1)
|
|
t.equals(sgn(inSphere([0], [1], [1.5])), 1)
|
|
|
|
t.equals(sgn(inSphere(
|
|
[0,-1],
|
|
[1,0],
|
|
[0,1],
|
|
[-0.5,0])), 1)
|
|
|
|
t.equals(sgn(inSphere(
|
|
[0,-1],
|
|
[1,0],
|
|
[0,1],
|
|
[-1,0])), 0)
|
|
|
|
t.equals(sgn(inSphere(
|
|
[0,-1],
|
|
[1,0],
|
|
[0,1],
|
|
[-1.5,0])), -1 )
|
|
|
|
var x = 1e-64
|
|
for(var i=0; i<128; ++i) {
|
|
t.equals(sgn(inSphere(
|
|
[0,x],
|
|
[-x,-x],
|
|
[x,-x],
|
|
[0,0])), 1, "sphere test:" + x)
|
|
t.equals(sgn(inSphere(
|
|
[0,x],
|
|
[-x,-x],
|
|
[x,-x],
|
|
[0,2*x])), -1, "sphere test:" + x)
|
|
|
|
t.equals(sgn(inSphere(
|
|
[0,x],
|
|
[-x,-x],
|
|
[x,-x],
|
|
[0,x])), 0, "sphere test:" + x)
|
|
|
|
x *= 10
|
|
}
|
|
|
|
t.end()
|
|
}) |