Choose threshold to get 90% precision classifier - ML Binary Classification problem
threshold_90_precision = thresholds[np.argmax(precisions &gt;= 0.9)]

Above snippet is not doing what you are expecting it to do.
 Try these changes
precisions[precisions &lt; 0.9] = 1
threshold_90_precision = thresholds[np.argmin(precisions)]


Also, I am not sure whether you are calculating the accuracy properly since z_scores is decision function, not Class.
This is a working example using  method='predict_proba' for 40%, you may change to 90%
model.fit(x_train, y_train)

from sklearn.model_selection import cross_val_predict
y_train_pred = cross_val_predict(model, x_train, y_train, cv=3)

z_scores = cross_val_predict(model, x_train, y_train, method='predict_proba')

from sklearn.metrics import precision_recall_curve
precisions, recalls, thresholds = precision_recall_curve(y_train_pred, z_scores[:,0])

import numpy as np
precisions[precisions &lt; 0.4] = 1
threshold_90_precision = thresholds[np.argmin(precisions)]

y_train_pred_90percent_precision = z_scores[:,0] &gt;= threshold_90_precision
from sklearn.metrics import precision_score
print(precision_score(y_train, y_train_pred_90percent_precision))