The script fullProject.py contains a script for a Random Forest Classifier model that can be used for training, checking, and predicting the classification of a robot. The file can be run in the command line interface by providing arguments such as the mode of operation (train, check or predict), and the file path of the dataset.
- sys
- os
- pandas
- sklearn
- pickle
- datetime
- matplotlib
pip install pandas sklearn pickle matplotlib
This function is used for logging messages. It takes two parameters:
message(required): a string containing the message to be logged.importance(optional): an integer indicating the importance of the message, which can be 0 (INFO), 1 (WARNING), or 2 (ERROR). The default value is 0.
This is the main function of the script, which contains the logic for training, checking, and predicting the Random Forest Classifier model.
To run the script, open a command-line interface, navigate to the directory where the file is located, and enter the following command:
python fullProject.py [mode] [file_path]
fullProject.py: the name of the Python file.mode: the mode of operation, which can be "train", "check", or "predict". The default value is "train".file_path: the path to the dataset file. The default value is "data/weblogs_train.csv".
To train the model, run the following command:
python full_project.py train file_path
To check the model, run the following command:
python full_project.py check file_path
To use the model for prediction, run the following command:
python full_project.py predict file_path
Note that in this mode, the model should be already trained and saved in a .pkl file. If the file does not exist, the script will raise an error.
This script is used for splitting the dataset file data/weblogs.csv into training and testing sets
These notebooks contain tests & experiments for training the model.