updated tests to check for percent diffs
This commit is contained in:
parent
d41e28bc6f
commit
69f08c4b78
@ -3,55 +3,8 @@ SET client_min_messages TO WARNING;
|
|||||||
_cdb_random_seeds
|
_cdb_random_seeds
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
cartodb_id|trend|trend_up|trend_down|volatility
|
cartodb_id|trend_test|trend_up_test|trend_down_test|volatility_test
|
||||||
1|0.0714285714286|0.0666666666667|0.0|0.367574633389
|
1|t|t|t|t
|
||||||
2|0.222222222222|0.181818181818|0.0|0.317010832258
|
2|t|t|t|t
|
||||||
3|0.0526315789474|0.05|0.0|0.37549966711
|
3|t|t|t|t
|
||||||
4|0.1|0.235294117647|0.176470588235|0.215650620939
|
(3 rows)
|
||||||
5|0.0|0.08|0.08|0.32199378876
|
|
||||||
6|-0.056338028169|0.0|0.0533333333333|0.373904325255
|
|
||||||
7|0.121212121212|0.108108108108|0.0|0.348470518082
|
|
||||||
8|0.0|0.0857142857143|0.0857142857143|0.316614746907
|
|
||||||
9|-0.0416666666667|0.0967741935484|0.129032258065|0.291681407883
|
|
||||||
10|0.222222222222|0.181818181818|0.0|0.317010832258
|
|
||||||
11|-0.294117647059|0.0|0.227272727273|0.299586491878
|
|
||||||
12|-0.2|0.0|0.166666666667|0.323178657161
|
|
||||||
13|-0.0769230769231|0.131578947368|0.184210526316|0.252741204285
|
|
||||||
14|-0.12|0.0333333333333|0.133333333333|0.320416395752
|
|
||||||
15|0.0526315789474|0.05|0.0|0.37549966711
|
|
||||||
16|0.0|0.0857142857143|0.0857142857143|0.316614746907
|
|
||||||
17|0.0|0.0|0.0|0.4
|
|
||||||
18|0.0|0.0|0.0|0.4
|
|
||||||
19|-0.056338028169|0.0|0.0533333333333|0.373904325255
|
|
||||||
20|0.238095238095|0.214285714286|0.0357142857143|0.286249498707
|
|
||||||
21|0.0|0.08|0.08|0.32199378876
|
|
||||||
22|0.0714285714286|0.0666666666667|0.0|0.367574633389
|
|
||||||
23|-0.04|0.138888888889|0.166666666667|0.256640210277
|
|
||||||
24|-0.04|0.138888888889|0.166666666667|0.256640210277
|
|
||||||
25|0.0|0.08|0.08|0.32199378876
|
|
||||||
26|0.1|0.235294117647|0.176470588235|0.215650620939
|
|
||||||
27|-0.056338028169|0.0|0.0533333333333|0.373904325255
|
|
||||||
28|-0.056338028169|0.0|0.0533333333333|0.373904325255
|
|
||||||
29|0.0526315789474|0.05|0.0|0.37549966711
|
|
||||||
30|-0.056338028169|0.0|0.0533333333333|0.373904325255
|
|
||||||
31|0.238095238095|0.214285714286|0.0357142857143|0.286249498707
|
|
||||||
32|-0.235294117647|0.0434782608696|0.217391304348|0.281234115283
|
|
||||||
33|-0.2|0.0|0.166666666667|0.323178657161
|
|
||||||
34|-0.2|0.0|0.166666666667|0.323178657161
|
|
||||||
35|-0.12|0.0333333333333|0.133333333333|0.320416395752
|
|
||||||
36|0.121212121212|0.108108108108|0.0|0.348470518082
|
|
||||||
37|-0.056338028169|0.0|0.0533333333333|0.373904325255
|
|
||||||
38|0.0526315789474|0.05|0.0|0.37549966711
|
|
||||||
39|-0.0769230769231|0.131578947368|0.184210526316|0.252741204285
|
|
||||||
40|-0.0416666666667|0.0967741935484|0.129032258065|0.291681407883
|
|
||||||
41|0.0|0.0857142857143|0.0857142857143|0.316614746907
|
|
||||||
42|0.222222222222|0.181818181818|0.0|0.317010832258
|
|
||||||
43|0.0|0.0|0.0|0.4
|
|
||||||
44|0.0|0.0|0.0|0.4
|
|
||||||
45|0.0|0.166666666667|0.166666666667|0.244948974278
|
|
||||||
46|0.1|0.0909090909091|0.0|0.356289417132
|
|
||||||
47|-0.0769230769231|0.131578947368|0.184210526316|0.252741204285
|
|
||||||
48|-0.333333333333|0.0|0.25|0.291547594742
|
|
||||||
(48 rows)
|
|
||||||
cartodb_id|trend|trend_up|trend_down|volatility
|
|
||||||
(0 rows)
|
|
||||||
|
@ -8,15 +8,26 @@ SET client_min_messages TO WARNING;
|
|||||||
-- that affect those results to have repeatable results
|
-- that affect those results to have repeatable results
|
||||||
SELECT cdb_crankshaft._cdb_random_seeds(1234);
|
SELECT cdb_crankshaft._cdb_random_seeds(1234);
|
||||||
|
|
||||||
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
|
SELECT
|
||||||
|
m1.cartodb_id,
|
||||||
|
CASE WHEN m1.cartodb_id = 1 THEN (m2.trend - 0.0714285714286) / 0.0714285714286 < 0.01
|
||||||
|
WHEN m1.cartodb_id = 2 THEN (m2.trend - 0.222222222222) / 0.222222222222 < 0.01
|
||||||
|
WHEN m1.cartodb_id = 3 THEN (m2.trend - 0.0526315789474) / 0.0526315789474 < 0.01
|
||||||
|
ELSE NULL END As trend_test,
|
||||||
|
CASE WHEN m1.cartodb_id = 1 THEN (m2.trend_up - 0.0666666666667) / 0.0666666666667 < 0.01
|
||||||
|
WHEN m1.cartodb_id = 2 THEN (m2.trend_up - 0.181818181818) / 0.181818181818 < 0.01
|
||||||
|
WHEN m1.cartodb_id = 3 THEN (m2.trend_up - 0.05) / 0.05 < 0.01
|
||||||
|
ELSE NULL END As trend_up_test,
|
||||||
|
CASE WHEN m1.cartodb_id = 1 THEN m2.trend_down = 0.0
|
||||||
|
WHEN m1.cartodb_id = 2 THEN m2.trend_down = 0.0
|
||||||
|
WHEN m1.cartodb_id = 3 THEN m2.trend_down = 0.0
|
||||||
|
ELSE NULL END As trend_down_test,
|
||||||
|
CASE WHEN m1.cartodb_id = 1 THEN (m2.volatility - 0.367574633389) / 0.367574633389 < 0.01
|
||||||
|
WHEN m1.cartodb_id = 2 THEN (m2.volatility - 0.317010832258) / 0.317010832258 < 0.01
|
||||||
|
WHEN m1.cartodb_id = 3 THEN (m2.volatility - 0.37549966711) / 0.37549966711 < 0.01
|
||||||
|
ELSE NULL END As volatility_test
|
||||||
FROM markov_usjoin_example As m1
|
FROM markov_usjoin_example As m1
|
||||||
JOIN cdb_crankshaft.CDB_SpatialMarkovTrend('SELECT * FROM markov_usjoin_example ORDER BY cartodb_id DESC', Array['y1995', 'y1996', 'y1997', 'y1998', 'y1999', 'y2000', 'y2001', 'y2002', 'y2003', 'y2004', 'y2005', 'y2006', 'y2007', 'y2008', 'y2009']::text[], 5::int, 'knn'::text, 5::int, 0::int, 'the_geom'::text, 'cartodb_id'::text) As m2
|
JOIN cdb_crankshaft.CDB_SpatialMarkovTrend('SELECT * FROM markov_usjoin_example ORDER BY cartodb_id DESC', Array['y1995', 'y1996', 'y1997', 'y1998', 'y1999', 'y2000', 'y2001', 'y2002', 'y2003', 'y2004', 'y2005', 'y2006', 'y2007', 'y2008', 'y2009']::text[], 5::int, 'knn'::text, 5::int, 0::int, 'the_geom'::text, 'cartodb_id'::text) As m2
|
||||||
ON m1.cartodb_id = m2.rowid
|
ON m1.cartodb_id = m2.rowid
|
||||||
ORDER BY m1.cartodb_id;
|
ORDER BY m1.cartodb_id
|
||||||
|
LIMIT 3;
|
||||||
|
|
||||||
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
|
|
||||||
FROM markov_usjoin_example As m1
|
|
||||||
JOIN cdb_crankshaft.CDB_SpatialMarkovTrend('SELECT * FROM markov_usjoin_example LIMIT 0', Array['y1995', 'y1996', 'y1997', 'y1998', 'y1999', 'y2000', 'y2001', 'y2002', 'y2003', 'y2004', 'y2005', 'y2006', 'y2007', 'y2008', 'y2009']::text[], 5::int, 'knn'::text, 5::int, 0::int, 'the_geom'::text, 'cartodb_id'::text) As m2
|
|
||||||
ON m1.cartodb_id = m2.rowid
|
|
||||||
ORDER BY m1.cartodb_id;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user