rename functions -> trend

This commit is contained in:
Andy Eschbacher 2016-06-06 08:46:13 -04:00
parent e7de471ac8
commit 1f73be2752
3 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@
-- Array['date_1', 'date_2', 'date_3'])
CREATE OR REPLACE FUNCTION
CDB_SpatialMarkov (
CDB_SpatialMarkovTrend (
subquery TEXT,
time_cols TEXT[],
num_classes INT DEFAULT 7,

View File

@ -10,13 +10,13 @@ SELECT cdb_crankshaft._cdb_random_seeds(1234);
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
FROM markov_usjoin_example As m1
JOIN cdb_crankshaft.CDB_SpatialMarkov('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
ORDER BY m1.cartodb_id;
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
FROM markov_usjoin_example As m1
JOIN cdb_crankshaft.CDB_SpatialMarkov('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
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;

View File

@ -19,6 +19,7 @@ def spatial_markov_trend(subquery, time_cols, num_classes = 7,
Inputs:
@param subquery string: e.g., SELECT the_geom, cartodb_id, interesting_time_column FROM table_name
@param time_cols list of strings: list of strings of column names
@param num_classes (optional): number of classes to break distribution of values into. Currently uses quantile bins.
@param w_type string (optional): weight type ('knn' or 'queen')
@param num_ngbrs int (optional): number of neighbors (if knn type)
@param permutations int (optional): number of permutations for test stats
@ -30,7 +31,6 @@ def spatial_markov_trend(subquery, time_cols, num_classes = 7,
@param trend_down float: probablity that a geom will move to a lower class
@param trend float: (trend_up - trend_down) / trend_static
@param volatility float: a measure of the volatility based on probability stddev(prob array)
@param
"""
if len(time_cols) < 2: