models/train_classifier.py
def evaluate_model(model, X_test, Y_test, category_names):
    '''This function is used to evaluate the model built above on the test dataset. 
    
    Then, it iterates through the categorical columns and calls sklearn's classification_report on each.
    
    This gets us scores on:
        -precision
        -recall
        -f1-score
        
    If the input is invalid or the data does not exist, this function will raise an error.
    
    INPUT:
    Y_pred --> defined for the prediction on the dependent variable based on the independent variable from the test dataset
    
    OUTPUT:
    classification_report --> a report of scores listed above for each column
    '''
    #Predict the model on the test dependent variable
    Y_pred = model.predict(X_test)
    
    #Print a classification report for each column 
    for i, column in enumerate(category_names):
        print("Report for target column: " + column)
        print(classification_report(Y_test.values[:, i], Y_pred[:,i], target_names=["0", "1"]))
This function is used to evaluate the model built above on the test dataset. 
    
    Then, it iterates through the categorical columns and calls sklearn's classification_report on each.
    
    This gets us scores on:
        -precision
        -recall
        -f1-score
        
    If the input is invalid or the data does not exist, this function will raise an error.
    
    INPUT:
    Y_pred --> defined for the prediction on the dependent variable based on the independent variable from the test dataset
    
    OUTPUT:
    classification_report --> a report of scores listed above for each column
    
This function is used to evaluate the model built above on the test dataset.
Then, it iterates through the categorical columns and calls sklearn's classification_report on each.

This gets us scores on:
precision
recall
f1-score

If the input is invalid or the data does not exist, this function will raise an error.

-> defined for the prediction on the dependent variable based on the independent variable from the test dataset

-> a report of scores listed above for each column
This function is used to evaluate the model built above on the test dataset . Then it iterates through the categorical columns and calls sklearn ' s classification_report on each . This gets us scores on : precision recall f1 - score If the input is invalid or the data does not exist this function will raise an error . - > defined for the prediction on the dependent variable based on the independent variable from the test dataset - > a report of scores listed above for each column
def evaluate_model(model, X_test, Y_test, category_names):
    Y_pred = model.predict(X_test)
    for i, column in enumerate(category_names):
        print("Report for target column: " + column)
        print(classification_report(Y_test.values[:, i], Y_pred[:,i], target_names=["0", "1"]))
def evaluate_model ( model , X_test , Y_test , category_names ) : Y_pred = model . predict ( X_test ) for i , column in enumerate ( category_names ) : print ( "Report for target column: " + column ) print ( classification_report ( Y_test . values [ : , i ] , Y_pred [ : , i ] , target_names = [ "0" , "1" ] ) )
This function is used to evaluate the model built above on the test dataset.
This function is used to evaluate the model built above on the test dataset .
'''This function is used to evaluate the model built above on the test dataset. 
    
    Then, it iterates through the categorical columns and calls sklearn's classification_report on each.
    
    This gets us scores on:
        -precision
        -recall
        -f1-score
        
    If the input is invalid or the data does not exist, this function will raise an error.
    
    INPUT:
    Y_pred --> defined for the prediction on the dependent variable based on the independent variable from the test dataset
    
    OUTPUT:
    classification_report --> a report of scores listed above for each column
    ''' #Predict the model on the test dependent variable #Print a classification report for each column 
model
X_test
Y_test
category_names