Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sample adaboost classifier algorithm

# Import DecisionTreeClassifier
from sklearn.tree import DecisionTreeClassifier

# Import AdaBoostClassifier
from sklearn.ensemble import AdaBoostClassifier

# Instantiate dt
dt = DecisionTreeClassifier(max_depth=2, random_state=1)

# Instantiate ada
ada = AdaBoostClassifier(base_estimator=dt, n_estimators=180, random_state=1)
# Fit ada to the training set
ada.fit(X_train, y_train)

# Compute the probabilities of obtaining the positive class
y_pred_proba = ada.predict_proba(X_test)[:,1]
# Import roc_auc_score
from sklearn.metrics import roc_auc_score

# Evaluate test-set roc_auc_score
ada_roc_auc = roc_auc_score(y_test, y_pred_proba)

# Print roc_auc_score
print('ROC AUC score: {:.2f}'.format(ada_roc_auc))
Comment

PREVIOUS NEXT
Code Example
Python :: list dictionary to json file python with tab 
Python :: get sum of column before a date python 
Python :: how to wait for loading icon to disappear from the page using selenium python 
Python :: How to find the most similar word in a list in python 
Python :: error:pip.subprocessor:command errored out with exit status 1: 
Python :: slice python 
Python :: HOW TO CREATE A DATETIME LIST QUICK 
Python :: how to encrypt and decrypt strings python 
Python :: WSGIPassAuthorization on 
Python :: django count all objects 
Python :: #add,remove and clear all values on set in python 
Python :: jupyter notebook not showing all null values 
Python :: how to split a dataframe into train and test 
Python :: powershell bulk rename and add extra string to filename 
Python :: argparse for Command-Line Interface (CLI) 
Python :: handlebars python 
Python :: can i call a python script from a function 
Python :: Python Permutation without built-in function [itertools] for Lists 
Python :: python logging levels 
Python :: create database tables python 
Python :: pytest snapshot update 
Python :: pyplot aera 
Python :: get image image memeory size in url inpyton requests 
Python :: quotation marks n string 
Python :: bytestring python 
Python :: how to set class attributes with kwargs python 
Python :: re.search 
Python :: sqlalchemy one to one foreign key 
Python :: get dummies pandas 
Python :: django filter values with OR operator 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =