omadson / fuzzy-c-means

A simple python implementation of Fuzzy C-means algorithm.
https://fuzzy-c-means.rtfd.io
MIT License
175 stars 43 forks source link

Error to run fcm fit on CLI #39

Closed GussSoares closed 3 years ago

GussSoares commented 3 years ago

hi, @omadson.

First of all, congratulations to your work.

I'm trying to use the CLI to fit a model on the example on the sample of README.

I just create a virtualenv and install the library. After that, I start the python REPL and type this lines:

import numpy as np

n_samples = 3000

X = np.concatenate((
    np.random.normal((-2, -2), size=(n_samples, 2)),
    np.random.normal((2, 2), size=(n_samples, 2))
))
np.savetxt("data.csv", X, delimiter=",")

After save the dataset file, I tried to use this command:

fcm fit data.csv

And I receive the following traceback:

Reading data set... Data set read without errors...
Traceback (most recent call last):
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/bin/fcm", line 8, in <module>
    sys.exit(app())
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "/home/gustavo/.cache/pypoetry/virtualenvs/teste-fuzzy-Pa30dWmR-py3.8/lib/python3.8/site-packages/fcmeans/cli.py", line 118, in fit
    model = FCM(n_clusters, max_iter, m, error, random_state)
  File "pydantic/main.py", line 397, in pydantic.main.BaseModel.__init__
TypeError: __init__() takes exactly 1 positional argument (6 given)

I'm using Python 3.8.10 on a Manjaro 5.12.19.

Can you help me on this issue?

omadson commented 3 years ago

Hi, @GussSoares.

I gess it's because of pydantic. I'm solving this bug and pushing a new release.

Thanks for your feedback.