fixed normalization functions
This commit is contained in:
@@ -388,38 +388,48 @@ def _(S, data, mo):
|
||||
return (vscales,)
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(pl, vscales):
|
||||
# Count non-null values per row
|
||||
nn_vscale = vscales.with_columns(
|
||||
non_null_count = pl.sum_horizontal(pl.all().exclude("_recordID").is_not_null())
|
||||
)
|
||||
nn_vscale.collect()['non_null_count'].describe()
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _(S, mo, vscales):
|
||||
mo.md(f"""
|
||||
### How does each voice score on a scale from 1-10?
|
||||
|
||||
{mo.ui.altair_chart(S.plot_average_scores_with_counts(vscales, x_label='Voice', width=1000, domain=[1,10]))}
|
||||
{mo.ui.altair_chart(S.plot_average_scores_with_counts(vscales, x_label='Voice', width=1000, domain=[1,10], title="Voice General Impression (Scale 1-10)"))}
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(utils, vscales):
|
||||
def _(S, mo, utils, vscales):
|
||||
_target_cols=[c for c in vscales.collect().columns if c not in ['_recordId']]
|
||||
vscales_row_norm = utils.normalize_row_values(vscales.collect(), target_cols=_target_cols)
|
||||
vscales_row_norm
|
||||
return (vscales_row_norm,)
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(S, mo, vscales_row_norm):
|
||||
mo.md(f"""
|
||||
### Voice scale 1-10 normalized per respondent?
|
||||
|
||||
{mo.ui.altair_chart(S.plot_average_scores_with_counts(vscales_row_norm, x_label='Voice', width=1000))}
|
||||
{mo.ui.altair_chart(S.plot_average_scores_with_counts(vscales_row_norm, x_label='Voice', width=1000, domain=[1,10], title="Voice General Impression (Scale 1-10) - Normalized per Respondent"))}
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(mo):
|
||||
mo.md(r"""
|
||||
|
||||
def _(S, mo, utils, vscales):
|
||||
_target_cols=[c for c in vscales.collect().columns if c not in ['_recordId']]
|
||||
vscales_global_norm = utils.normalize_global_values(vscales.collect(), target_cols=_target_cols)
|
||||
|
||||
mo.md(f"""
|
||||
### Voice scale 1-10 normalized per respondent?
|
||||
|
||||
{mo.ui.altair_chart(S.plot_average_scores_with_counts(vscales_global_norm, x_label='Voice', width=1000, domain=[1,10], title="Voice General Impression (Scale 1-10) - Normalized Across All Respondents"))}
|
||||
""")
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user