Does anyone know if I am able to open a pickled sklearn Python algorithm in R? Or if I can save a trained model in sklearn in a different way that can be opened and used in R? Specifically, I am looking at a gradient boosting model. Thanks!
I don't recommend doing what you are doing. It's a lot of extra work that you don't need.
However, in case you find yourself obliged to do that, I would think of saving my model in the binary format. This your best option.
This is possible for Xgboost see link here.
Read this answer on how to save xgboost as a binary file: link
You may want to take a look at the Reticulate package, it will allow you to call python code from R.
https://rstudio.github.io/reticulate/
Related
I trained a model using matterport maskrcnn. I already had .h5 model file but i am not able to convert it to .mlmodel. As there are many custom layers involved. I already tried whatever I am able to find on google regarding the same. I also tried https://github.com/edouardlp/Mask-RCNN-CoreML for conversion. So far no success.
Does anybody able to did the conversion so far successfully, if yes can you share the codebase or tutorial for the same.
I am able to convert using the same github repo mentioned in the question. But you can't debug the code in Xcode as maskrcnn is to memory heavy. Its better to use another architecture like deeplab.
Here's a github project https://github.com/edouardlp/Mask-RCNN-CoreML/releases/tag/0.2 with a MaskRCNN.ml model.
Note: You have to copy the models into the project to get it to compile.
I have a tobit regression model in R working completely well, where I am also able to predict the actual output values for the test set using Inverse-Mills Ratio. However, the rest of the code for my project is in python so I wanted to explore and use the rpy2 API to migrate the code to python from R. I have been able to achieve the bit until model training using AER.tobit() from the library AER (used in R). However when it comes to predicting on test data, the code is not performing as expected. When I use robjects.r.predict(model,newdata) from rpy2, it just gives me fitted values for the training data instead of responses for the test data. If anybody knows a way around this and can let me know, it will be great help! Thanks in advance!
Let me know if you'd need more clarification on the problem.
I'm having trouble figuring out how to use a support vector machine trained on Weka for real time processing with python.
For example when you train a back propagation algorithm on Matlab, you can extract the weights and biases and use them to replicate the network on other programs (e.g python) in feed-forward.
Thanks for your suggestions.
Assuming you want to continue using Python and Weka, the easiest way is to just call the Weka command line using subprocess (see https://docs.python.org/2/library/subprocess.html). You can then train and save your models and use them as needed. See this reference: https://weka.wikispaces.com/Saving+and+loading+models
So I'd like to use some of this training data in spaCy when I use the similarity() method.
I'd also like to maybe use the pre-trained vectors also on this page.
But the spaCy docs seem lacking here, does anyone know how to do this?
Unfortunately the docs for this still aren't linked on the site! We're reworking the docs. But, does this answer your question: https://spacy.io/tutorials/load-new-word-vectors
How to obtain the weights for SVM in OpenCV 2.4.6 for Python 2.7.5?
I need this to calculate the primal form of my cv2.SVM() to feed it to a cv2.HOGDescriptor().setSVMDetector.
Found this and this SOF useful, but it seems like SVM.decision_func is protected and I cannot access this variable to obtain the weights.
Are there any other ways to do this in Python+OpenCV?
You can use Save method to save SVM to hard drive.
If you need only weights then I think you need to modify code or look closer at format in which opencv svm saved.
here some info
OpenCv SVM output file format