Home Machine Learning Estimating Individualized Therapy Guidelines Utilizing Consequence Weighted Studying | by Nadav Har-Tuv | Mar, 2024

Estimating Individualized Therapy Guidelines Utilizing Consequence Weighted Studying | by Nadav Har-Tuv | Mar, 2024

0
Estimating Individualized Therapy Guidelines Utilizing Consequence Weighted Studying | by Nadav Har-Tuv | Mar, 2024

[ad_1]

Simulating information can check the owl technique. We create the reward perform in order that we all know what the optimum therapy is for each affected person. We will then prepare the OWL classifier on the info and verify how properly it suits the optimum classifier.

For instance:

I created 50 options which can be all sampled from a U([-1,1]) distribution. I gave the sufferers considered one of three remedies {1,2,3} at random, uniformly.

The response perform is sampled from a N(μ, 1) distribution, the place μ = (X₁ + X₂)*I(T=1) + (X₁ — X₂)*I(T=2) + (X₂-X₁)*I(T=3)

# This code block creates the info for the simulation
import numpy as np

n_train = 500 # I purposely selected a small coaching set to simulate a medical trial
n_col = 50 # That is the variety of options
n_test = 1000
X_train = np.random.uniform(low = -1, excessive = 1, dimension = (n_train, n_col))
T = np.random.randint(3, dimension = n_train) # Remedies given at random uniformly
R_mean = (X_train[:,0]+X_train[:,1])*(T==0) + (X_train[:,0]-X_train[:,1])*(T==1) + (X_train[:,1]-X_train[:,0])*(T==2)
R = np.random.regular(loc = R_mean, scale = .1) # The stanadard deviation may be tweaked
X_test = np.random.uniform(low = -1 , excessive = 1, dimension = (n_test, n_col))

# The optimum classifier may be deduced from the design of R
optimal_classifier = (1-(X_test[:,0] >0)*(X_test[:,1]>0))*((X_test[:,0] > X_test[:,1]) + 2*(X_test[:,1] > X_test[:,0]))

It’s not onerous to see that the optimum therapy regime is to provide therapy 1 if each X₁ and X₂ are optimistic. If they’re each destructive, give therapy 2 if X₂<X₁ and provides therapy 3 if X₁<X₂. If X₁ is optimistic and X₂ is destructive, give therapy 2. If X₂ is optimistic and X₁ is destructive, give therapy 3.

Or we will present this with a picture. These are the completely different ranges of the optimum therapy, proven for ranges of X₁, X₂:

Optimum therapy ranges for combos of X₁, X₂

I sampled 500 information factors with 50 options and the reward perform that I described above. I match an OWL classifier with a Gaussian (‘rbf’) kernel and received the next classifications, which I visualized for values of X₁, X₂:

Classification of therapy teams visualized for values of X₁, X₂
# Code for the plot 
import seaborn as sns

kernel = 'rbf'
gamma = 1/X_train.form[1]
# gamma is a hyperparameter that needs to be discovered by cross validation however it is a good place to begin
D = owl_classifier(X_train, T, R, kernel, gamma)
prediction = D.predict(X_test)
sns.scatterplot(x = X_test[:,0], y = X_test[:,1], c = prediction )

In case you missed what occurred right here: The info was composed of two options that affected the response and 48 options of noise. The mannequin managed to be taught the impact of the 2 vital options with out us modeling this relationship in any method!

This is only one easy instance, I made the reward perform depend upon X₁ and X₂ in order that it’s straightforward to grasp and visualize however you may be happy to make use of different examples and check out completely different classifiers.

[ad_2]