Description Usage Arguments Details Note See Also Examples
Reads or writes the solution from or to a file. The format of the solutions is the same as used in the command line version of liquidSVM. In addition also configuration data is written and by default also the training data. This can be interchanged also with the other bindings.
1 2 3 4 5 6 7 | read.liquidSVM(filename, ...)
write.liquidSVM(model, filename)
serialize.liquidSVM(model, writeData = TRUE)
unserialize.liquidSVM(obj, ...)
|
filename |
the filename to read from/save to. Can be relative to the working directory. |
... |
passed to |
model |
the model |
writeData |
whether the training data should be serialized in the stream |
obj |
the data to unserialize |
The command line version of liquidSVM saves solutions
after select in files of the name data.sol
or data.fsol
and
uses those in the test-phase.
read.liquidSVM
and write.liquidSVM
read and write the same format at the specified path.
If you give a filename
using extension .fsol
the training data
is written to the file and read from it. On the other hand,
if you use the .sol
format, you need to be able to reproduce
the same data again once you read the solution.
readSolution
creates a new svm object.
This is not tested thoroughly so use in production is at your own risk. Furthermore the serialize/unserialize hooks write temporary files.
init.liquidSVM
, write.liquidSVM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
banana <- liquidData('banana-bc')
modelOrig <- mcSVM(Y~., banana$train)
write.liquidSVM(modelOrig, "banana-bc.fsol")
write.liquidSVM(modelOrig, "banana-bc.sol")
clean(modelOrig) # delete the SVM object
# now we read it back from the file
modelRead <- read.liquidSVM("banana-bc.fsol")
# No need to train/select the data!
errors(test(modelRead, banana$test))
# to read the model where no data was saved we have to make sure, we get the same training data:
banana <- liquidData('banana-bc')
# then we can read it
modelDataExternal <- read.liquidSVM("banana-bc.sol", Y~., banana$train)
result <- test(modelDataExternal, banana$test)
# to serialize an object use:
banana <- liquidData('banana-bc')
modelOrig <- mcSVM(Y~., banana$train)
# we serialize it into a raw vector
obj <- serialize.liquidSVM(modelOrig)
clean(modelOrig) # delete the SVM object
# now we unserialize it from that raw vector
modelUnserialized <- unserialize.liquidSVM(obj)
errors(test(modelUnserialized, banana$test))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.