#include <stdio.h>
Go to the source code of this file.
Functions | |
int | lwpr_write_binary (const LWPR_Model *model, const char *filename) |
Writes an LWPR model to a file. | |
int | lwpr_read_binary (LWPR_Model *model, const char *filename) |
Reads an LWPR model from a binary file. | |
int | lwpr_write_binary_fp (const LWPR_Model *model, FILE *fp) |
Writes an LWPR model to a file. | |
int | lwpr_read_binary_fp (LWPR_Model *model, FILE *fp) |
Reads an LWPR model from a binary file. | |
int | lwpr_io_write_matrix (FILE *fp, int M, int Ms, int N, const double *data) |
Writes a matrix of doubles into a binary file. | |
int | lwpr_io_read_matrix (FILE *fp, int M, int Ms, int N, double *data) |
Reads a matrix of doubles from a binary file. | |
int | lwpr_io_write_vector (FILE *fp, int N, const double *data) |
Writes a vector of doubles into a binary file. | |
int | lwpr_io_read_vector (FILE *fp, int N, double *data) |
Reads a vector of doubles from a binary file. | |
int | lwpr_io_write_scalar (FILE *fp, double data) |
Writes a scalar (double) into a binary file. | |
int | lwpr_io_read_scalar (FILE *fp, double *data) |
Reads a scalar (double) from a binary file. | |
int | lwpr_io_write_int (FILE *fp, int data) |
Writes an integer into a binary file. | |
int | lwpr_io_read_int (FILE *fp, int *data) |
Reads an integer from a binary file. | |
int | lwpr_io_write_rf (FILE *fp, const LWPR_ReceptiveField *RF) |
Writes a receptive field structure into a binary file. | |
int | lwpr_io_read_rf (FILE *fp, LWPR_SubModel *sub) |
Reads a receptive field structure from a binary file. |
This header file describes routines for reading and writing LWPR models from and to binary files. Please note that these functions assume that the models are stored and loaded on the same machine architecture (i.e. endianness, word length), and NO conversion is done. If you need to exchange LWPR models across different architectures, use the routines in lwpr_xml.h
The file format is as follows:
Element description | Size of element |
---|---|
"LWPR" | 4 bytes |
BINIO version | 1 integer (negative since LWPR 1.1) |
nIn | 1 integer |
nIn | 1 integer |
nOut | 1 integer |
kernel | 1 integer |
length of 'name' string (may be 0) | integer |
name of the model | nr. of bytes as determined by previous integer |
n_data | 1 integer |
mean_x | nIn doubles |
var_x | nIn doubles |
diag_only | 1 integer |
update_D | 1 integer (was not present in LWPR 1.0 due to a bug) |
meta | 1 integer |
meta_rate | 1 double |
penalty | 1 double |
init_alpha | nIn*nIn doubles |
norm_in | nIn doubles |
norm_out | nOut doubles |
init_D | nIn*nIn doubles |
init_M | nIn*nIn doubles |
w_gen | 1 double |
w_prune | 1 double |
init_lambda | 1 double |
final_lambda | 1 double |
tau_lambda | 1 double |
init_S2 | 1 double |
add_threshold | 1 double |
Element description | Size of element |
---|---|
"SUBM" | 4 bytes |
output dimension | 1 integer |
number of RFs | 1 integer |
nr. of pruned RFs | 1 integer |
Element description | Size of element |
---|---|
"[RF]" | 4 bytes |
nReg | 1 integer |
D | 1 nIn*nIn doubles |
M | 1 nIn*nIn doubles |
alpha | 1 nIn*nIn doubles |
beta0 | 1 double |
beta | nReg doubles |
c | nIn doubles |
SXresYres | nIn*nReg doubles |
SSs2 | nReg doubles |
SSYres | nReg doubles |
SSXres | nIn*nReg doubles |
U | nIn*nReg doubles |
P | nIn*nReg doubles |
H | nReg doubles |
r | nReg doubles |
h | nIn*nIn doubles |
b | nIn*nIn doubles |
sum_w | nReg doubles |
sum_e_cv2 | nReg doubles |
sum_e2 | 1 double |
SSp | 1 double |
n_data | nReg doubles |
trustworthy | 1 integer |
lambda | nReg doubles |
mean_x | nIn doubles |
var_x | nIn doubles |
w | 1 double |
s | nReg doubles |
LWPR...model globals...SUBM...output dim. 0...[RF]...RF 0/0...[RF]...RF 0/1...[RF]...RF 0/2...further receptive fields...SUBM...output dim. 1...[RF]...RF 1/0...[RF]...RF 1/1...further receptive fields...SUBM...output dim. 2...[RF]...RF 2/0...[RF]...RF 2/1...further receptive fields...further sub-models (output dimensions)...RPWL
|
Reads an integer from a binary file.
|
|
Reads a matrix of doubles from a binary file.
|
|
Reads a receptive field structure from a binary file.
|
|
Reads a scalar (double) from a binary file.
|
|
Reads a vector of doubles from a binary file.
|
|
Writes an integer into a binary file.
|
|
Writes a matrix of doubles into a binary file.
|
|
Writes a receptive field structure into a binary file.
|
|
Writes a scalar (double) into a binary file.
|
|
Writes a vector of doubles into a binary file.
|