models/train_classifier.py
def evaluate_model(model, X_test, y_test, category_names):
    """
    Calculate and print evaluation metrics for ML model

        Args:
        model: Pipeline. Model for prediction
        X_test: array. Array containing inputs
        Y_test: array. Array containing actual labels.
        category_names: list of strings. List containing names for each of the predicted fields.

        Returns: None
    """
    y_pred = model.predict(X_test)

    # Calculate evaluation metrics for each set of labels
    for i, col in enumerate(category_names):
        print(f'{"_" * 80}\n{col.upper():^70}\n')
        print(classification_report(list(y_test.values[:, i]), list(y_pred[:, i])))

    Calculate and print evaluation metrics for ML model

        Args:
        model: Pipeline. Model for prediction
        X_test: array. Array containing inputs
        Y_test: array. Array containing actual labels.
        category_names: list of strings. List containing names for each of the predicted fields.

        Returns: None
    
Calculate and print evaluation metrics for ML model
Args:
model: Pipeline. Model for prediction
X_test: array. Array containing inputs
Y_test: array. Array containing actual labels.
category_names: list of strings. List containing names for each of the predicted fields.

None
Calculate and print evaluation metrics for ML model Args : model : Pipeline . Model for prediction X_test : array . Array containing inputs Y_test : array . Array containing actual labels . category_names : list of strings . List containing names for each of the predicted fields . None
def evaluate_model(model, X_test, y_test, category_names):
    y_pred = model.predict(X_test)
    for i, col in enumerate(category_names):
        print(f'{"_" * 80}\n{col.upper():^70}\n')
        print(classification_report(list(y_test.values[:, i]), list(y_pred[:, i])))
def evaluate_model ( model , X_test , y_test , category_names ) : y_pred = model . predict ( X_test ) for i , col in enumerate ( category_names ) : print ( f'{"_" * 80}\n{col.upper():^70}\n' ) print ( classification_report ( list ( y_test . values [ : , i ] ) , list ( y_pred [ : , i ] ) ) )
Calculate and print evaluation metrics for ML model
Args:
model: Pipeline.
Calculate and print evaluation metrics for ML model Args : model : Pipeline .
"""
    Calculate and print evaluation metrics for ML model

        Args:
        model: Pipeline. Model for prediction
        X_test: array. Array containing inputs
        Y_test: array. Array containing actual labels.
        category_names: list of strings. List containing names for each of the predicted fields.

        Returns: None
    """ # Calculate evaluation metrics for each set of labels
model
X_test
y_test
category_names