libsvm
libsvm copied to clipboard
Load and save from a memory buffer
I want to manage a model database without using temporary files. For this, I propose an API extension:
int svm_save_model_buffer(const char *model_buffer, int buffer_length, const struct svm_model *model);
struct svm_model *svm_load_model_buffer(const char *model_buffer, int buffer_length);
svm_save_model_buffer
saves a model to a buffer; returns the written size on success, or -1
if an error occurs.
svm_load_model_buffer
returns a pointer to the model read from the buffer,
or a null pointer if the model could not be loaded.
+1
This also should have a function to request the buffer length for purposes of allocating the buffer, however.