Skip to content

Commit

Permalink
reworked package so that it allows for parallel model selection
Browse files Browse the repository at this point in the history
  • Loading branch information
dariomalchiodi committed Oct 9, 2024
1 parent f48d9db commit e162d4d
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 685 deletions.
9 changes: 5 additions & 4 deletions mulearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
from sklearn.utils import check_random_state

from mulearn.fuzzifier import ExponentialFuzzifier
import mulearn.fuzzifier as fuzzifier
import mulearn.kernel as kernel
from mulearn.optimization import GurobiSolver

Expand All @@ -19,13 +19,14 @@
warnings.filterwarnings("ignore", category=OptimizeWarning)
warnings.filterwarnings("ignore", category=FitFailedWarning)


class FuzzyInductor(BaseEstimator, RegressorMixin):
"""FuzzyInductor class."""

def __init__(self,
c=1,
k=kernel.GaussianKernel(),
fuzzifier=ExponentialFuzzifier(), # noqa
fuzzifier=fuzzifier.ExponentialFuzzifier(),
solver=GurobiSolver(),
random_state=None):
r"""Create an instance of :class:`FuzzyInductor`.
Expand Down Expand Up @@ -68,7 +69,7 @@ def x_to_sq_dist(self, X_new):
ret = t1 -2 * t2 + self.fixed_term_
return ret

def fit(self, X, y, warm_start=False, profile='fixed'):
def fit(self, X, y, warm_start=False):
r"""Induce the membership function starting from a labeled sample.
:param X: Vectors in data space.
Expand Down Expand Up @@ -126,7 +127,7 @@ def fit(self, X, y, warm_start=False, profile='fixed'):

self.fuzzifier.sq_radius_05 = np.mean(chi_sq_radius)
self.fuzzifier.fit(self.x_to_sq_dist(X), y,
np.mean(chi_sq_radius), profile=profile)
np.mean(chi_sq_radius))

return self

Expand Down
Loading

0 comments on commit e162d4d

Please sign in to comment.