I am trying to implement a random survival forest with sample weights. However, it appears as if the function does not do anything with the sample weights I give as input. I have tried fitting the function without and with sample weights of different values, but I keep getting the exact same wrong predictions. My code looks something like this:
pip install scikit-survival
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sksurv.ensemble import RandomSurvivalForest
trainWeight = X_train["Weight"].to_numpy()
y_train = y_train[["Event", "Time"]].to_records(index = False)
# Create and fit the Random Survival Forest model
random_state = 20
rsf = RandomSurvivalForest(n_estimators=10, min_samples_split=10, min_samples_leaf=15, n_jobs=-1, random_state=random_state, max_features="sqrt", max_depth=10)
rsf.fit(X_train[bestFeatures2], y_train, trainWeight)
# Check if logical
survivalTrain = rsf.predict_survival_function(X_train[bestFeatures2], return_array=True)
survivalTrain = pd.DataFrame(data = survivalTrain)
The data looks something like this:
Is there something I am doing wrong, or is there a workaround?
Thanks in advance!