#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include "image.h"
#include "proto2D.h"
#include "gradual_rules_learning.h"
#include "classifier.h"
Go to the source code of this file.
Functions | |
double | minim (double a, double b) |
double | maxim (double a, double b) |
int | sum (int i, lgr_d id) |
int | intersch (double *a, double *b) |
double | semn (double a) |
param * | learning_gradual_rules_lect (lgr_d *a, param *ptp, char *debq) |
int | learning_gradual_rules_init (lgr_d *id) |
double | isleft (elem_contour *p, elem_contour *q) |
elem_contour * | conv_hull (elem_contour *first) |
elem_contour * | contour_extraction (learning_set iris, int start, int stop, int att1, int att2) |
int | rules_calc (elem_contour *first, lgr_d *id) |
int | learning_set_process (learning_set ls, lgr_d *id, int class) |
int | learning_gradual_rules_calc (lgr_d *id) |
int | main (int argc, char *argv[]) |
elem_contour* contour_extraction | ( | learning_set | iris, | |
int | start, | |||
int | stop, | |||
int | att1, | |||
int | att2 | |||
) |
Given a learning set this function obtains its contour, meaning the extremum points. The result is a double-chained list containing the coordinates (attributes) of these points.
Definition at line 303 of file lgradual_rules_learning.c.
References elem_contour::ant, data_input::attributes, conv_hull(), reference_set::input_ref, elem_contour::next, elem_contour::x, and elem_contour::y.
Referenced by convex_verif(), and learning_set_process().
elem_contour* conv_hull | ( | elem_contour * | first | ) |
The conv_hull function calculates the convex hull of a learning set. It takes as argument the double-chained list containing the points which form the contour of the points cloud. The double-chained list that it returns contains the points in anti-trigonometrical order
Definition at line 187 of file lgradual_rules_learning.c.
References elem_contour::ant, intersch(), isleft(), elem_contour::next, elem_contour::x, and elem_contour::y.
Referenced by contour_extraction().
int intersch | ( | double * | a, | |
double * | b | |||
) |
Definition at line 52 of file lgradual_rules_learning.c.
Referenced by competitive_agglomeration(), and conv_hull().
double isleft | ( | elem_contour * | p, | |
elem_contour * | q | |||
) |
Definition at line 177 of file lgradual_rules_learning.c.
References elem_contour::next, elem_contour::x, and elem_contour::y.
Referenced by conv_hull(), and rules_calc().
int learning_gradual_rules_calc | ( | lgr_d * | id | ) |
Definition at line 575 of file lgradual_rules_learning.c.
References alloc_classifier_data_input_completely(), alloc_classifier_data_output(), data_input::attributes, CRISP_CHOICE, lgr_d::fisin, lgr_d::fisout1, lgr_d::fisout2, free_data_input(), free_data_output(), reference_set::input_ref, learning_set_process(), lgr_d::nb_attr, data_input::nb_attr, data_output::nb_class, lgr_d::nb_class, data_output::nb_pts, data_input::nb_pts, lgr_d::nb_pts, reference_set::output_ref, and data_output::type.
Referenced by main().
int learning_gradual_rules_init | ( | lgr_d * | id | ) |
the function learning_gradual_rules_init makes the dynamic allocation of the variables that will contain the results of the procedures
Definition at line 165 of file lgradual_rules_learning.c.
References lgr_d::isProcessed, and lgr_d::nb_class.
Referenced by main().
param* learning_gradual_rules_lect | ( | lgr_d * | a, | |
param * | ptp, | |||
char * | debq | |||
) |
the functionalities of the learning_gradual_rules_lect: The parameters that it requires are:
Func_name is a string that will be used by the classification application in order to identify the membership function Func_type is, at this moment, a number between 0 and 5 which defines the form of the membership function and indicates if the values are necessary or not:
0: a constant membership function, it will return 0 all along the universe of discourse 1: similar to 0, but will return 1 ___ 2: linear function with the form ___/ , it streches from 0 to 1 and requires 2 values which define it (the values on x-axis)
___ 3: linear function with the form , it streches from 0 to 1 and requires 2 values which define it
____ 4: linear function with the form __| |__, it streches from 0 to 1 and requires 2 values which define it
__ __ 5: linear function with the form |____| , it streches from 0 to 1 and requires 2 values which define it
These membership functions have a name-grouping that should be obvious just from looking at the names of the functions, so that the final rules will be obtained by associating the corresponding rules for every of the two attributes (pay attention to the order!) and placing at the end of the line the class that they define and the membership degree that they induce to this class (unless graduality is involved, this should be 1). For example, a natural deducted rule can be:
A0 B0 C1 1 --> meaning that the mebership degree of the first attribute given by the mebership function A0 combined (the combination which is given by the premise operator) with the membership degree of the second attribute given by the mebership function B0 gives a membership of 1 to the class C1
Definition at line 103 of file lgradual_rules_learning.c.
References lgr_d::fisin, lgr_d::fisout1, lgr_d::fisout2, lgr_d::isProcessed, lgr_d::nb_attr, lgr_d::nb_class, and lgr_d::nb_pts.
Referenced by main().
int learning_set_process | ( | learning_set | ls, | |
lgr_d * | id, | |||
int | class | |||
) |
Definition at line 504 of file lgradual_rules_learning.c.
References data_input::attributes, contour_extraction(), lgr_d::fisout1, lgr_d::fisout2, reference_set::input_ref, data_input::nb_attr, data_output::nb_class, lgr_d::nb_pts, elem_contour::next, reference_set::output_ref, rules_calc(), elem_contour::x, and elem_contour::y.
Referenced by learning_gradual_rules_calc().
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 703 of file lgradual_rules_learning.c.
References learning_gradual_rules_calc(), learning_gradual_rules_init(), and learning_gradual_rules_lect().
double maxim | ( | double | a, | |
double | b | |||
) |
double minim | ( | double | a, | |
double | b | |||
) |
Definition at line 30 of file lgradual_rules_learning.c.
Referenced by competitive_agglomeration(), dmin(), and val_min().
int rules_calc | ( | elem_contour * | first, | |
lgr_d * | id | |||
) |
rules_calc calculates the membership functions that will define the rules to be used in order to obtain the current class. It will result in 2 rules (4 membership functions) that reduce the universe of discourse to the smallest quadrangle that contains the convex hull and [N-4, N] rules (*2 membership functions of type 2-3), where N is the number of sides of the convex hull
Definition at line 404 of file lgradual_rules_learning.c.
References lgr_d::fisout1, lgr_d::fisout2, isleft(), elem_contour::next, elem_contour::x, and elem_contour::y.
Referenced by learning_set_process().
double semn | ( | double | a | ) |
Definition at line 60 of file lgradual_rules_learning.c.
int sum | ( | int | i, | |
lgr_d | id | |||
) |
Definition at line 44 of file lgradual_rules_learning.c.
Referenced by process_chain(), and traitement_donnees_calc().