pep8 syntax

This commit is contained in:
Andy Eschbacher 2018-03-14 12:14:17 -04:00
parent 6fd3fbcbb7
commit 229e4671f7

View File

@ -50,8 +50,19 @@ RETURNS TABLE (cartodb_id TEXT, prediction NUMERIC, accuracy NUMERIC)
AS $$ AS $$
from crankshaft.segmentation import Segmentation from crankshaft.segmentation import Segmentation
seg = Segmentation() seg = Segmentation()
model_params = {'n_estimators': n_estimators, 'max_depth':max_depth, 'subsample' : subsample, 'learning_rate': learning_rate, 'min_samples_leaf' : min_samples_leaf} model_params = {
return seg.create_and_predict_segment(query,variable_name,target_table, model_params) 'n_estimators': n_estimators,
'max_depth': max_depth,
'subsample': subsample,
'learning_rate': learning_rate,
'min_samples_leaf': min_samples_leaf
}
return seg.create_and_predict_segment(
query,
variable_name,
target_table,
model_params
)
$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; $$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE;
CREATE OR REPLACE FUNCTION CREATE OR REPLACE FUNCTION
@ -69,6 +80,18 @@ RETURNS TABLE (cartodb_id TEXT, prediction NUMERIC, accuracy NUMERIC)
AS $$ AS $$
from crankshaft.segmentation import Segmentation from crankshaft.segmentation import Segmentation
seg = Segmentation() seg = Segmentation()
model_params = {'n_estimators': n_estimators, 'max_depth':max_depth, 'subsample' : subsample, 'learning_rate': learning_rate, 'min_samples_leaf' : min_samples_leaf} model_params = {
return seg.create_and_predict_segment(query, variable, feature_columns, target_query, model_params) 'n_estimators': n_estimators,
'max_depth': max_depth,
'subsample': subsample,
'learning_rate': learning_rate,
'min_samples_leaf': min_samples_leaf
}
return seg.create_and_predict_segment(
query,
variable,
feature_columns,
target_query,
model_params
)
$$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE; $$ LANGUAGE plpythonu VOLATILE PARALLEL UNSAFE;