LIBIRWLS
IOStructures.h File Reference

Input and Output structures and procedures. More...

#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  properties
 Training parameters of the IRWLS procedures. More...
 
struct  predictProperties
 Testing parameters of the IRWLS procedures. More...
 
struct  model
 It represents a trained model that has been obtained using PIRWLS or PSIRWLS. More...
 
struct  svm_sample
 A single feature of a data. More...
 
struct  svm_dataset
 A dataset. More...
 

Typedefs

typedef struct properties properties
 Training parameters of the IRWLS procedures. More...
 
typedef struct predictProperties predictProperties
 Testing parameters of the IRWLS procedures. More...
 
typedef struct model model
 It represents a trained model that has been obtained using PIRWLS or PSIRWLS. More...
 
typedef struct svm_sample svm_sample
 A single feature of a data. More...
 
typedef struct svm_dataset svm_dataset
 A dataset. More...
 

Functions

void freeDataset (svm_dataset data)
 Free dataset memory. More...
 
void freeModel (model modelo)
 Free model memory. More...
 
svm_dataset readTrainFile (char filename[])
 It reads a file that contains a labeled dataset in libsvm format. More...
 
svm_dataset readUnlabeledFile (char filename[])
 It reads a file that contains an unlabeled dataset in libsvm format. More...
 
void storeModel (model *mod, FILE *Output)
 It stores a trained model into a file. More...
 
void readModel (model *mod, FILE *Input)
 It loads a trained model from a file. More...
 
void writeOutput (char fileoutput[], double *predictions, int size)
 It writes the content of a double array into a file. More...
 

Detailed Description

Input and Output structures and procedures.

Author
Roberto Diaz Morales
Date
23 Aug 2016 Input and Output structures and procedures.

Typedef Documentation

§ model

typedef struct model model

It represents a trained model that has been obtained using PIRWLS or PSIRWLS.

This structures saves all the variables of a trained model needed to classify future data.

§ predictProperties

Testing parameters of the IRWLS procedures.

This struct stores the testing parameters of the IRWLS procedures.

§ properties

typedef struct properties properties

Training parameters of the IRWLS procedures.

This struct stores the training parameters of the IRWLS procedures.

§ svm_dataset

typedef struct svm_dataset svm_dataset

A dataset.

This structure represents a dataset, a collection of samples and its associated labels.

§ svm_sample

typedef struct svm_sample svm_sample

A single feature of a data.

This structure represents a single feature of a data. It is composed of a features index and its value.

Function Documentation

§ freeDataset()

void freeDataset ( svm_dataset  data)

Free dataset memory.

Free memory allocated by a dataset.

Parameters
dataThe dataset

§ freeModel()

void freeModel ( model  modelo)

Free model memory.

Free memory allocated by a model.

Parameters
dataThe model

§ readModel()

void readModel ( model mod,
FILE *  Input 
)

It loads a trained model from a file.

It loads a trained model (that has been obtained using PIRWLS or PSIRWLS) from a file.

Parameters
modThe pointer with the struct to load results.
InputThe name of the file.

§ readTrainFile()

svm_dataset readTrainFile ( char  filename[])

It reads a file that contains a labeled dataset in libsvm format.

It reads a file that contains a labeled dataset in libsvm format, the format is the following one: +1 1:5 7:2 15:6 +1 1:5 7:2 15:6 23:1 -1 2:4 3:2 10:6 11:4 ...

Parameters
filenameA string with the name of the file that contains the dataset.
Returns
The struct with the dataset information.

§ readUnlabeledFile()

svm_dataset readUnlabeledFile ( char  filename[])

It reads a file that contains an unlabeled dataset in libsvm format.

It reads a file that contains an unlabeled dataset in libsvm format. The format si the following one: 1:5 7:2 15:6 1:5 7:2 15:6 23:1 2:4 3:2 10:6 11:4 ...

Parameters
filenameA string with the name of the file that contains the dataset.
Returns
The struct with the dataset information.

§ storeModel()

void storeModel ( model mod,
FILE *  Output 
)

It stores a trained model into a file.

It stores the struct of a trained model (that has been obtained using PIRWLS or PSIRWLS) into a file.

Parameters
modThe struct with the model to store.
OutputThe name of the file.

§ writeOutput()

void writeOutput ( char  fileoutput[],
double *  predictions,
int  size 
)

It writes the content of a double array into a file.

It writes the content of a double array into a file. It is used to save the predictions of a model on a dataset.

Parameters
fileoutputThe name of the file.
predictionsThe array with the information to save.
sizeThe length of the array.