this code will persist our model on the disk as file named lr_model pkl so whenever we will load this object in memory again we will get the logistic regression model object lr joblib load('lr_model pkl'lr logisticregression( = class_weight=nonedual=falsefit_intercept=trueintercept_scaling= max_iter= multi_class='ovr'n_jobs= penalty=' 'random_state=nonesolver='liblinear'tol= verbose= warm_start=falsewe can now use this lr objectwhich is our model loaded from the diskand make predictions sample is depicted as follows print(lr predict(x_test[ : ])y_test[ : ][ [ remember that once you have persisted modelyou can easily integrate it with python based script or application that can be scheduled to predict in realtime or batches of new data howeverproper engineering of the solution is necessary to ensure the right data reaches the model and the prediction output should also be broadcasted to the right channels custom development another option to deploy model is by developing the implementation of model prediction method separately the output of most machine learning algorithms is just the values of parameters that were learned once we have extracted these parameter valuesthe prediction process is pretty straightforward for examplethe prediction of logistic regression can be done by multiplying the coefficient vector with the input data vector this simple calculation will give us the score for the data vector that we can feed to the sigmoid\logistic function and extract the prediction for our input data this method has more roots in the software development process as the developed model is reduced to set of configurations and parameters and the main focus would be on engineering the data and the necessary mathematical computations using some programming language this configuration can be used to develop custom implementation pipeline in which the prediction process is just simple mathematical operation in-house model deployment lot of enterprises and organizations will not want to expose their private and confidential data on which models need to be built and deployed hence they will be leveraging their own software and data science expertise to build and deploy custom solutions on their own infrastructure this can involve leveraging commercial-off-the-shelf tools to deploy models or using custom open source tools and frameworks python based models can be easily integrated with frameworks like flask or django to create rest apis or micro-services on top of the prediction models and these api endpoints can then be exposed and integrated with any other solutions or applications that might need it