rename functions -> trend
This commit is contained in:
parent
e7de471ac8
commit
1f73be2752
@ -10,7 +10,7 @@
|
|||||||
-- Array['date_1', 'date_2', 'date_3'])
|
-- Array['date_1', 'date_2', 'date_3'])
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION
|
CREATE OR REPLACE FUNCTION
|
||||||
CDB_SpatialMarkov (
|
CDB_SpatialMarkovTrend (
|
||||||
subquery TEXT,
|
subquery TEXT,
|
||||||
time_cols TEXT[],
|
time_cols TEXT[],
|
||||||
num_classes INT DEFAULT 7,
|
num_classes INT DEFAULT 7,
|
||||||
|
@ -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
|
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
|
||||||
FROM markov_usjoin_example As m1
|
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
|
ON m1.cartodb_id = m2.rowid
|
||||||
ORDER BY m1.cartodb_id;
|
ORDER BY m1.cartodb_id;
|
||||||
|
|
||||||
|
|
||||||
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
|
SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility
|
||||||
FROM markov_usjoin_example As m1
|
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
|
ON m1.cartodb_id = m2.rowid
|
||||||
ORDER BY m1.cartodb_id;
|
ORDER BY m1.cartodb_id;
|
||||||
|
@ -19,6 +19,7 @@ def spatial_markov_trend(subquery, time_cols, num_classes = 7,
|
|||||||
Inputs:
|
Inputs:
|
||||||
@param subquery string: e.g., SELECT the_geom, cartodb_id, interesting_time_column FROM table_name
|
@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 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 w_type string (optional): weight type ('knn' or 'queen')
|
||||||
@param num_ngbrs int (optional): number of neighbors (if knn type)
|
@param num_ngbrs int (optional): number of neighbors (if knn type)
|
||||||
@param permutations int (optional): number of permutations for test stats
|
@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_down float: probablity that a geom will move to a lower class
|
||||||
@param trend float: (trend_up - trend_down) / trend_static
|
@param trend float: (trend_up - trend_down) / trend_static
|
||||||
@param volatility float: a measure of the volatility based on probability stddev(prob array)
|
@param volatility float: a measure of the volatility based on probability stddev(prob array)
|
||||||
@param
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if len(time_cols) < 2:
|
if len(time_cols) < 2:
|
||||||
|
Loading…
Reference in New Issue
Block a user