简体   繁体   中英

How to load a .rda neuralnetwork model of R in python

I have done a binary classification model using neuralnet() function in R. An example code is here . I have done same network using python keras , which has less prediction accuracy due to its parameters adjustments. So i have saved the R's neural network model using save(model_nnet, file = "/tmp/model_nnet.rda") and loaded using load(file = "/tmp/model_nnet.rda") .

My question is can i load this file in python? and use it for some predicton?

RData files are R's storage format for R objects, and so can contain complex data structures and metadata. This is not easy to translate into data formats for other languages.

You will have to load the RData file into R and write the components of the object you need to text files using other packages - for example you could write it to a JSON file using one of R's JSON packages, and then read it in using a Python JSON module. But you will have to manually extract the parameters and numbers and so o from your model fit and construct an object that can be written to JSON. Its possible someone has already done this for your class of object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM