Giter Club home page Giter Club logo

frog's Introduction

frog

The frog library provides the implementation for the two most used types of fuzzy rule bases:

  • Mamdani: the outputs of the rules are fuzzy sets
  • TSK: the outputs of the rules are linear combinations of the inputs

The library is focused on real-valued systems, but categorical data, such as classification problems, can be simulated with natural numbers.

Only one-labeled (i.e. only one fuzzy set) propositions are supported, with two different implementations:

  • Linguitisc: a general definition of the fuzzy sets that partitions the variables is used to indicate the label
  • Approximative: the definition of the label must be provided specifically for each proposition

Installation

To use the frog library you can use JitPack adding the following repository to the pom.xml:

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository

and add this dependency for the last commit:

<dependency>
    <groupId>com.github.citiususc</groupId>
    <artifactId>frog</artifactId>
    <version>e41dda8</version>
</dependency>

For other dependency systems, please read the JitPack documentation.

Export/Import

frog uses SnakeYAML for export/import to/from files using YAML format.

Quick Example

The following code is part of the tests provided in the library:

// DataBase definition
Variable[] inputs = new Variable[2];
inputs[0] = new Variable("input1", 0, 10);
inputs[0].partition = PartitionBuilder.uniform(inputs[0], 2);
inputs[1] = new Variable("input2", -5, 5);
inputs[1].partition = PartitionBuilder.uniform(inputs[1], 2);
Variable[] outputs = new Variable[1];
outputs[0] = new Variable("output", -50, 50);
DataBase db = new DataBase(inputs, outputs);

// RuleBase definition
RuleBase<TSKRule> rb = new RuleBase<>();
for (int i = 0; i < inputs[0].partition.size(); i++) {
    for (int j = 0; j < inputs[1].partition.size(); j++) {
        List<LinguisticLabelProposition> antecedents = new ArrayList<>();
        antecedents.add(new LinguisticLabelProposition(0, i));
        antecedents.add(new LinguisticLabelProposition(1, j));
        List<double[]> consequents = new ArrayList<>();
        consequents.add(new double[]{i, j, 0.2});
        rb.add(new TSKRule(antecedents, consequents));
    }
}

// Knowledge Base definition
KnowledgeBase<TSKRule> kb = new KnowledgeBase<>(db, rb);

// Inference
double[] input = new double[]{2, 0};
TSKInference.inference(this.kb, input);

License

The frog library is licensed under the Apache 2 license, quoted below.

Copyright 2013 Centro de Investigación en Tecnoloxías da Información (CITIUS),
University of Santiago de Compostela (USC).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

frog's People

Contributors

dachafra avatar pablormier avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.