GithubHelp home page GithubHelp logo

tiagocuervo / tensoranfis Goto Github PK

View Code? Open in Web Editor NEW
93.0 93.0 39.0 11 KB

A Tensorflow implementation of the Adaptive Neuro-Based Fuzzy Inference System (ANFIS)

License: MIT License

Python 100.00%
anfis anfis-network computational-intelligence fuzzy-inference-system fuzzy-logic neural-networks tensorflow time-series-forecasting time-series-prediction

tensoranfis's People

Contributors

dependabot[bot] avatar tiagocuervo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tensoranfis's Issues

Adapt this code to my data

Hi,

I'm trying to adapt your code to my data but i think i am missing something.
Even with simple data like :
inputs : [1, 2, 3, 4], [5, 6, 7, 8]
output : [100], [200]
The results are really bad. I saw that data had to be standardized, but what is the rule? Can you give me an example?
Attached used files.

Thank you in advance.

files.zip

Parameter reuse issue!

Greetings,
I've adapted your code for my simple two-dimensional data set. According to statement below, since the TensorFlow doesn't support the attribute 'placeholder':
AttributeError: module 'tensorflow' has no attribute 'placeholder'
I had to consider disabling v2 behavior via replacing the term import tensorflow as tf with:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

Although it apparently looks compatible, the 'mu' parameter reuse tends to be problematic. Inciting the error below:
Variable mu already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope?
Thus, I've tried to solve this by tf.variable_scope("anfis", reuse=tf.AUTO_REUSE) which didn't work either!!!
Kindly assist me through a feasible solution if you had any ideas.
Yours sincerely

The prediction converges but resulting in same prediction for all the values of chkData?? And how to predict values using the saved model??

I used your code with the sample data having 2 inputs and 1 output(target value) to predict... training ran and it converges as below.


Log:
Train cost after epoch 0: 256.180145
Train cost after epoch 100: 255.096405
Train cost after epoch 200: 254.066574
Train cost after epoch 300: 253.050385
Train cost after epoch 400: 252.039536
Train cost after epoch 500: 251.031601
Train cost after epoch 600: 250.025452
Train cost after epoch 700: 249.020569
Train cost after epoch 800: 248.016602
Train cost after epoch 900: 247.013275
Elapsed time: 1.634994
Validation loss: 532.910950
Model saved in path: /content/model.ckpt
Elapsed time: 1.634994
Elapsed total script execution time: 7.826581


The output of training is as attached as above.
But after this, when I check with the val_pred, it results in the following same values for all the data...!!!

[10.303363 10.303363 10.303364 10.303363 10.303363 10.303363 10.303363]

But the actual value which I gave for the chkLbls is as follows
[437.4 575.5 407.6 682. 475.3 581.3 646.9]

why it is having all values same?? is it correct to have the same value in val_pred after training?

If so, after training, I just saved the tf.session using the following code
save_path = saver.save(sess, "/content/model.ckpt") print("Model saved in path: %s" % save_path)

After saving the model, how can I use it to predict the model using random values of input?? so that I can check whether the model works fine with varied input??

real time set

Hi! Perhaps there is a version with a real time set at the input? Evgeniy

Consequent Parameters?

Where is the Consequent Parameter from the rule?
Is there no Least Square Estimator in this step?

Saving the model?

Is it possible to save the model? What library/function can we use to do so?

I have tried all the following, just after plotting the results, and all give me some kind of error...

    ... 
    # Plot resulting membership functions
        fis.plotmfs(sess)
        plt.show()

    #joblib.dump(fis, "./Models/anfisModel")
    #tf.keras.models.save_model(fis, "./Models/anfisModel")
    #fis.save("./Models/anfisModel")
    
    #import pickle
    #pickle.dump(fis, open("./Models/anfisModel", 'wb'))

    tf.saved_model.save(fis, "./Models/anfisModel")

The last one, for example, returns with the following error:

ValueError: Expected a Trackable object for export, got <anfis.ANFIS object at 0x7f592a99daf0>.

All the others return similar errors like "fis has no save atribute" and so on.
I guess it is because it is not a tensorflow object, but a custom one you create using tf?

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.