GithubHelp home page GithubHelp logo

gregorlen / anfistensorflow2.0 Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 16.0 9.44 MB

This is an implementation of Adaptive-Network-Based Fuzzy Inference System (ANFIS) based on Keras on top of Tensorflow 2.0.

License: MIT License

Python 100.00%

anfistensorflow2.0's People

Contributors

dependabot[bot] avatar gregorlen 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

Watchers

 avatar  avatar  avatar

anfistensorflow2.0's Issues

Prediction issue

Hi Gregor. I ran into error trying to make prediction on Mackey-Glass time series.

y_pred = fis(X)

I ran a code from examples and got:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-26-c4f5faf6ff99> in <module>()
     27 fis.model.summary()
     28 
---> 29 y_pred = fis(X)
     30 
     31 # f, axs = plt.subplots(2,1,figsize=(8,10))

2 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
   1127           except Exception as e:  # pylint:disable=broad-except
   1128             if hasattr(e, "ag_error_metadata"):
-> 1129               raise e.ag_error_metadata.to_exception(e)
   1130             else:
   1131               raise

ValueError: in user code:

    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1621, in predict_function  *
        return step_function(self, iterator)
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1611, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1604, in run_step  **
        outputs = model.predict_step(data)
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1572, in predict_step
        return self(x, training=False)
    File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
        raise e.with_traceback(filtered_tb) from None

    ValueError: Exception encountered when calling layer "defuzzLayer" (type DefuzzyLayer).
    
    in user code:
    
        File "<ipython-input-16-5fe3aebfbcaa>", line 33, in call  *
            print(tf.multiply(w_norm, a + self.CP_bias))
    
        ValueError: Dimensions must be equal, but are 16 and 32 for '{{node myanfis/defuzzLayer/Mul}} = Mul[T=DT_FLOAT](myanfis/normLayer/truediv, myanfis/defuzzLayer/add)' with input shapes: [16,25], [32,25].
    
    
    Call arguments received:
      • w_norm=tf.Tensor(shape=(16, 25), dtype=float32)
      • Xs=tf.Tensor(shape=(32, 2), dtype=float32)

Cold you please help to solve that issue.
My Colab is here

Prediction Error

Hello Gregor, i got this error while i'm trying to predict the result using fis.model.predict(X)

Input to reshape is a tensor with 32 values, but the requested shape has 1
[[{{node myanfis/sumLayer/Reshape}}]] [Op:__inference_predict_function_154498]

May i know why? And what should i do regarding this matter? Thank you!

Problem in training

i have stock data and try to predict it with anfis, and I got problem in InvalidArgumentError: slice index 15 of dimension 0 out of bounds. [[{{node ruleLayer_2/strided_slice_15}}]] when fit the model, I have 900 row with 1 column for data training and 96 with 1 column in data test

Fit Problem

Dear Gregor,

I hope this email finds you well, first of all, thank you so much for sharing your code on GitHub. I have a problem working with it. I have 3 inputs and 1 output, and it gives the below error:

`/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
53 ctx.ensure_initialized()
54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 55 inputs, attrs, num_outputs)
56 except core._NotOkStatusException as e:
57 if name is not None:

Incompatible shapes: [16,1] vs. [15,1]`

I found that 16 is my batch size and when I change it, this number changes.

(I found a solution and the solution is batch_size=1) which is SGD

Thank you in advance

Kind regards

Hamed

Prediction Error

Hello,

I have a problem with the prediction section, would you please guide me. in the below code I have got the error.

y_pred = fis.model.predict(X_test)

Error:
InvalidArgumentError: Graph execution error:

Input to reshape is a tensor with 32 values, but the requested shape has 1
[[{{node myanfis/sumLayer/Reshape}}]] [Op:__inference_predict_function_68010]

Thank you in advance

How to deal with multiple inputs using the AnfisTensorflow2.0

Hello,

How to deal with multiple inputs using this anfis? I have 8 variables as the inputs to predict one output, but the run.py gives an error that is "This ANFIS implementation works with 2 to 6 inputs", so how to deal with this issue, please give some suggestions, thanks.

Future prediction

We can predict the data we have. So how do we predict for the future?

Graph execution Error

Hello,

I have a problem with the training section, would you please guide me. in the below code I have got the error.

y_pred = fis.model.fit(X_train, y_train,
epochs=param.n_epochs,
batch_size=param.batch_size,
validation_data=(X_test, y_test),
callbacks=[tensorboard_callback])

Error:
InvalidArgumentError: Graph execution error:

Node: 'myanfis/ruleLayer/Reshape_1'
Input to reshape is a tensor with 104 values, but the requested shape requires a multiple of 16
[[{{node myanfis/ruleLayer/Reshape_1}}]] [Op:__inference_train_function_2861]

Thank you in advance

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.