Skip to content

Commit

Permalink
Merge pull request #45 from kristeligt-dagblad/bug-fixes
Browse files Browse the repository at this point in the history
Add dimension to feature info; remove labels from CREATE statement.
  • Loading branch information
rbjerrum authored Feb 15, 2023
2 parents 44e423e + 69ce0c5 commit 2c227ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion macros/hooks/model_audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'schema': 'string',
'created_at': type_timestamp(),
'training_info': 'array<struct<training_run int64, iteration int64, loss float64, eval_loss float64, learning_rate float64, duration_ms int64, cluster_info array<struct<centroid_id int64, cluster_radius float64, cluster_size int64>>>>',
'feature_info': 'array<struct<input string, min float64, max float64, mean float64, median float64, stddev float64, category_count int64, null_count int64>>',
'feature_info': 'array<struct<input string, min float64, max float64, mean float64, median float64, stddev float64, category_count int64, null_count int64, dimension int64>>',
'weights': 'array<struct<processed_input string, weight float64, category_weights array<struct<category string, weight float64>>>>',
'evaluate': 'array<struct<precision float64, recall float64, accuracy float64, f1_score float64, log_loss float64, roc_auc float64>>',
}) %}
Expand Down
9 changes: 1 addition & 8 deletions macros/materializations/model.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@
{% endmacro %}

{% macro model_options(ml_config, labels) %}
{%- if labels -%}
{%- set label_list = [] -%}
{%- for label, value in labels.items() -%}
{%- do label_list.append((label, value)) -%}
{%- endfor -%}
{%- do ml_config.update({'labels': label_list}) -%}
{%- endif -%}

{% set options -%}
options(
{%- for opt_key, opt_val in ml_config.items() -%}
{%- if opt_val is sequence and not (opt_val | first) is number and (opt_val | first).startswith('hparam_') -%}
{%- if opt_val is sequence and (opt_val | first) is string and (opt_val | first).startswith('hparam_') -%}
{{ opt_key }}={{ opt_val[0] }}({{ opt_val[1:] | join(', ') }})
{%- else -%}
{{ opt_key }}={{ (opt_val | tojson) if opt_val is string else opt_val }}
Expand Down

0 comments on commit 2c227ca

Please sign in to comment.