# Choice of ML approach

Having some problems understanding how to tackle my problem in general, i.e. not specifically what algorithm to go for. I'm familiar with deep learning techniques, boosting, etc. so my core problem isn't algorithms, my problem is setting up the problem and my target logically.

I have a dataset showing a test that was conducted on people eating one of two types of food and their stats along with it.

• Every row represent a person
• None of the people had tried any of the two food types before the test
• I have some metrics columns describing my target: how much energy and how much sleep a person gets. Both of these columns exists as accumulated numbers before the test but also after the test.
• I have several numerical and categorical features describing the profile of the person.

What is interesting about the test was that it was not conducted using a random trial, but instead, every person was recommended one of the two food types based on the amount of sleep that person had prior to the test (one of the columns I described above).

This confuses me in how to tackle the problem, because my objective is to recommend (personal recommendation) one of the two types of food so that the amount of sleep is maximized (and also constrained so that the amount of energy does not decline).

I tried modelling on the group assigned using the features described above, but that didn't help me because the group assigned in the first place is directly based on the amount of sleep. Do you have any suggestions?

This is a classic problem of causal inference, where you are trying to estimate the effect of a treatment (in this case, the type of food) on an outcome (in this case, the amount of sleep), given that the treatment assignment was not random but based on a covariate (in this case, the amount of sleep prior to the test).

One common approach to tackle this problem is using Propensity Score Matching (PSM). The idea is to estimate the probability of receiving the treatment given the covariates (this is the propensity score), and then match each treated individual with a control individual with a similar propensity score. The difference in outcomes between the matched pairs is then an estimate of the treatment effect.

Here are the steps you could follow:

1. Estimate the propensity score: You can use a logistic regression where the dependent variable is the treatment assignment (type of food) and the independent variables are the covariates (including the amount of sleep prior to the test).

2. Match each treated individual with a control individual with a similar propensity score: There are different methods to do this matching (nearest neighbor, caliper matching, etc.). You can choose the one that best suits your data.

3. Estimate the treatment effect: Calculate the difference in outcomes (amount of sleep after the test) between the matched pairs. This is your estimate of the treatment effect.

4. Check the balance of your matched sample: You want to make sure that the distribution of the covariates is similar between the treated and control groups in your matched sample. If it's not, you may need to adjust your matching method or include more covariates in your propensity score model.

5. Make your recommendation: Based on the estimated treatment effect, you can recommend the type of food that maximizes the amount of sleep (and also constrained so that the amount of energy does not decline).

Remember that this method assumes that there are no unobserved confounders, i.e., there are no variables that affect both the treatment assignment and the outcome and that you have not included in your model. If this assumption is not met, your estimate of the treatment effect may be biased.