Skip to content

Commit

Permalink
Update component.py
Browse files Browse the repository at this point in the history
bug-fix ltv flatenning logic
  • Loading branch information
chmstimoteo authored Dec 13, 2023
1 parent 90284a3 commit c3fddc2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/pipelines/components/bigquery/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,15 @@ def bq_union_predictions_tables(
CREATE TEMP TABLE flattened_prediction AS (
SELECT
CASE
WHEN {predictions_column_propensity}.classes[OFFSET(0)]='0' AND {predictions_column_propensity}.scores[OFFSET(0)]> {threashold} THEN 'false'
WHEN {predictions_column_propensity}.classes[OFFSET(1)]='1' AND {predictions_column_propensity}.scores[OFFSET(1)]> {threashold} THEN 'true'
WHEN {predictions_column_propensity}.classes[OFFSET(1)]='0' AND {predictions_column_propensity}.scores[OFFSET(1)]> {threashold} THEN 'false'
WHEN {predictions_column_propensity}.classes[OFFSET(0)]='1' AND {predictions_column_propensity}.scores[OFFSET(0)]> {threashold} THEN 'true'
ELSE 'false'
END AS {predictions_column_regression},
CASE
WHEN {predictions_column_propensity}.classes[OFFSET(0)]='0' AND {predictions_column_propensity}.scores[OFFSET(0)]> {threashold} THEN
{predictions_column_propensity}.scores[OFFSET(0)]
WHEN {predictions_column_propensity}.classes[OFFSET(1)]='1' AND {predictions_column_propensity}.scores[OFFSET(1)]> {threashold} THEN
WHEN {predictions_column_propensity}.classes[OFFSET(1)]='0' AND {predictions_column_propensity}.scores[OFFSET(1)]> {threashold} THEN
{predictions_column_propensity}.scores[OFFSET(1)]
WHEN {predictions_column_propensity}.classes[OFFSET(0)]='1' AND {predictions_column_propensity}.scores[OFFSET(0)]> {threashold} THEN
{predictions_column_propensity}.scores[OFFSET(0)]
ELSE {predictions_column_propensity}.scores[OFFSET(0)]
END AS prediction_prob,
a.* EXCEPT({predictions_column_propensity})
Expand Down Expand Up @@ -709,4 +709,4 @@ def bq_union_predictions_tables(
results = query_job.result()

for row in results:
logging.info("row info: {}".format(row))
logging.info("row info: {}".format(row))

0 comments on commit c3fddc2

Please sign in to comment.