Skip to content
Advertisement

How to create Fuzzy Logic rules or model in Java

I have been given a new task in my new job, basically, I have to create a “model” to predict future data. I have been told Fuzzy Logic is the best way to do this, and I use Java almost every day, so I would prefer to use it here too.

I have searched for information about Fuzzy Logic and I roughly understand what it is and how it works (Here and Here).

I also have searched for APIs that can help me with this (For example, JFuzzyLogic and JFuzzyLite), but none of this seem to be able to do what I want (Or maybe it is me that I have no idea what I am searching for).

My idea is to dinamically generate “rules” (which together would make a model) based on the data I have. (I have data with different outcomes, this model would tell me if new data belongs to one outcome or another, basic prediction).

Am I approaching the problem in the correct way? Does any Java API have this functionalities?

Please, tell me if I am wrong, I want to learn as much as possible.

Thank you all for reading this (You might need to correct my english mistakes, sorry for that).

EDIT (More information): My data is stored in excels, each has about 5000 rows and 75 columns (column number always the same):

  • All useful values are numbers (float) (I filter the rest).
  • Each row is the data for an specific piece and each column is an attribute (lenght, width, height….and 67 more) .
  • The last column is a code (also float) that says what type of piece it is
    • This is the outcome I want to predict. The idea is to predict what code a piece will have based on the other column values.

Advertisement

Answer

It looks like a standard regression problem. You want to predict a number from the values of other numbers.

Let’s call your last column is Y, and all the others X_i. You want to find a function (your model) that gives you Y based on X. So Y = f(X). Your model can take many form. You should probably start with the simplest one, which is a linear model.

Linear regression will try to find the best W_i such that :

Y = W_0 * X_0 + W_1 * X_1 + … + W_n * X_n

So what you need is a regression library in Java. A popular one is WEKA, which has a good linear regression class.

Concerning fuzzy logic, I’m not an expert but it doesn’t seem very well suited to your problem.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement