Models
Concrete TSK model variants.
All public model classes are re-exported from their respective sub-modules.
ADATSKClassifierModel
Bases: BaseTSKClassifierModel
TSK classifier with adaptive softmin antecedent (ADATSK).
The firing strength of each rule is computed with the Ada-softmin operator.
Reference
G. Xue, Q. Chang, J. Wang, K. Zhang and N. R. Pal, "An Adaptive Neuro-Fuzzy System With Integrated Feature Selection and Rule Extraction for High-Dimensional Classification Problems," in IEEE Transactions on Fuzzy Systems, vol. 31, no. 7, pp. 2167-2181, July 2023, doi: 10.1109/TFUZZ.2022.3220950.
Initialise the ADATSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon for the Ada-softmin operator. |
None
|
zero_consequent_init
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_adaptive.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
ADATSKRegressorModel
Bases: BaseTSKRegressorModel
TSK regressor with adaptive softmin antecedent (ADATSK).
The firing strength of each rule is computed with the Ada-softmin operator.
Reference
G. Xue, Q. Chang, J. Wang, K. Zhang and N. R. Pal, "An Adaptive Neuro-Fuzzy System With Integrated Feature Selection and Rule Extraction for High-Dimensional Classification Problems," in IEEE Transactions on Fuzzy Systems, vol. 31, no. 7, pp. 2167-2181, July 2023, doi: 10.1109/TFUZZ.2022.3220950.
Initialise the ADATSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon for the Ada-softmin operator. |
None
|
zero_consequent_init
|
bool
|
If |
True
|
Source code in highfis/models/_adaptive.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
ADMTSKClassifierModel
Bases: BaseTSKClassifierModel
Adaptive Dombi TSK classifier with Composite Gaussian membership functions.
ADMTSK is an adaptive Dombi TSK fuzzy system designed for high-dimensional inference. It combines a Dombi T-norm antecedent with a positive lower-bound Composite Gaussian membership function (CGMF) and normalized first-order consequents.
Reference
G. Xue, L. Hu, J. Wang and S. Ablameyko, "ADMTSK: A High-Dimensional Takagi-Sugeno-Kang Fuzzy System Based on Adaptive Dombi T-Norm," in IEEE Transactions on Fuzzy Systems, vol. 33, no. 6, pp. 1767-1780, June 2025, doi: 10.1109/TFUZZ.2025.3535640.
Initialize the ADMTSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of membership functions. |
required |
n_classes
|
int
|
Number of output classes. Must be >= 2. |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
t_norm
|
str | TNormFn
|
T-norm name or callable (default |
'dombi'
|
adaptive
|
bool
|
If True, compute adaptive lambda using the feature dimension and membership lower bound. |
True
|
lambda_
|
float
|
Fixed Dombi parameter |
1.0
|
lower_bound
|
float
|
The lower bound for Composite GMF values. |
1.0 / math.e
|
k
|
float
|
Heuristic constant used to compute adaptive lambda. |
10.0
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices for custom rule bases. |
None
|
defuzzifier
|
nn.Module | None
|
Optional defuzzifier module. |
None
|
consequent_batch_norm
|
bool
|
If True, apply batch normalization to consequent inputs. |
False
|
zero_consequent_init
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_dombi.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
ADMTSKRegressorModel
Bases: BaseTSKRegressorModel
Adaptive Dombi TSK regressor with Composite Gaussian membership functions.
ADMTSK is an adaptive Dombi TSK fuzzy system designed for high-dimensional inference. It combines a Dombi T-norm antecedent with a positive lower-bound Composite Gaussian membership function (CGMF) and normalized first-order consequents.
Reference
G. Xue, L. Hu, J. Wang and S. Ablameyko, "ADMTSK: A High-Dimensional Takagi-Sugeno-Kang Fuzzy System Based on Adaptive Dombi T-Norm," in IEEE Transactions on Fuzzy Systems, vol. 33, no. 6, pp. 1767-1780, June 2025, doi: 10.1109/TFUZZ.2025.3535640.
Initialize the ADMTSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of membership functions. |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
t_norm
|
str | TNormFn
|
T-norm name or callable (default |
'dombi'
|
adaptive
|
bool
|
If True, compute adaptive lambda using the feature dimension and membership lower bound. |
True
|
lambda_
|
float
|
Fixed Dombi parameter |
1.0
|
lower_bound
|
float
|
The lower bound for Composite GMF values. |
1.0 / math.e
|
k
|
float
|
Heuristic constant used to compute adaptive lambda. |
10.0
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices for custom rule bases. |
None
|
defuzzifier
|
nn.Module | None
|
Optional defuzzifier module. |
None
|
consequent_batch_norm
|
bool
|
If True, apply batch normalization to consequent inputs. |
False
|
zero_consequent_init
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_dombi.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
ADPTSKClassifierModel
Bases: BaseTSKClassifierModel
TSK classifier with adaptive double-parameter softmin antecedent (ADPTSK).
The firing strengths of each rule are computed with the ADP-softmin operator, and membership functions are wrapped as Gaussian PIMFs to preserve a positive infimum during high-dimensional training.
Reference
Ma, M., Qian, L., Zhang, Y., Fang, Q., & Xue, G. (2025). An adaptive double-parameter softmin based Takagi-Sugeno-Kang fuzzy system for high-dimensional data. Fuzzy Sets and Systems, 521, 109582. https://doi.org/10.1016/j.fss.2025.109582
Initialise the ADPTSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
kappa
|
float
|
ADP-softmin parameter |
690.0
|
xi
|
float
|
ADP-softmin parameter |
730.0
|
eps
|
float | None
|
Numerical stability epsilon. |
None
|
zero_consequent_init
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_adaptive.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
ADPTSKRegressorModel
Bases: BaseTSKRegressorModel
TSK regressor with adaptive double-parameter softmin antecedent (ADPTSK).
The firing strengths of each rule are computed with the ADP-softmin operator, and membership functions are wrapped as Gaussian PIMFs to preserve a positive infimum during high-dimensional training.
Reference
Ma, M., Qian, L., Zhang, Y., Fang, Q., & Xue, G. (2025). An adaptive double-parameter softmin based Takagi-Sugeno-Kang fuzzy system for high-dimensional data. Fuzzy Sets and Systems, 521, 109582. https://doi.org/10.1016/j.fss.2025.109582
Initialise the ADPTSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
kappa
|
float
|
ADP-softmin parameter |
690.0
|
xi
|
float
|
ADP-softmin parameter |
730.0
|
eps
|
float | None
|
Numerical stability epsilon. |
None
|
zero_consequent_init
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_adaptive.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
AYATSKClassifierModel
Bases: BaseTSKClassifierModel
TSK classifier with an adaptive Yager T-norm in the antecedent.
AYATSK extends TSK by using an adaptive Yager T-norm aggregation and optional positive lower-bound membership functions to improve stability and performance in high-dimensional settings.
Reference
G. Xue, Y. Yang and J. Wang, "Adaptive Yager T-Norm-Based Takagi-Sugeno-Kang Fuzzy Systems," in IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 55, no. 12, pp. 9802-9815, Dec. 2025, doi: 10.1109/TSMC.2025.3621346.
Initialise the AYATSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
t_norm
|
str | TNormFn
|
T-norm name or callable (default |
'yager'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_yager.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
AYATSKRegressorModel
Bases: BaseTSKRegressorModel
TSK regressor with an adaptive Yager T-norm in the antecedent.
AYATSK extends TSK by using an adaptive Yager T-norm aggregation and optional positive lower-bound membership functions to improve stability and performance in high-dimensional settings.
Reference
G. Xue, Y. Yang and J. Wang, "Adaptive Yager T-Norm-Based Takagi-Sugeno-Kang Fuzzy Systems," in IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 55, no. 12, pp. 9802-9815, Dec. 2025, doi: 10.1109/TSMC.2025.3621346.
Initialise the AYATSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
t_norm
|
str | TNormFn
|
T-norm name or callable (default |
'yager'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Source code in highfis/models/_yager.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
BaseTSK
Bases: nn.Module
Abstract base for TSK fuzzy models.
Subclasses must implement :meth:_build_consequent_layer.
Initialize the TSK pipeline layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature names to sequences of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. Supported values:
|
'cartesian'
|
t_norm
|
str | TNormFn
|
T-norm name or callable. Common string values: |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule index sequences. Required when
rule_base is |
None
|
defuzzifier
|
Defuzzifier | None
|
Normalization module applied to raw rule firing
strengths. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
If |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If input_mfs is empty. |
Source code in highfis/models/_base.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
BaseTSKClassifierModel
Bases: BaseTSK
Abstract classifier base that provides task-specific training and inference helpers.
Initialize the TSK pipeline layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature names to sequences of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. Supported values:
|
'cartesian'
|
t_norm
|
str | TNormFn
|
T-norm name or callable. Common string values: |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule index sequences. Required when
rule_base is |
None
|
defuzzifier
|
Defuzzifier | None
|
Normalization module applied to raw rule firing
strengths. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
If |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If input_mfs is empty. |
Source code in highfis/models/_base.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
BaseTSKRegressorModel
Bases: BaseTSK
Abstract regressor base that provides task-specific training and inference helpers.
Initialize the TSK pipeline layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature names to sequences of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. Supported values:
|
'cartesian'
|
t_norm
|
str | TNormFn
|
T-norm name or callable. Common string values: |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule index sequences. Required when
rule_base is |
None
|
defuzzifier
|
Defuzzifier | None
|
Normalization module applied to raw rule firing
strengths. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
If |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If input_mfs is empty. |
Source code in highfis/models/_base.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
DGALETSKClassifierModel
Bases: BaseTSKClassifierModel
DG-ALETSK classifier with ALE-softmin antecedent and double-group gates.
DG-ALETSK extends FSRE-ADATSK by replacing the adaptive softmin with the Adaptive Ln-Exp (ALE) softmin — a smoother variant with improved numerical stability. It also uses a zero-order consequent in the DG (data-guided) training phase and optionally converts to first-order after gate-based pruning.
Reference
G. Xue, J. Wang, B. Yuan and C. Dai, "DG-ALETSK: A High-Dimensional Fuzzy Approach With Simultaneous Feature Selection and Rule Extraction," in IEEE Transactions on Fuzzy Systems, vol. 31, no. 11, pp. 3866-3880, Nov. 2023, doi: 10.1109/TFUZZ.2023.3270445.
Initialise the DG-ALETSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices; ignored when
|
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon for the ALE-softmin operator. |
None
|
use_en_frb
|
bool
|
Start directly from the Enhanced FRB (En-FRB). |
False
|
optimizer_type
|
str
|
Optimizer for all training phases. |
'sgd'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_dg_aletsk.py
apply_thresholds
Apply threshold pruning to feature and rule gates.
Source code in highfis/models/_dg_aletsk.py
compute_thresholds
Compute feature and rule thresholds from gate values and coefficient pairs.
Source code in highfis/models/_dg_aletsk.py
convert_to_first_order
Convert the DG phase zero-order consequent to first-order form.
The zero-order bias (initialised from the target labels per the
paper's Eq. 25 and refined during the DG phase) is carried over to the
first-order consequent so the fine-tuning phase starts from a
label-aligned consequent rather than from scratch.
No-op when the consequent is already first-order: rebuilding it would discard the trained parameters and re-initialise the rule gates.
Source code in highfis/models/_dg_aletsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_feature_gate_values
Return normalized antecedent feature gate values for the DG phase.
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_gate_values
Return normalized consequent rule gate values for the DG phase.
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
init_consequents_from_labels
Initialise zero-order consequent biases with one-hot labels for P-FRB.
Sets consequent_layer.bias[r, c] = 1 when sample r belongs to class c.
Should be called before training when using P-FRB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
Integer class labels of shape |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the model is not in zero-order consequent mode. |
Source code in highfis/models/_dg_aletsk.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
prune_structure
Structurally prune the model to the given surviving feature and rule indices.
Rebuilds :attr:membership_layer, :attr:rule_layer, and
:attr:consequent_layer in-place, retaining only the specified
features and rules. All associated parameters are copied from
the current layers.
Source code in highfis/models/_dg_aletsk.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
search_thresholds
Search threshold coefficients for feature and rule pruning.
The search follows the DG-ALETSK paper strategy: thresholds are computed from gate values, applied to prune gates, and the first-order consequent parameters are refit with antecedents fixed.
Source code in highfis/models/_dg_aletsk.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
DGALETSKRegressorModel
Bases: BaseTSKRegressorModel
DG-ALETSK regressor with ALE-softmin antecedent and double-group gates.
DG-ALETSK extends FSRE-ADATSK by replacing the adaptive softmin with the Adaptive Ln-Exp (ALE) softmin — a smoother variant with improved numerical stability. It also uses a zero-order consequent in the DG (data-guided) training phase and optionally converts to first-order after gate-based pruning.
Reference
G. Xue, J. Wang, B. Yuan and C. Dai, "DG-ALETSK: A High-Dimensional Fuzzy Approach With Simultaneous Feature Selection and Rule Extraction," in IEEE Transactions on Fuzzy Systems, vol. 31, no. 11, pp. 3866-3880, Nov. 2023, doi: 10.1109/TFUZZ.2023.3270445.
Initialise the DG-ALETSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices; ignored when
|
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon for the ALE-softmin operator. |
None
|
use_en_frb
|
bool
|
Start directly from the Enhanced FRB (En-FRB). |
False
|
optimizer_type
|
str
|
Optimizer for all training phases. |
'sgd'
|
Source code in highfis/models/_dg_aletsk.py
apply_thresholds
Apply threshold pruning to feature and rule gates.
Source code in highfis/models/_dg_aletsk.py
compute_thresholds
Compute feature and rule thresholds from gate values and coefficient pairs.
Source code in highfis/models/_dg_aletsk.py
convert_to_first_order
Convert the DG phase zero-order consequent to first-order form.
The DG-phase zero-order bias is carried over to the first-order
consequent so fine-tuning starts from the refined consequent rather
than from scratch.
No-op when the consequent is already first-order: rebuilding it would discard the trained parameters and re-initialise the rule gates.
Source code in highfis/models/_dg_aletsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_feature_gate_values
Return normalized antecedent feature gate values for the DG phase.
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_gate_values
Return normalized consequent rule gate values for the DG phase.
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
init_consequents_from_labels
Initialise the constant term of each rule with the target of its sample.
The regression counterpart of the label initialisation of the classifiers: in a point-based rule base, rule r is centred on a training sample and starts by predicting the target of that sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
Targets of shape |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the model is not in zero-order consequent mode. |
Source code in highfis/models/_dg_aletsk.py
predict
prune_structure
Structurally prune the model to the given surviving feature and rule indices.
Rebuilds :attr:membership_layer, :attr:rule_layer, and
:attr:consequent_layer in-place, retaining only the specified
features and rules. All associated parameters are copied from
the current layers.
Source code in highfis/models/_dg_aletsk.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
search_thresholds
Search threshold coefficients for feature and rule pruning.
Source code in highfis/models/_dg_aletsk.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
DGTSKClassifierModel
Bases: BaseTSKClassifierModel
DG-TSK classifier with M-gate antecedent and point-based FRB (P-FRB).
DG-TSK uses a data-guided M-gate function to automatically select relevant features and rules.
Reference
Guangdong Xue, Jian Wang, Bingjie Zhang, Bin Yuan, Caili Dai, Double groups of gates based Takagi-Sugeno-Kang (DG-TSK) fuzzy system for simultaneous feature selection and rule extraction, Fuzzy Sets and Systems, Volume 469, 2023, 108627, ISSN 0165-0114, https://doi.org/10.1016/j.fss.2023.108627.
Initialise the DG-TSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
gate_fea
|
str | Callable[[Tensor], Tensor] | None
|
Gate function for antecedent feature selection.
|
'gate_m'
|
gate_rule
|
str | Callable[[Tensor], Tensor] | None
|
Gate function for consequent rule selection.
Same options as |
'gate_m'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices; ignored when
|
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon. |
None
|
use_en_frb
|
bool
|
Use the Enhanced FRB (P-FRB) rule base. |
False
|
optimizer_type
|
str
|
Optimizer for all training phases. |
'sgd'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_dg_tsk.py
apply_thresholds
Prune DG-TSK feature and rule gates using the computed thresholds.
Source code in highfis/models/_dg_tsk.py
compute_thresholds
Compute DG-TSK pruning thresholds from gate values and zeta parameters.
Source code in highfis/models/_dg_tsk.py
convert_to_first_order
Convert the DG-TSK model from zero-order to first-order consequent.
No-op when the consequent is already first-order: rebuilding it would discard the trained parameters and re-initialise the rule gates.
Source code in highfis/models/_dg_tsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_feature_gate_values
Return normalized DG-TSK feature gate activations from lambda values.
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_gate_values
Return normalized DG-TSK rule gate activations from theta values.
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
init_consequents_from_labels
Initialise zero-order consequent biases with one-hot encoded labels (P-FRB paper eq. 24).
Sets consequent_layer.bias[r, c] = 1 when sample r belongs to class c,
exactly as in Xue et al. (2023) eq. (24): \(p^0_{r,c} = y_{r,c}\).
Should be called before :meth:fit_dg_phase when using P-FRB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
Integer class labels of shape |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the model is not in zero-order consequent mode. |
Source code in highfis/models/_dg_tsk.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
prune_structure
Structurally prune the model to the given surviving feature and rule indices.
Rebuilds :attr:membership_layer, :attr:rule_layer, and
:attr:consequent_layer in-place, retaining only the specified
features and rules. All associated parameters are copied from
the current layers.
Source code in highfis/models/_dg_tsk.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
search_thresholds
Search DG-TSK threshold combinations and optionally apply the best candidate.
Source code in highfis/models/_dg_tsk.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
DGTSKRegressorModel
Bases: BaseTSKRegressorModel
DG-TSK regressor with M-gate antecedent and point-based FRB (P-FRB).
DG-TSK uses a data-guided M-gate function to automatically select relevant features and rules.
Reference
Guangdong Xue, Jian Wang, Bingjie Zhang, Bin Yuan, Caili Dai, Double groups of gates based Takagi-Sugeno-Kang (DG-TSK) fuzzy system for simultaneous feature selection and rule extraction, Fuzzy Sets and Systems, Volume 469, 2023, 108627, ISSN 0165-0114, https://doi.org/10.1016/j.fss.2023.108627.
Initialise the DG-TSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
gate_fea
|
str | Callable[[Tensor], Tensor] | None
|
Gate function for antecedent feature selection
(default |
'gate_m'
|
gate_rule
|
str | Callable[[Tensor], Tensor] | None
|
Gate function for consequent rule selection
(default |
'gate_m'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices; ignored when
|
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon. |
None
|
use_en_frb
|
bool
|
Use the Enhanced FRB (P-FRB) rule base. |
False
|
optimizer_type
|
str
|
Optimizer for all training phases. |
'sgd'
|
Source code in highfis/models/_dg_tsk.py
apply_thresholds
Prune DG-TSK feature and rule gates using the computed thresholds.
Source code in highfis/models/_dg_tsk.py
compute_thresholds
Compute DG-TSK pruning thresholds from gate values and zeta parameters.
Source code in highfis/models/_dg_tsk.py
convert_to_first_order
Convert the DG-TSK regressor from zero-order to first-order consequent.
No-op when the consequent is already first-order: rebuilding it would discard the trained parameters and re-initialise the rule gates.
Source code in highfis/models/_dg_tsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_feature_gate_values
Return normalized DG-TSK feature gate activations from lambda values.
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_gate_values
Return normalized DG-TSK rule gate activations from theta values.
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
init_consequents_from_labels
Initialise the constant term of each rule with the target of its sample.
The regression counterpart of the label initialisation of the classifiers: in a point-based rule base, rule r is centred on a training sample and starts by predicting the target of that sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
Targets of shape |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the model is not in zero-order consequent mode. |
Source code in highfis/models/_dg_tsk.py
predict
prune_structure
Structurally prune the model to the given surviving feature and rule indices.
Rebuilds :attr:membership_layer, :attr:rule_layer, and
:attr:consequent_layer in-place, retaining only the specified
features and rules. All associated parameters are copied from
the current layers.
Source code in highfis/models/_dg_tsk.py
search_thresholds
Search DG-TSK regression threshold combinations and optionally apply the best candidate.
Source code in highfis/models/_dg_tsk.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
DombiTSKClassifierModel
Bases: BaseTSKClassifierModel
TSK classifier with a fixed Dombi T-norm in the antecedent.
DombiTSK extends TSK fuzzy inference by using a Dombi t-norm aggregation in antecedent evaluation while keeping first-order linear consequents.
Reference
G. Xue, L. Hu, J. Wang and S. Ablameyko, "ADMTSK: A High-Dimensional Takagi-Sugeno-Kang Fuzzy System Based on Adaptive Dombi T-Norm," in IEEE Transactions on Fuzzy Systems, vol. 33, no. 6, pp. 1767-1780, June 2025, doi: 10.1109/TFUZZ.2025.3535640.
Initialise the Dombi TSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
T-norm name or callable (default |
'dombi'
|
lambda_
|
float
|
Dombi parameter |
1.0
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
zero_consequent_init
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_dombi.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
DombiTSKRegressorModel
Bases: BaseTSKRegressorModel
TSK regressor with a fixed Dombi T-norm in the antecedent.
DombiTSK extends TSK fuzzy inference by using a Dombi t-norm aggregation in antecedent evaluation while keeping first-order linear consequents.
Reference
G. Xue, L. Hu, J. Wang and S. Ablameyko, "ADMTSK: A High-Dimensional Takagi-Sugeno-Kang Fuzzy System Based on Adaptive Dombi T-Norm," in IEEE Transactions on Fuzzy Systems, vol. 33, no. 6, pp. 1767-1780, June 2025, doi: 10.1109/TFUZZ.2025.3535640.
Initialise the Dombi TSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
T-norm name or callable (default |
'dombi'
|
lambda_
|
float
|
Dombi parameter |
1.0
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_dombi.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
FSREADATSKClassifierModel
Bases: _FSREADATSKMixin, BaseTSKClassifierModel
FSRE-ADATSK classifier with adaptive softmin antecedent and gated consequents.
FSRE-ADATSK (Feature Selection and Rule Extraction) extends ADATSK.
Reference
G. Xue, Q. Chang, J. Wang, K. Zhang and N. R. Pal, "An Adaptive Neuro-Fuzzy System With Integrated Feature Selection and Rule Extraction for High-Dimensional Classification Problems," in IEEE Transactions on Fuzzy Systems, vol. 31, no. 7, pp. 2167-2181, July 2023, doi: 10.1109/TFUZZ.2022.3220950.
Initialise the FSRE-ADATSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of MembershipFunction objects. |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices; ignored when
|
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to SoftmaxLogDefuzzifier. |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon for the Ada-softmin operator. |
None
|
use_en_frb
|
bool
|
Start directly from the Enhanced FRB (En-FRB) instead of CoCo-FRB. |
False
|
gate_fn
|
str | Callable[[Tensor], Tensor] | None
|
Gate function of the feature and rule gates, as a key of
|
'gate4'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_fsre.py
expand_to_en_frb
Switch the rule layer to an Enhanced Fuzzy Rule Base for RE phase.
Source code in highfis/models/_fsre.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_feature_gate_values
Return M(λ_d) gate activations for all input features.
Returns:
| Type | Description |
|---|---|
Tensor
|
Detached tensor of shape |
Tensor
|
activation value for each feature after the FS phase. |
Source code in highfis/models/_fsre.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_gate_values
Return M(θ_r) gate activations for all rules.
Returns:
| Type | Description |
|---|---|
Tensor
|
Detached tensor of shape |
Tensor
|
activation value for each rule after the RE phase. |
Source code in highfis/models/_fsre.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
prune_to_features
Structurally prune the model to the given feature subset (paper step 2).
Updates input_names, input_mfs, n_inputs, membership_layer, and optionally consequent_bn in-place. The rule layer and consequent layer are intentionally left unchanged here; they will be rebuilt from the updated feature set when fit_re() calls expand_to_en_frb().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surviving_features
|
list[int]
|
Indices of features to retain. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If surviving_features is empty. |
Source code in highfis/models/_fsre.py
prune_to_rules
Structurally prune the model to the given rule subset (paper step 4).
Rebuilds rule_layer and consequent_layer in-place,
retaining only the specified rules. Consequent weights, bias, and
gate parameters for the surviving rules are copied from the current
layers. The new consequent layer is set to mode="finetune"
ready for phase 3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surviving_rules
|
list[int]
|
Indices of rules to retain. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If surviving_rules is empty. |
Source code in highfis/models/_fsre.py
reinitialize_fuzzy_sets
Replace the fuzzy sets by n_mfs sets evenly placed over the range of each feature.
The article uses another number of fuzzy sets in the rule-extraction phase than in the feature-selection phase, and reinitializes the system parameters between the two. The new sets are of the class of the current ones, with their spread.
Source code in highfis/models/_fsre.py
set_consequent_mode
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
FSREADATSKRegressorModel
Bases: _FSREADATSKMixin, BaseTSKRegressorModel
FSRE-ADATSK regressor with adaptive softmin antecedent and gated consequents.
FSRE-ADATSK (Feature Selection and Rule Extraction) extends ADATSK.
Reference
G. Xue, Q. Chang, J. Wang, K. Zhang and N. R. Pal, "An Adaptive Neuro-Fuzzy System With Integrated Feature Selection and Rule Extraction for High-Dimensional Classification Problems," in IEEE Transactions on Fuzzy Systems, vol. 31, no. 7, pp. 2167-2181, July 2023, doi: 10.1109/TFUZZ.2022.3220950.
Initialise the FSRE-ADATSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of MembershipFunction objects. |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'coco'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices; ignored when
|
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to SoftmaxLogDefuzzifier. |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
eps
|
float | None
|
Numerical stability epsilon for the Ada-softmin operator. |
None
|
use_en_frb
|
bool
|
Start directly from the Enhanced FRB (En-FRB). |
False
|
gate_fn
|
str | Callable[[Tensor], Tensor] | None
|
Gate function of the feature and rule gates, as a key of
|
'gate4'
|
Source code in highfis/models/_fsre.py
expand_to_en_frb
Switch the rule layer to an Enhanced Fuzzy Rule Base for RE phase.
Source code in highfis/models/_fsre.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_feature_gate_values
Return M(λ_d) gate activations for all input features.
Returns:
| Type | Description |
|---|---|
Tensor
|
Detached tensor of shape |
Tensor
|
activation value for each feature after the FS phase. |
Source code in highfis/models/_fsre.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_gate_values
Return M(θ_r) gate activations for all rules.
Returns:
| Type | Description |
|---|---|
Tensor
|
Detached tensor of shape |
Tensor
|
activation value for each rule after the RE phase. |
Source code in highfis/models/_fsre.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
prune_to_features
Structurally prune the model to the given feature subset (paper step 2).
Updates input_names, input_mfs, n_inputs, membership_layer, and optionally consequent_bn in-place. The rule layer and consequent layer are intentionally left unchanged here; they will be rebuilt from the updated feature set when fit_re() calls expand_to_en_frb().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surviving_features
|
list[int]
|
Indices of features to retain. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If surviving_features is empty. |
Source code in highfis/models/_fsre.py
prune_to_rules
Structurally prune the model to the given rule subset (paper step 4).
Rebuilds rule_layer and consequent_layer in-place,
retaining only the specified rules. Consequent weights, bias, and
gate parameters for the surviving rules are copied from the current
layers. The new consequent layer is set to mode="finetune"
ready for phase 3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surviving_rules
|
list[int]
|
Indices of rules to retain. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If surviving_rules is empty. |
Source code in highfis/models/_fsre.py
reinitialize_fuzzy_sets
Replace the fuzzy sets by n_mfs sets evenly placed over the range of each feature.
The article uses another number of fuzzy sets in the rule-extraction phase than in the feature-selection phase, and reinitializes the system parameters between the two. The new sets are of the class of the current ones, with their spread.
Source code in highfis/models/_fsre.py
set_consequent_mode
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
HDFISMinClassifierModel
Bases: BaseTSKClassifierModel
HDFIS-min classifier with frozen antecedents and minimum aggregation.
HDFIS-min uses the minimum T-norm in the antecedent and only optimizes consequent parameters, which avoids the nondifferentiability of the minimum operator during training.
References
G. Xue, J. Wang, K. Zhang and N. R. Pal, "High-Dimensional Fuzzy Inference Systems," in IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 54, no. 1, pp. 507-519, Jan. 2024, doi: 10.1109/TSMC.2023.3311475.
Initialize the HDFIS-min classifier.
Source code in highfis/models/_hdfis.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
HDFISMinRegressorModel
Bases: BaseTSKRegressorModel
HDFIS-min regressor with frozen antecedents and minimum aggregation.
HDFIS-min uses the minimum T-norm in the antecedent and only optimizes consequent parameters, which avoids the nondifferentiability of the minimum operator during training.
References
G. Xue, J. Wang, K. Zhang and N. R. Pal, "High-Dimensional Fuzzy Inference Systems," in IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 54, no. 1, pp. 507-519, Jan. 2024, doi: 10.1109/TSMC.2023.3311475.
Initialize the HDFIS-min regressor.
Source code in highfis/models/_hdfis.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
HDFISProdClassifierModel
Bases: BaseTSKClassifierModel
HDFIS-prod classifier with dimension-dependent Gaussian MFs.
HDFIS-prod combines the standard product T-norm with a dimension-dependent Gaussian membership function (DMF) to avoid numeric underflow in very high-dimensional feature spaces while preserving first-order TSK consequents.
References
G. Xue, J. Wang, K. Zhang and N. R. Pal, "High-Dimensional Fuzzy Inference Systems," in IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 54, no. 1, pp. 507-519, Jan. 2024, doi: 10.1109/TSMC.2023.3311475.
Initialize the HDFIS-prod classifier.
Source code in highfis/models/_hdfis.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
HDFISProdRegressorModel
Bases: BaseTSKRegressorModel
HDFIS-prod regressor with dimension-dependent Gaussian MFs.
HDFIS-prod combines the standard product T-norm with a dimension-dependent Gaussian membership function (DMF) to avoid numeric underflow in very high-dimensional feature spaces while preserving first-order TSK consequents.
References
G. Xue, J. Wang, K. Zhang and N. R. Pal, "High-Dimensional Fuzzy Inference Systems," in IEEE Transactions on Systems, Man, and Cybernetics: Systems, vol. 54, no. 1, pp. 507-519, Jan. 2024, doi: 10.1109/TSMC.2023.3311475.
Initialize the HDFIS-prod regressor.
Source code in highfis/models/_hdfis.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
HTSKClassifierModel
Bases: BaseTSKClassifierModel
HTSK classifier for high-dimensional TSK inference.
HTSK replaces the standard product t-norm with a geometric mean over membership values and performs rule normalization in log-space.
References
Y. Cui, D. Wu and Y. Xu, "Curse of Dimensionality for TSK Fuzzy Neural Networks: Explanation and Solutions," 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China, 2021, pp. 1-8, doi: 10.1109/IJCNN52387.2021.9534265.
Initialise the HTSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
Antecedent aggregation operator name or callable
(default |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. If |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier module. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Apply batch normalisation to the consequent layer inputs. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_htsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
HTSKRegressorModel
Bases: BaseTSKRegressorModel
HTSK regressor for high-dimensional TSK inference.
HTSK replaces the standard product t-norm with a geometric mean over membership values and performs rule normalization in log-space.
References
Y. Cui, D. Wu and Y. Xu, "Curse of Dimensionality for TSK Fuzzy Neural Networks: Explanation and Solutions," 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China, 2021, pp. 1-8, doi: 10.1109/IJCNN52387.2021.9534265.
Initialise the HTSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
Antecedent aggregation operator (default |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Source code in highfis/models/_htsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
LogTSKClassifierModel
Bases: BaseTSKClassifierModel
LogTSK classifier with inverse-log normalization of log-domain rules.
Firing strengths are normalized using the inverse-log formula, which is immune to softmax saturation in high-dimensional input spaces.
References
Y. Cui, D. Wu and Y. Xu, "Curse of Dimensionality for TSK Fuzzy Neural Networks: Explanation and Solutions," 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China, 2021, pp. 1-8, doi: 10.1109/IJCNN52387.2021.9534265.
Initialise the LogTSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
Antecedent aggregation operator (default |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_logtsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
LogTSKRegressorModel
Bases: BaseTSKRegressorModel
LogTSK regressor with inverse-log normalization of log-domain rules.
Firing strengths are normalized using the inverse-log formula, which is immune to softmax saturation in high-dimensional input spaces.
References
Y. Cui, D. Wu and Y. Xu, "Curse of Dimensionality for TSK Fuzzy Neural Networks: Explanation and Solutions," 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China, 2021, pp. 1-8, doi: 10.1109/IJCNN52387.2021.9534265.
Initialise the LogTSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
Antecedent aggregation operator (default |
'gmean'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Source code in highfis/models/_logtsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
MHTSKClassifierModel
Bases: BaseTSKClassifierModel
Multihead TSK classifier with sparse rule consequents.
MHTSK builds multiple sparse subantecedents from random feature subsets and jointly optimizes their rule consequents.
Reference
Z. Bian, Q. Chang, J. Wang and N. R. Pal, "Multihead Takagi-Sugeno-Kang Fuzzy System," in IEEE Transactions on Fuzzy Systems, vol. 33, no. 8, pp. 2561-2573, Aug. 2025, doi: 10.1109/TFUZZ.2025.3569227.
Initialize the MHTSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of membership functions. |
required |
rule_feature_mask
|
Tensor
|
Boolean tensor of shape (n_rules, n_inputs) indicating which features are active for each rule. |
required |
rules
|
Sequence[Sequence[int]]
|
Explicit per-rule MF index sequences for all inputs. |
required |
n_classes
|
int
|
Number of output classes. |
required |
t_norm
|
str | TNormFn
|
Antecedent aggregation operator (default |
'prod'
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Source code in highfis/models/_mhtsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
MHTSKRegressorModel
Bases: BaseTSKRegressorModel
Multihead TSK regressor with sparse rule consequents.
MHTSK builds multiple sparse subantecedents from random feature subsets and jointly optimizes their rule consequents.
Reference
Z. Bian, Q. Chang, J. Wang and N. R. Pal, "Multihead Takagi-Sugeno-Kang Fuzzy System," in IEEE Transactions on Fuzzy Systems, vol. 33, no. 8, pp. 2561-2573, Aug. 2025, doi: 10.1109/TFUZZ.2025.3569227.
Initialize the MHTSK regressor.
Source code in highfis/models/_mhtsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
TSKClassifierModel
Bases: BaseTSKClassifierModel
Vanilla TSK classifier with sum-based rule normalization.
The vanilla Takagi-Sugeno-Kang inference computes rule firing strengths with the product t-norm and normalizes them by their total sum.
References
T. Takagi and M. Sugeno, "Fuzzy identification of systems and its applications to modeling and control," in IEEE Transactions on Systems, Man, and Cybernetics, vol. SMC-15, no. 1, pp. 116-132, Jan.-Feb. 1985, doi: 10.1109/TSMC.1985.6313399.
Initialise the vanilla TSK classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
n_classes
|
int
|
Number of output classes (must be ≥ 2). |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
Antecedent aggregation operator (default |
'prod'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_htsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
predict_proba
Return class probabilities.
A model trained with the cross-entropy loss outputs logits, and the probabilities
are their softmax. A model trained with a squared error on one-hot targets outputs
estimates of the probabilities themselves, on which a softmax would turn a perfect
(1, 0) into (0.73, 0.27). Their outputs are clipped at zero and then:
- scaled to add up to one when they add up to more than one;
- completed, when they add up to less than one, by sharing what is missing equally between the classes, so that weak outputs give probabilities close to uniform.
Both keep the order of the classes, and with it the class predicted.
Source code in highfis/models/_common.py
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
TSKRegressorModel
Bases: BaseTSKRegressorModel
Vanilla TSK regressor with sum-based rule normalization.
The vanilla Takagi-Sugeno-Kang inference computes rule firing strengths with the product t-norm and normalizes them by their total sum.
References
T. Takagi and M. Sugeno, "Fuzzy identification of systems and its applications to modeling and control," in IEEE Transactions on Systems, Man, and Cybernetics, vol. SMC-15, no. 1, pp. 116-132, Jan.-Feb. 1985, doi: 10.1109/TSMC.1985.6313399.
Initialise the vanilla TSK regressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_mfs
|
Mapping[str, Sequence[MembershipFunction]]
|
Mapping from feature name to a sequence of
:class: |
required |
rule_base
|
str
|
Rule-base construction strategy. |
'cartesian'
|
t_norm
|
str | TNormFn
|
Antecedent aggregation operator (default |
'prod'
|
rules
|
Sequence[Sequence[int]] | None
|
Explicit rule antecedent indices. |
None
|
defuzzifier
|
nn.Module | None
|
Custom defuzzifier. Defaults to
:class: |
None
|
consequent_batch_norm
|
bool
|
Batch normalisation on consequent inputs. |
False
|
Source code in highfis/models/_htsk.py
forward
forward_antecedents
Compute normalized rule strengths from model antecedents.
get_consequent_bias
Return the consequent layer bias or None when unavailable.
The intercept b of the first-order consequent, shaped (rules, classes) for
classification and (rules,) for regression. Without it a rule read from
:meth:get_consequent_weights alone is incomplete.
Source code in highfis/models/_base.py
get_consequent_weights
Return the consequent layer weights or None when unavailable.
These are the w coefficients of the first-order consequent
score_r^c(x) = b_{r,c} + sum_d w_{r,c,d} x_d; pair them with
:meth:get_consequent_bias to reconstruct a complete rule.
Source code in highfis/models/_base.py
get_mf_params
Return a serializable description of the model's membership functions.
Source code in highfis/models/_base.py
get_rule_table
Return the rule base as a table of feature-to-MF indices.
Source code in highfis/models/_base.py
predict
solve_consequents
Replace the consequents by their least-squares solution, with the antecedents as they are.
With fixed antecedents the output of a TSK system is linear in its consequent
parameters: :math:\hat y = \sum_r \bar w_r(x)\,(b_r + \sum_d p_{r,d} x_d). The
parameters that minimize the squared error on (x, y) are therefore the solution
of a linear least-squares problem, which is solved here in double precision. For a
classifier the targets are the one-hot vectors of the classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Inputs of shape |
required |
y
|
Tensor
|
Class indices for a classifier, values for a regressor. |
required |
ridge
|
float | str
|
Penalty on the squared norm of the consequent parameters. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The mean squared error of the solution on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in highfis/models/_base.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
build_rule_feature_mask
Build a boolean mask indicating which features are active in each rule.