LIBIRWLS
IOStructures.h
Go to the documentation of this file.
1 /*
2  ============================================================================
3  Author : Roberto Diaz Morales
4  ============================================================================
5 
6  Copyright (c) 2016 Roberto Díaz Morales
7 
8  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
9  (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
10  publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
11  subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 
15  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 
20  ============================================================================
21  */
22 
33 #ifndef IOSTRUCTURES_
34 #define IOSTRUCTURES_
35 
36 #include <stdio.h>
37 
44 typedef struct properties{
45  double Kgamma;
46  int kernelType;
47  double C;
48  int Threads;
49  int MaxSize;
50  int size;
51  int algorithm;
52  double Eta;
53 }properties;
54 
55 
62 typedef struct predictProperties{
63  int Labels;
64  int Threads;
65  int Soft;
67 
68 
75 typedef struct model{
76  double Kgamma;
77  int kernelType;
78  int sparse;
79  int nSVs;
80  int nElem;
81  double *weights;
82  struct svm_sample **x;
83  double *quadratic_value;
84  int maxdim;
85  double bias;
86  struct svm_sample* features;
87 }model;
88 
89 
96 typedef struct svm_sample{
97  int index;
98  double value;
99 }svm_sample;
100 
101 
108 typedef struct svm_dataset{
109  int l;
110  int sparse;
111  int maxdim;
112  double *y;
113  struct svm_sample **x;
114  double *quadratic_value;
116 }svm_dataset;
117 
125 void freeDataset (svm_dataset data);
126 
134 void freeModel (model modelo);
135 
149 svm_dataset readTrainFile(char filename[]);
150 
151 
165 svm_dataset readUnlabeledFile(char filename[]);
166 
167 
176 void storeModel(model * mod, FILE *Output);
177 
186 void readModel(model * mod, FILE *Input);
187 
188 
198 void writeOutput (char fileoutput[], double *predictions, int size);
199 
200 #endif
201 
struct model model
It represents a trained model that has been obtained using PIRWLS or PSIRWLS.
double * quadratic_value
Definition: IOStructures.h:114
double * quadratic_value
Definition: IOStructures.h:83
double Eta
Definition: IOStructures.h:52
int kernelType
Definition: IOStructures.h:77
A dataset.
Definition: IOStructures.h:108
int nElem
Definition: IOStructures.h:80
int kernelType
Definition: IOStructures.h:46
int index
Definition: IOStructures.h:97
void freeModel(model modelo)
Free model memory.
double * weights
Definition: IOStructures.h:81
int l
Definition: IOStructures.h:109
double bias
Definition: IOStructures.h:85
struct properties properties
Training parameters of the IRWLS procedures.
It represents a trained model that has been obtained using PIRWLS or PSIRWLS.
Definition: IOStructures.h:75
int Soft
Definition: IOStructures.h:65
int nSVs
Definition: IOStructures.h:79
int algorithm
Definition: IOStructures.h:51
void writeOutput(char fileoutput[], double *predictions, int size)
It writes the content of a double array into a file.
double * y
Definition: IOStructures.h:112
struct svm_dataset svm_dataset
A dataset.
struct svm_sample ** x
Definition: IOStructures.h:113
double Kgamma
Definition: IOStructures.h:45
struct svm_sample * features
Definition: IOStructures.h:86
struct predictProperties predictProperties
Testing parameters of the IRWLS procedures.
double value
Definition: IOStructures.h:98
int maxdim
Definition: IOStructures.h:111
Training parameters of the IRWLS procedures.
Definition: IOStructures.h:44
int maxdim
Definition: IOStructures.h:84
int sparse
Definition: IOStructures.h:110
struct svm_sample svm_sample
A single feature of a data.
void freeDataset(svm_dataset data)
Free dataset memory.
double C
Definition: IOStructures.h:47
struct svm_sample ** x
Definition: IOStructures.h:82
int Labels
Definition: IOStructures.h:63
int sparse
Definition: IOStructures.h:78
int Threads
Definition: IOStructures.h:64
svm_dataset readTrainFile(char filename[])
It reads a file that contains a labeled dataset in libsvm format.
struct svm_sample * features
Definition: IOStructures.h:115
Testing parameters of the IRWLS procedures.
Definition: IOStructures.h:62
void storeModel(model *mod, FILE *Output)
It stores a trained model into a file.
A single feature of a data.
Definition: IOStructures.h:96
int size
Definition: IOStructures.h:50
double Kgamma
Definition: IOStructures.h:76
void readModel(model *mod, FILE *Input)
It loads a trained model from a file.
int Threads
Definition: IOStructures.h:48
int MaxSize
Definition: IOStructures.h:49
svm_dataset readUnlabeledFile(char filename[])
It reads a file that contains an unlabeled dataset in libsvm format.