Improving Sentiment Prediction of Canadian Maritime Case Law using Heterogeneous and Homogeneous Ensemble Methods: A Comparative Study

Published: 8 May 2023| Version 1 | DOI: 10.17632/skkmgf3yhm.1
Bola Abimbola


This study uses machine and Homogeneous Ensemble Methods to retrieve legal data, classify, review, and predict judgments to expedite legal proceedings. Our study contributes significantly to the literature because judiciary systems in many nations face backlogs that cause delays in justice. In this paper, we propose a sentiment analysis framework using deep, distributed, and machine learning to enable access to statutes, laws, and cases so maritime judges in Canada can resolve cases efficiently. Naïve Bayes, SVM, and KNN model exhibited promising outcomes in terms of the capacity to extract sentiments and records from different devices and provide practical guidance. Therefore, the model can apply to other systems that follow the common-law framework.


Steps to reproduce

Step-by-Step Guide to the Development of the LSTM Machine Learning Model 1. Import all the Libraries that are required for the model. The importation of the library is done using the import statement, and it is critical because it ensures that features are defined. If a library is not installed in your notebook, use the command !Pip install xyz where xyz is the library name. 2. Load the data into the model. The data is loaded from a CSV file into a dataframe using the pandas library. Pd stands for pandas. Once the library is fully loaded, you can use the command df.head( ) to confirm that the data has been successfully loaded. 3. Check the status column on the data and assign a value of 1 if a judgment is affirmed and a value of 0 if it is not affirmed. This is achieved using the if else statement. 4. Create a new variable called y and assign values in the status column to it. Create another variable called x and assign values in the judgment column to it. 5. Use the sklearn library and split the data into training and testing data. 6. Vectorize the text data so that they can be used in the machine learning model. 7. Train the model using logistic regression. 8. Check the accuracy of the trained model using an accuracy score and a confusion matrix. 9. Test the predictions using the test data. 10. Create another model using support vector machine learn 11. Check the accuracy score of the model using confusion matrix 12. Create another model using the k-nearest neighbor algorithm 13. Check the accuracy of the score using confusion matrix. 14. Create another model using Multinomial naïve bayes algorithm 15. Check the accuracy using confusion matrix. 16. Create another model using the bagging classifier algorithm 17. Check the accuracy using a confusion matrix 18. Create the final model using adaboost classifier 19. Check the accuracy of the model using confusion matrix.


Universidad de Oviedo, Athabasca University


Machine Learning, Heterogeneous Method, Homogeneous Method, Sentiment Analysis