You can always just look at your ROC curve. Each point of the ROC curve corresponds to a separate confusion matrix. Thus, specifying the matrix of confusion that you want by choosing a threshold for the classifier implies some kind of cost-weighting scheme. Then you just need to choose a confusion matrix that will imply the required cost matrix.
On the other hand, if you really had your heart set up, and you really want to βtrainβ the algorithm using a cost matrix, you can βsortβ it in sklearn.
Despite the fact that it is not possible to directly configure the algorithm for cost sensitivity in sklearn, you can use the sorting of cost parameters to configure your hyperparameters. I did something similar to this using a genetic algorithm. This is not really a good job, but it should give a modest boost to performance.
source share