in the binary classification casethe return value of decision_function is of shape (n_samples,)and it returns one floating-point number for each samplein[ ]print("x_test shape{}format(x_test shape)print("decision function shape{}formatgbrt decision_function(x_testshape)out[ ]x_test shape( decision function shape( ,this value encodes how strongly the model believes data point to belong to the "positiveclassin this case class positive values indicate preference for the positive classand negative values indicate preference for the "negative(otherclassin[ ]show the first few entries of decision_function print("decision function:\ {}format(gbrt decision_function(x_test)[: ])out[ ]decision function - - - we can recover the prediction by looking only at the sign of the decision functionin[ ]print("thresholded decision function:\ {}formatgbrt decision_function(x_test )print("predictions:\ {}format(gbrt predict(x_test))out[ ]thresholded decision functiontrue false false false true true false true true true false true true false true false false false true true true true true false falsepredictions['red'blue'blue'blue'red'red'blue'red'red'red'blue'red'red'blue'red'blue'blue'blue'red'red'red'red'red'blue'blue'for binary classificationthe "negativeclass is always the first entry of the classes_ attributeand the "positiveclass is the second entry of classes_ so if you want to fully recover the output of predictyou need to make use of the classes_ attribute supervised learning