Soletta machine learning
Machine learning for IoT devices
 All Data Structures Files Functions Typedefs Enumerations Enumerator Groups Pages
sml_fuzzy.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 #include <sml.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
39 #define SML_TERM_NAME_MAX_LEN (127)
47 enum sml_fuzzy_snorm {
56 };
72 };
89 };
106 struct sml_fuzzy_term;
119 struct sml_object *sml_fuzzy_new(void);
120 
128 bool sml_is_fuzzy(struct sml_object *sml);
129 
136 bool sml_fuzzy_supported(void);
137 
157 bool sml_fuzzy_conjunction_set(struct sml_object *sml, enum sml_fuzzy_tnorm norm);
158 
183 bool sml_set_rule_weight_threshold(struct sml_object *sml, float weight_threshold);
184 
205 bool sml_fuzzy_output_set_defuzzifier(struct sml_object *sml, struct sml_variable *sml_variable, enum sml_fuzzy_defuzzifier defuzzifier, int defuzzifier_resolution);
206 
225 bool sml_fuzzy_output_set_accumulation(struct sml_object *sml, struct sml_variable *sml_variable, enum sml_fuzzy_snorm accumulation);
226 
291 bool sml_fuzzy_variable_set_default_term_width(struct sml_object *sml, struct sml_variable *sml_variable, float width);
292 
302 
319 bool sml_fuzzy_variable_set_is_id(struct sml_object *sml, struct sml_variable *sml_variable, bool is_id);
320 
332 
351 struct sml_fuzzy_term *sml_fuzzy_variable_add_term_rectangle(struct sml_object *sml, struct sml_variable *variable, const char *name, float start, float end);
352 
375 struct sml_fuzzy_term *sml_fuzzy_variable_add_term_triangle(struct sml_object *sml, struct sml_variable *variable, const char *name, float vertex_a, float vertex_b, float vertex_c);
376 
394 struct sml_fuzzy_term *sml_fuzzy_variable_add_term_cosine(struct sml_object *sml, struct sml_variable *variable, const char *name, float center, float width);
395 
413 struct sml_fuzzy_term *sml_fuzzy_variable_add_term_gaussian(struct sml_object *sml, struct sml_variable *variable, const char *name, float mean, float standard_deviation);
414 
443 struct sml_fuzzy_term *sml_fuzzy_variable_add_term_ramp(struct sml_object *sml, struct sml_variable *variable, const char *name, float start, float end);
444 
460 bool sml_fuzzy_set_variable_terms_auto_balance(struct sml_object *sml, bool variable_terms_auto_balance);
461 
471 bool sml_fuzzy_variable_remove_term(struct sml_object *sml, struct sml_variable *variable, struct sml_fuzzy_term *term);
472 
501 bool sml_fuzzy_set_simplification_disabled(struct sml_object *sml, bool disabled);
502 
506 #ifdef __cplusplus
507 }
508 #endif
bool sml_fuzzy_variable_set_default_term_width(struct sml_object *sml, struct sml_variable *sml_variable, float width)
Set the default term width used by fuzzy to create terms.
Definition: sml_fuzzy.h:48
bool sml_fuzzy_conjunction_set(struct sml_object *sml, enum sml_fuzzy_tnorm norm)
Set the conjunction fuzzy rule.
Definition: sml_fuzzy.h:68
bool sml_fuzzy_set_variable_terms_auto_balance(struct sml_object *sml, bool variable_terms_auto_balance)
Set terms autobalance.
struct sml_fuzzy_term * sml_fuzzy_variable_add_term_cosine(struct sml_object *sml, struct sml_variable *variable, const char *name, float center, float width)
Add a cosine term for a variable.
Definition: sml_fuzzy.h:66
Definition: sml_fuzzy.h:69
Definition: sml.h:176
sml_fuzzy_defuzzifier
The types of defuzzifier.
Definition: sml_fuzzy.h:81
Definition: sml_fuzzy.h:88
bool sml_fuzzy_supported(void)
Check if SML was built with fuzzy support.
Definition: sml_fuzzy.h:53
sml_fuzzy_snorm
SNorm rules are also known as accumulation.
Definition: sml_fuzzy.h:47
float sml_fuzzy_variable_get_default_term_width(struct sml_object *sml, struct sml_variable *sml_variable)
Get the default term width used by fuzzy to create terms.
Definition: sml_fuzzy.h:50
struct sml_fuzzy_term * sml_fuzzy_variable_add_term_gaussian(struct sml_object *sml, struct sml_variable *variable, const char *name, float mean, float standard_deviation)
Add a gaussian term for a variable.
Definition: sml_fuzzy.h:85
Definition: sml_fuzzy.h:87
Definition: sml_fuzzy.h:70
struct sml_object * sml_fuzzy_new(void)
Creates a SML fuzzy engine.
Definition: sml_fuzzy.h:67
bool sml_fuzzy_variable_set_is_id(struct sml_object *sml, struct sml_variable *sml_variable, bool is_id)
Check if this variable is used as an id field.
bool sml_fuzzy_output_set_accumulation(struct sml_object *sml, struct sml_variable *sml_variable, enum sml_fuzzy_snorm accumulation)
Set the output accumulation.
Definition: sml_fuzzy.h:54
bool sml_fuzzy_variable_remove_term(struct sml_object *sml, struct sml_variable *variable, struct sml_fuzzy_term *term)
Remove a fuzzy term from the engine.
Definition: sml_fuzzy.h:49
struct sml_fuzzy_term * sml_fuzzy_variable_add_term_triangle(struct sml_object *sml, struct sml_variable *variable, const char *name, float vertex_a, float vertex_b, float vertex_c)
Add a triangle term for a variable.
Definition: sml_fuzzy.h:52
bool sml_fuzzy_set_simplification_disabled(struct sml_object *sml, bool disabled)
Disable/Enable simplification.
Definition: sml_fuzzy.h:83
Definition: sml_fuzzy.h:55
Definition: sml_fuzzy.h:82
sml_fuzzy_tnorm
TNorm rules are also known as conjunction.
Definition: sml_fuzzy.h:64
bool sml_is_fuzzy(struct sml_object *sml)
Check if the SML object is a fuzzy engine.
struct sml_fuzzy_term * sml_fuzzy_variable_add_term_rectangle(struct sml_object *sml, struct sml_variable *variable, const char *name, float start, float end)
Add a rectangle term for a variable.
bool sml_fuzzy_output_set_defuzzifier(struct sml_object *sml, struct sml_variable *sml_variable, enum sml_fuzzy_defuzzifier defuzzifier, int defuzzifier_resolution)
Set the defuzzifier for an output variable.
bool sml_set_rule_weight_threshold(struct sml_object *sml, float weight_threshold)
Rules below a given value will be ignored.
bool sml_fuzzy_variable_get_is_id(struct sml_object *sml, struct sml_variable *sml_variable)
Check if this variable is used as an id field.
Definition: sml_fuzzy.h:65
Definition: sml_fuzzy.h:51
struct sml_fuzzy_term * sml_fuzzy_variable_add_term_ramp(struct sml_object *sml, struct sml_variable *variable, const char *name, float start, float end)
Add a ramp term for a variable.
Definition: sml_fuzzy.h:71