I'm working with genomics data; I have a multi-class label with a matrix of numeric values (rows are the samples). Each sample may have different metadata which are not being used for training nor testing. For example, each sample may be treated with a dosage value of 50 or 100, etc. The classification model works well using lda or rf. I am open to use any.

I have about four (dosage, tissue, etc) of these metadata and would like to know which of them are influencing the model and by how much.

  • $\begingroup$ So in this case, do you have 4 rows? One is dosage, one tissue, etc... -> Where the values correspond to the sample? OR, do you have other features as rows, and an additional table with meta data? $\endgroup$
    – GooJ
    Commented Sep 9, 2022 at 15:14
  • $\begingroup$ @GooJ I made a mistake in the question and corrected it. The rows are the samples or the observations. The columns are the features + a multiclass label. The dosage and tissue (metadata) will not use in training or testing; so yes, an additional table. Even if it's not in training matrix, the model will learn from the metadata though and I want to observe how it learns and which metadata (dosage, tissue) affects the model the most. $\endgroup$
    – purple1437
    Commented Sep 9, 2022 at 15:42

2 Answers 2


3 options come to mind that address your problem directly, in prority order:

  1. Add the meta data as features to your dataset, if the feature importance is high for those features - then you are proving some relationship.
  2. Treat the meta data as targets, "can you use your current features to predict this?"
  3. Plot your results by meta data feature. I would start with a parallel coordinates plot: https://plotly.com/python/parallel-coordinates-plot/ Where each label is a meta data feature + one of the labels being your target (see plot below)enter image description here
  • In addition to this, you can run a large number of statistical tests to quantify this relationship.

Dummy code for plot:

import plotly.express as px
df = px.data.iris()
fig = px.parallel_coordinates(df, color="species_id", labels={"species_id": "Target",
                "sepal_width": "dosage", "sepal_length": "tissue",
                "petal_width": "day_of_week", "petal_length": "time", },

You have several ways to interpret results, one of them is the feature importance that you can found in the sklearn version of RF.


Then, you can also display the trees to understand their limits and their distribution:


I recommend using many visualizations to understand the data and its results from different angles. You have libraries like seaborn that have great viz features.



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.