Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all classes serializable #30

Closed
guilhermecgs opened this issue May 6, 2015 · 4 comments
Closed

Make all classes serializable #30

guilhermecgs opened this issue May 6, 2015 · 4 comments

Comments

@guilhermecgs
Copy link

When using random forest, for example, every time the model is trained it results in a slightly different prediction.

Would be import to train the model for the first time, save the model in a file using serialization, and then use this saved version to always get the same results

For that to work, all classes must the serializable

@guilhermecgs
Copy link
Author

I have just read serialization info in the main page...
Can you provide examples for using XStream with random forest?

is it just like this?

XStream xstream = new XStream(new BinaryStreamDriver());
RandomForest randomForest = (RandomForest) xstream.fromXML(is);

@haifengl
Copy link
Owner

haifengl commented May 6, 2015

XStream web has tons of examples there.

@haifengl
Copy link
Owner

haifengl commented May 6, 2015

From http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/XStream.html

XStream xstream = new XStream();
String xml = xstream.toXML(myObject); // serialize to XML
Object myObject2 = xstream.fromXML(xml); // deserialize from XML

@guilhermecgs
Copy link
Author

really thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants