1
$\begingroup$

I've this code (part of predictive model):

training_features, test_features, training_target, test_target, = train_test_split(df.drop(['target'], axis=1),
                                              df['target'],
                                              test_size = .3,
                                              random_state=12)
    coef_gini = DecisionTreeClassifier(criterion = "gini", random_state = 100, max_depth = 3, min_samples_leaf = 5)
    coef_gini.fit(training_features, training_target)

    y_pred = coef_gini.predict(test_features)
    y_pred

How can I export my dataset with the predictive value in order to create a confusion matrix to determine the False Positive value?

Thanks!

$\endgroup$
0
$\begingroup$

If you are just looking for generating Confusion Matrix, then you can try using this command:

#for generating confusion matrix    
sklearn.metrics.confusion_matrix(y_true, y_pred, labels=None, sample_weight=None)

If you are just looking for binding predicted and actual values, you can use this command

#For Arrays you can use this
numpy.concatenate() 

#for dataframe you can use this
DataFrame.append(other, ignore_index=False, verify_integrity=False)[source]

for better understaning you can go through this Link-1,Link-2,Link-3

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.