0
$\begingroup$

When I'm working on dataset and want to explore different relationships between features and target, I often use visualization, only for regression with continous feature and continous target I use pearson correlation. And my question is how can I "measure" (if that's the right word) relationships for:

  • Categorical to continous (usually I calculate mean for each group)
  • Categorical to categorical (usually I explore distribution of feature classes in target classes)

What I'm asking is, what are ways to determine if variables which both are not continous, can be tested if they influance each other, influance that can be used for predictions

$\endgroup$
1
  • $\begingroup$ For categorical-to-categorical, use chi-squared. Otherwise, see this Cross-Validated answer. $\endgroup$
    – m13op22
    May 15, 2023 at 15:04

1 Answer 1

1
$\begingroup$

You can run a contingency table chi-squared test.

import pandas as pd
import scipy.stats as stats
contingency_table = pd.crosstab(df['categorical'], df['y'])
chi2_result = stats.chi2_contingency(contingency_table)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.