Logistic Regression Model – Evaluation using aiOS SDK
More articles in Tips, Tricks, and More
Introduction
This document helps the user to run evaluation on the classical Logistic Regression (LogReg) model using the Razorthink aiOS SDK.
Problem
The user wants evaluate the logistic regression model that is trained and saved with given metric.
Solution
Create an instance of LogisticRegression class with following parameters and evaluate the model by running execute():
- operation – evaluate
- metric_function – Specify suitable evaluation metric from the following, that best suits for the problem that you are dealing with. confusion_matrix, accuracy_score, precision_score, recall_score, f1_score, roc_curve
- test_x_data – Test data on which the model is to be evaluated.
- test_y_data – Test target values corresponding to each data point in test_x_data.
- path – Specify the path where the trained model is saved.
lr_model_conf = (LogisticRegression()
.operation("evaluate")
.metric_function("confusion_matrix")
.test_x_data(train_data.out_x)
.test_y_data(train_data.out_y)
.path("lr_m1.sav"))
evaluate_pipeline = Pipeline(targets=[lr_model_conf])
evaluate_pipeline.show()
Executing the evaluation pipeline in the Jupyter Notebooks.
evaluate_pipeline.execute()