Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create setup.py so we can have algos used as a library in other projects #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions algorithms/gk.py → fuzzy_clust_algos/gk.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ def next_u(self, d):
return denominator_

def predict(self, z):
u = self.predict_proba(z)
return np.argmax(u, axis=0)

def predict_proba(self, z):
if len(z.shape) == 1:
z = np.expand_dims(z, axis=0)

dist = self._distance(z, self.centers, self.f)
if len(dist.shape) == 1:
dist = np.expand_dims(dist, axis=0)

u = self.next_u(dist)
return np.argmax(u, axis=0)
return self.next_u(dist)
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages


setup(name='fuzzy_clust_algos',
version="1.0",
description='Fuzzy Clustering Algorithms.',
packages=find_packages(),
install_requires=[
'numpy',
'scipy',
],
)
4 changes: 2 additions & 2 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QFileSystemModel

from algorithms.fcm import FCM
from algorithms.gk import GK
from file_path_manager import FilePathManager
from fuzzy_clust_algos.fcm import FCM
from fuzzy_clust_algos.gk import GK

FormClass = uic.loadUiType("ui.ui")[0]

Expand Down