intelelm.model package

intelelm.model.automated_comparator module

class intelelm.model.automated_comparator.AutomatedMhaElmComparator(optim_dict=None, task='classification', layer_sizes=(10,), act_name='elu', obj_name=None, verbose=False, seed=None, obj_weights=None, lb=None, ub=None, mode='single', n_workers=None, termination=None)[source]

Bases: object

A utility class for comparing different MhaElm models based on optimizer configurations. It supports cross-validation and train-test split evaluation for both classification and regression tasks.

optim_dict

Dictionary containing optimizer names and their parameters.

Type

dict

task

Type of task, either ‘classification’ or ‘regression’.

Type

str

layer_sizes

Number of nodes in each hidden layer.

Type

int, list, or tuple

act_name

Name of the activation function.

Type

str

obj_name

Name of the objective function.

Type

str

verbose

Whether to print verbose output.

Type

bool

seed

Random seed for reproducibility.

Type

int

obj_weights

Weights for the objective function in regression tasks.

Type

array-like, optional

lb

Lower bounds for optimization variables.

Type

list, tuple, np.ndarray, int, or float

ub

Upper bounds for optimization variables.

Type

list, tuple, np.ndarray, int, or float

mode

Optimization mode, e.g., ‘single’ or ‘swarm’, ‘thread, or ‘process’.

Type

str

n_workers

Number of workers for parallel optimization.

Type

int

termination

Termination criteria for the optimization process.

Type

object

models

List of MhaElmClassifier or MhaElmRegressor models.

Type

list

best_estimator_

Best model after comparison.

Type

object

best_params_

Parameters of the best model.

Type

dict

result_cross_val_scores_

Results from cross-validation comparison.

Type

dict

result_train_test_

Results from train-test split comparison.

Type

dict

__init__(optim_dict=None, task="classification", layer_sizes=(10,), act_name="elu", obj_name=None, verbose=False,

seed=None, obj_weights=None, lb=None, ub=None, mode=’single’, n_workers=None, termination=None)

Initializes the AutomatedMhaElmComparator with specified parameters.

_set_optimizer_dict(opt_dict)[source]

Validates and sets the optimizer dictionary.

_filter_metric_results(results, metric_names=None, return_train_score=False)[source]

Filters and formats metric results.

_rename_metrics(results, suffix='train')[source]

Renames metric keys with a specified suffix.

_results_to_csv(to_csv=False, results=None, saved_file_path='history/results.csv')[source]

Saves results to a CSV file.

compare_cross_validate(X, y, metrics=None, cv=5, return_train_score=True, n_trials=10, to_csv=True,

saved_file_path=”history/results_cross_validate.csv”, **kwargs)

Compares models using cross-validation with multiple metrics.

compare_cross_val_score(X, y, metric=None, cv=5, n_trials=10, to_csv=True,

saved_file_path=”history/results_cross_val_score.csv”, **kwargs)

Compares models using cross-validation with a single metric.

compare_train_test(X_train, y_train, X_test, y_test, metrics=None, n_trials=10, to_csv=True,

saved_file_path=”history/results_train_test.csv”)

Compares models using train-test split evaluation.

compare_cross_val_score(X, y, metric=None, cv=5, n_trials=10, to_csv=True, saved_file_path='history/results_cross_val_score.csv', **kwargs)[source]

Performs cross-validation with a single metric.

Compares different MhaElm models using cross-validation with a single metric.

Parameters
  • X (array-like) – The feature matrix.

  • y (array-like) – The target vector.

  • metric (str, optional) – The metric to evaluate. Defaults to None.

  • cv (int, optional) – The number of cross-validation folds. Defaults to 5.

  • n_trials (int, optional) – The number of trials. Defaults to 10.

  • to_csv (bool, optional) – Whether to save results to a CSV file. Defaults to True.

  • saved_file_path (str, optional) – The path to save the CSV file. Defaults to ‘history/results_cross_val_score.csv’.

  • **kwargs – Additional keyword arguments for cross_val_score.

Returns

The comparison results.

Return type

pandas.DataFrame

compare_cross_validate(X, y, metrics=None, cv=5, return_train_score=True, n_trials=10, to_csv=True, saved_file_path='history/results_cross_validate.csv', **kwargs)[source]

Performs cross-validation for model comparison.

Compares different MhaElm models using cross-validation.

Parameters
  • X (array-like) – The feature matrix.

  • y (array-like) – The target vector.

  • metrics (list, optional) – A list of metric names. Defaults to None.

  • cv (int, optional) – The number of cross-validation folds. Defaults to 5.

  • return_train_score (bool, optional) – Whether to return train scores. Defaults to True.

  • n_trials (int, optional) – The number of trials. Defaults to 10.

  • to_csv (bool, optional) – Whether to save results to a CSV file. Defaults to True.

  • saved_file_path (str, optional) – The path to save the CSV file. Defaults to ‘history/results_cross_validate.csv’.

  • **kwargs – Additional keyword arguments for cross_validate.

Returns

The comparison results.

Return type

pandas.DataFrame

compare_train_test(X_train, y_train, X_test, y_test, metrics=None, n_trials=10, to_csv=True, saved_file_path='history/results_train_test.csv')[source]

Compares models using train-test split.

Compares different MhaElm models using train-test split evaluation.

Parameters
  • X_train (array-like) – The training feature matrix.

  • y_train (array-like) – The training target vector.

  • X_test (array-like) – The testing feature matrix.

  • y_test (array-like) – The testing target vector.

  • metrics (list, optional) – A list of metric names. Defaults to None.

  • n_trials (int, optional) – The number of trials. Defaults to 10.

  • to_csv (bool, optional) – Whether to save results to a CSV file. Defaults to True.

  • saved_file_path (str, optional) – The path to save the CSV file. Defaults to ‘history/results_train_test.csv’.

Returns

The comparison results.

Return type

pandas.DataFrame

intelelm.model.automated_tuner module

class intelelm.model.automated_tuner.AutomatedMhaElmTuner(task='classification', param_dict=None, search_method='gridsearch', scoring=None, cv=3, **kwargs)[source]

Bases: object

Automated hyperparameter tuner for MhaElm models.

Performs hyperparameter tuning for MhaElm models using either GridSearchCV or RandomizedSearchCV. Provides an interface for fitting and predicting using the best found model.

model_class

The MhaElm model class (MhaElmRegressor or MhaElmClassifier).

Type

class

param_grid

The parameter grid for hyperparameter tuning.

Type

dict

search_method

The optimization method (‘gridsearch’ or ‘randomsearch’).

Type

str

kwargs

Additional keyword arguments for the search method.

Type

dict

searcher

The searcher

Type

GridSearchCV or RandomizedSearchCV

best_estimator_

The best estimator found during tuning.

Type

sklearn.base.BaseEstimator

best_params_

The best hyperparameters found during tuning.

Type

dict

fit(X, y)[source]

Fits the tuner to the data and tunes hyperparameters.

predict(X)[source]

Predicts using the best estimator.

fit(X, y)[source]

Fits the tuner to the data and tunes the hyperparameters.

Parameters
  • X (array-like) – Training features.

  • y (array-like) – Training target values.

Returns

Fitted tuner object.

Return type

self

predict(X)[source]

Predicts using the best estimator found during tuning.

Parameters

X (array-like) – Data to predict.

Returns

Predicted values.

Return type

array-like

intelelm.model.base_elm module

class intelelm.model.base_elm.BaseElm(layer_sizes=(10,), act_name='relu')[source]

Bases: sklearn.base.BaseEstimator

class BaseElm(BaseEstimator):

A base class for implementing Extreme Learning Machines (ELM) with support for both classification and regression tasks.

layer_sizeslist

List containing the sizes of each layer in the network.

act_namestr

The name of the activation function to be used.

networkobject

The ELM network object.

loss_trainlist

List of loss values recorded during training.

n_labelsint

Number of labels in the dataset.

CLS_OBJ_LOSSES = None
SUPPORTED_CLS_METRICS = {'AS': 'max', 'BSL': 'min', 'CEL': 'min', 'CKS': 'max', 'F1S': 'max', 'F2S': 'max', 'FBS': 'max', 'GINI': 'min', 'GMS': 'max', 'HL': 'min', 'HS': 'max', 'JSI': 'max', 'KLDL': 'min', 'LS': 'max', 'MCC': 'max', 'NPV': 'max', 'PS': 'max', 'ROC-AUC': 'max', 'RS': 'max', 'SS': 'max'}
SUPPORTED_REG_METRICS = {'A10': 'max', 'A20': 'max', 'A30': 'max', 'ACOD': 'max', 'APCC': 'max', 'AR': 'max', 'AR2': 'max', 'CI': 'max', 'COD': 'max', 'COR': 'max', 'COV': 'max', 'CRM': 'min', 'DRV': 'min', 'EC': 'max', 'EVS': 'max', 'GINI': 'min', 'GINI_WIKI': 'min', 'JSD': 'min', 'KGE': 'max', 'MAAPE': 'min', 'MAE': 'min', 'MAPE': 'min', 'MASE': 'min', 'ME': 'min', 'MRB': 'min', 'MRE': 'min', 'MSE': 'min', 'MSLE': 'min', 'MedAE': 'min', 'NNSE': 'max', 'NRMSE': 'min', 'NSE': 'max', 'OI': 'max', 'PCC': 'max', 'PCD': 'max', 'R': 'max', 'R2': 'max', 'R2S': 'max', 'RAE': 'min', 'RMSE': 'min', 'RSE': 'min', 'RSQ': 'max', 'SMAPE': 'min', 'VAF': 'max', 'WI': 'max'}
create_network(X, y) Optional[intelelm.model.base_elm.MultiLayerELM][source]
Parameters
  • X (ndarray) – Input data used to train the network.

  • y (ndarray) – Target values corresponding to the input data X.

Returns

Returns an instance of the MultiLayerELM class if creation is successful, otherwise, returns None.

Return type

Optional[“MultiLayerELM”]

evaluate(y_true, y_pred, list_metrics=None)[source]

Return the list of performance metrics of the prediction.

Parameters
  • y_true (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • y_pred (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Predicted values for X.

  • list_metrics (list) – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

fit(X, y)[source]
Parameters
  • X (array-like of shape (n_samples, n_features)) – Training data.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Target values.

get_weights()[source]

Retrieves the current weights of the neural network.

Returns

A list containing the weights of the neural network.

Return type

list

static load_model(load_path='history', filename='model.pkl')[source]
Parameters
  • load_path (str, optional) – Directory path where the model file is located. Defaults to “history”.

  • filename (str) – Name of the file to be loaded. If the filename doesn’t end with “.pkl”, the extension is automatically added.

Returns

The model loaded from the specified pickle file.

Return type

object

predict(X, return_prob=False)[source]

Inherit the predict function from BaseElm class, with 1 more parameter return_prob.

Parameters
  • X ({array-like, sparse matrix} of shape (n_samples, n_features)) – The input data.

  • return_prob (bool, default=False) –

    It is used for classification problem:

    • If True, the returned results are the probability for each sample

    • If False, the returned results are the predicted labels

save_loss_train(save_path='history', filename='loss.csv')[source]

Save the loss (convergence) during the training process to csv file.

Parameters
  • save_path (saved path (relative path, consider from current executed script path)) –

  • filename (name of the file, needs to have ".csv" extension) –

save_metrics(y_true, y_pred, list_metrics=('RMSE', 'MAE'), save_path='history', filename='metrics.csv')[source]

Save evaluation metrics to csv file

Parameters
  • y_true (ground truth data) –

  • y_pred (predicted output) –

  • list_metrics (list of evaluation metrics) –

  • save_path (saved path (relative path, consider from current executed script path)) –

  • filename (name of the file, needs to have ".csv" extension) –

save_model(save_path='history', filename='model.pkl')[source]

Save model to pickle file

Parameters
  • save_path (saved path (relative path, consider from current executed script path)) –

  • filename (name of the file, needs to have ".pkl" extension) –

save_y_predicted(X, y_true, save_path='history', filename='y_predicted.csv')[source]

Save the predicted results to csv file

Parameters
  • X (The features data, nd.ndarray) –

  • y_true (The ground truth data) –

  • save_path (saved path (relative path, consider from current executed script path)) –

  • filename (name of the file, needs to have ".csv" extension) –

score(X, y, method=None)[source]

Return the metric of the prediction.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • method (str, default="RMSE") – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

result – The result of selected metric

Return type

float

scores(X, y, list_methods=None)[source]

Return the list of metrics of the prediction.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • list_methods (list, default=("MSE", "MAE")) – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

set_predict_request(*, return_prob: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.base_elm.BaseElm

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

return_prob (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_prob parameter in predict.

Returns

self – The updated object.

Return type

object

set_score_request(*, method: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.base_elm.BaseElm

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for method parameter in score.

Returns

self – The updated object.

Return type

object

class intelelm.model.base_elm.BaseMhaElm(layer_sizes=(10,), act_name='elu', obj_name=None, optim='BaseGA', optim_params=None, seed=None, verbose=True, lb=None, ub=None, mode='single', n_workers=None, termination=None)[source]

Bases: intelelm.model.base_elm.BaseElm

An optimization-based extension of the BaseElm class, designed for flexible optimization and parameter tuning of networks utilizing various optimizers from the Mealpy library. It supports different activation functions, objectives, and optimization strategies.

SUPPORTED_OPTIMIZERS

List of supported optimizers, obtained from the Mealpy library.

Type

list

SUPPORTED_CLS_OBJECTIVES

Dictionary of supported classification objectives.

Type

dict

SUPPORTED_REG_OBJECTIVES

Dictionary of supported regression objectives.

Type

dict

obj_name

Name of the objective function used for optimization.

Type

str

optim

Name or instance of the optimizer used for optimization.

Type

str or Optimizer

optim_params

Parameters for configuring the optimizer.

Type

dict

verbose

Whether to display optimization logs.

Type

bool

seed

Seed for random number generation.

Type

int

lb

Lower bounds for optimization variables.

Type

list, tuple, np.ndarray, int, or float

ub

Upper bounds for optimization variables.

Type

list, tuple, np.ndarray, int, or float

mode

Optimization mode, e.g., ‘single’ or ‘multi’.

Type

str

n_workers

Number of workers for parallel optimization.

Type

int

termination

Termination criteria for the optimization process.

Type

object

__init__(layer_sizes=(10,), act_name="elu", obj_name=None, optim="BaseGA", optim_params=None, seed=None, verbose=True,

lb=None, ub=None, mode=’single’, n_workers=None, termination=None)

Initializes the BaseMhaElm with specified parameters.

get_name()[source]

Returns the name of the optimizer used, appended with -ELM.

set_params(**params)[source]

Sets the parameters for the optimizer and updates parent class parameters.

set_optimizer(optim)[source]

Sets the optimizer attribute.

set_optim_paras(optim_params)[source]

Sets the optimizer parameters attribute.

set_optimizer_object(optim=None, optim_params=None)[source]

Sets the optimizer object with the specified parameters.

set_seed(seed)[source]

Sets the random seed for the class.

objective_function(solution=None)[source]

Placeholder fitness function to be overridden by the subclass or user.

set_lb_ub(lb=None, ub=None, n_dims=None)[source]

Validates and sets the lower and upper bounds for optimization.

_get_minmax(obj_name=None)

Retrieves the minmax value for the specified objective name.

fit(X, y)[source]

Fits the model to the provided data using the specified optimization parameters.

SUPPORTED_CLS_OBJECTIVES = {'AS': 'max', 'BSL': 'min', 'CEL': 'min', 'CKS': 'max', 'F1S': 'max', 'F2S': 'max', 'FBS': 'max', 'GINI': 'min', 'GMS': 'max', 'HL': 'min', 'HS': 'max', 'JSI': 'max', 'KLDL': 'min', 'LS': 'max', 'MCC': 'max', 'NPV': 'max', 'PS': 'max', 'ROC-AUC': 'max', 'RS': 'max', 'SS': 'max'}
SUPPORTED_OPTIMIZERS = ['OriginalABC', 'OriginalACOR', 'AugmentedAEO', 'EnhancedAEO', 'ImprovedAEO', 'ModifiedAEO', 'OriginalAEO', 'MGTO', 'OriginalAGTO', 'DevALO', 'OriginalALO', 'OriginalAO', 'OriginalAOA', 'IARO', 'LARO', 'OriginalARO', 'OriginalASO', 'OriginalAVOA', 'OriginalArchOA', 'AdaptiveBA', 'DevBA', 'OriginalBA', 'DevBBO', 'OriginalBBO', 'OriginalBBOA', 'OriginalBES', 'ABFO', 'OriginalBFO', 'OriginalBMO', 'DevBRO', 'OriginalBRO', 'OriginalBSA', 'ImprovedBSO', 'OriginalBSO', 'CleverBookBeesA', 'OriginalBeesA', 'ProbBeesA', 'OriginalCA', 'OriginalCDO', 'OriginalCEM', 'OriginalCGO', 'DevCHIO', 'OriginalCHIO', 'OriginalCOA', 'OCRO', 'OriginalCRO', 'OriginalCSA', 'OriginalCSO', 'OriginalCircleSA', 'OriginalCoatiOA', 'JADE', 'OriginalDE', 'SADE', 'SAP_DE', 'DevDMOA', 'OriginalDMOA', 'OriginalDO', 'DevEFO', 'OriginalEFO', 'OriginalEHO', 'AdaptiveEO', 'ModifiedEO', 'OriginalEO', 'OriginalEOA', 'LevyEP', 'OriginalEP', 'CMA_ES', 'LevyES', 'OriginalES', 'Simple_CMA_ES', 'OriginalESOA', 'OriginalEVO', 'OriginalFA', 'DevFBIO', 'OriginalFBIO', 'OriginalFFA', 'OriginalFFO', 'OriginalFLA', 'DevFOA', 'OriginalFOA', 'WhaleFOA', 'DevFOX', 'OriginalFOX', 'OriginalFPA', 'BaseGA', 'EliteMultiGA', 'EliteSingleGA', 'MultiGA', 'SingleGA', 'OriginalGBO', 'DevGCO', 'OriginalGCO', 'OriginalGJO', 'OriginalGOA', 'DevGSKA', 'OriginalGSKA', 'Matlab101GTO', 'Matlab102GTO', 'OriginalGTO', 'GWO_WOA', 'IGWO', 'OriginalGWO', 'RW_GWO', 'OriginalHBA', 'OriginalHBO', 'OriginalHC', 'SwarmHC', 'OriginalHCO', 'OriginalHGS', 'OriginalHGSO', 'OriginalHHO', 'DevHS', 'OriginalHS', 'OriginalICA', 'OriginalINFO', 'OriginalIWO', 'DevJA', 'LevyJA', 'OriginalJA', 'DevLCO', 'ImprovedLCO', 'OriginalLCO', 'OriginalMA', 'OriginalMFO', 'OriginalMGO', 'OriginalMPA', 'OriginalMRFO', 'WMQIMRFO', 'OriginalMSA', 'DevMVO', 'OriginalMVO', 'OriginalNGO', 'ImprovedNMRA', 'OriginalNMRA', 'OriginalNRO', 'OriginalOOA', 'OriginalPFA', 'OriginalPOA', 'AIW_PSO', 'CL_PSO', 'C_PSO', 'HPSO_TVAC', 'LDW_PSO', 'OriginalPSO', 'P_PSO', 'OriginalPSS', 'DevQSA', 'ImprovedQSA', 'LevyQSA', 'OppoQSA', 'OriginalQSA', 'OriginalRIME', 'OriginalRUN', 'GaussianSA', 'OriginalSA', 'SwarmSA', 'DevSARO', 'OriginalSARO', 'DevSBO', 'OriginalSBO', 'DevSCA', 'OriginalSCA', 'QleSCA', 'OriginalSCSO', 'ImprovedSFO', 'OriginalSFO', 'L_SHADE', 'OriginalSHADE', 'OriginalSHIO', 'OriginalSHO', 'ImprovedSLO', 'ModifiedSLO', 'OriginalSLO', 'DevSMA', 'OriginalSMA', 'DevSOA', 'OriginalSOA', 'OriginalSOS', 'DevSPBO', 'OriginalSPBO', 'OriginalSRSR', 'DevSSA', 'OriginalSSA', 'OriginalSSDO', 'OriginalSSO', 'OriginalSSpiderA', 'OriginalSSpiderO', 'OriginalSTO', 'OriginalSeaHO', 'OriginalServalOA', 'OriginalTDO', 'DevTLO', 'ImprovedTLO', 'OriginalTLO', 'OriginalTOA', 'DevTPO', 'OriginalTS', 'OriginalTSA', 'OriginalTSO', 'EnhancedTWO', 'LevyTWO', 'OppoTWO', 'OriginalTWO', 'DevVCS', 'OriginalVCS', 'OriginalWCA', 'OriginalWDO', 'OriginalWHO', 'HI_WOA', 'OriginalWOA', 'OriginalWaOA', 'OriginalWarSO', 'OriginalZOA']
SUPPORTED_REG_OBJECTIVES = {'A10': 'max', 'A20': 'max', 'A30': 'max', 'ACOD': 'max', 'APCC': 'max', 'AR': 'max', 'AR2': 'max', 'CI': 'max', 'COD': 'max', 'COR': 'max', 'COV': 'max', 'CRM': 'min', 'DRV': 'min', 'EC': 'max', 'EVS': 'max', 'GINI': 'min', 'GINI_WIKI': 'min', 'JSD': 'min', 'KGE': 'max', 'MAAPE': 'min', 'MAE': 'min', 'MAPE': 'min', 'MASE': 'min', 'ME': 'min', 'MRB': 'min', 'MRE': 'min', 'MSE': 'min', 'MSLE': 'min', 'MedAE': 'min', 'NNSE': 'max', 'NRMSE': 'min', 'NSE': 'max', 'OI': 'max', 'PCC': 'max', 'PCD': 'max', 'R': 'max', 'R2': 'max', 'R2S': 'max', 'RAE': 'min', 'RMSE': 'min', 'RSE': 'min', 'RSQ': 'max', 'SMAPE': 'min', 'VAF': 'max', 'WI': 'max'}
fit(X, y)[source]
Parameters
  • X (The features data, np.ndarray) –

  • y (The ground truth data) –

get_name()[source]
objective_function(solution=None)[source]

Evaluates the fitness function for classification metrics based on the provided solution.

Parameters

solution (np.ndarray, default=None) – The proposed solution to evaluate.

Returns

result – The fitness value, representing the loss for the current solution.

Return type

float

static set_lb_ub(lb=None, ub=None, n_dims=None)[source]

Validates and sets the lower and upper bounds for optimization.

Parameters
  • lb (list, tuple, np.ndarray, int, or float, optional) – The lower bounds for weights and biases in network.

  • ub (list, tuple, np.ndarray, int, or float, optional) – The upper bounds for weights and biases in network.

  • n_dims (int) – The number of dimensions.

Returns

A tuple containing validated lower and upper bounds.

Return type

tuple

Raises

ValueError – If the bounds are not valid.

set_optim_paras(optim_params)[source]
set_optimizer(optim)[source]
set_optimizer_object(optim=None, optim_params=None)[source]

Validates the real optimizer based on the provided optim and optim_pras.

Parameters
  • optim (str or Optimizer) – The optimizer name or instance to be set.

  • optim_params (dict, optional) – Parameters to configure the optimizer.

Returns

An instance of the selected optimizer.

Return type

Optimizer

Raises

TypeError – If the provided optimizer is neither a string nor an instance of Optimizer.

set_params(**params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters

**params (dict) – Estimator parameters.

Returns

self – Estimator instance.

Return type

estimator instance

set_predict_request(*, return_prob: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.base_elm.BaseMhaElm

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

return_prob (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_prob parameter in predict.

Returns

self – The updated object.

Return type

object

set_score_request(*, method: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.base_elm.BaseMhaElm

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for method parameter in score.

Returns

self – The updated object.

Return type

object

set_seed(seed)[source]
Parameters

seed (int) – The seed value to initialize the random number generator.

class intelelm.model.base_elm.MultiLayerELM(layer_sizes=(10,), act_name='relu', seed=None)[source]

Bases: object

Initializes the Multi-Layer ELM model.

Parameters
  • layer_sizes (list of int) – List of integers, where each integer represents the number of neurons in the respective hidden layers.

  • act_name (str, optional) – Activation function to be used in the hidden layers (“relu”, “leaky_relu”, “celu”, “prelu”, “gelu”, “elu”, “selu”, “rrelu”, “tanh”, “hard_tanh”, “sigmoid”, “hard_sigmoid”, “log_sigmoid”, “silu”, “swish”, “hard_swish”, “soft_plus”, “mish”, “soft_sign”, “tanh_shrink”, “soft_shrink”, “hard_shrink”, “softmin”, “softmax”, “log_softmax”). Default is ‘relu’.

  • seed (int, optional) – Seed for random number generator. Default is None.

decode(solution_vector, X, y)[source]

Decode a 1-D solution vector into the weights and biases of the network.

Parameters: - solution_vector: 1-D numpy array containing the flattened weights and biases.

encode()[source]

Encode the current weights and biases into a 1-D vector (solution vector).

Returns: - A 1-D numpy array containing all the weights and biases of the network.

fit(X, y)[source]

Fit the model to data matrix X and target(s) y.

Parameters
  • X (ndarray or sparse matrix of shape (n_samples, n_features)) – The input data.

  • y (ndarray of shape (n_samples,) or (n_samples, n_outputs)) – The target values (class labels in classification, real numbers in regression).

Returns

self – Returns a trained ELM model.

Return type

object

get_ndim()[source]

Get the total number of dimensions (weights + biases) in the network.

Returns: - An integer representing the total number of parameters (weights + biases).

get_weights()[source]
predict(X)[source]

Predict using the Extreme Learning Machine model.

Parameters

X ({array-like, sparse matrix} of shape (n_samples, n_features)) – The input data.

Returns

y – The predicted values.

Return type

ndarray of shape (n_samples, n_outputs)

intelelm.model.mha_elm module

class intelelm.model.mha_elm.MhaElmClassifier(layer_sizes=(10,), act_name='elu', obj_name='F1S', optim='BaseGA', optim_params=None, seed=None, verbose=False, lb=None, ub=None, mode='single', n_workers=None, termination=None)[source]

Bases: intelelm.model.base_elm.BaseMhaElm, sklearn.base.ClassifierMixin

A classification model based on the BaseMhaElm class, designed for optimization-based training using various optimizers and classification metrics. It supports flexible network creation and evaluation using the Permetrics library.

CLS_OBJ_LOSSES

List of classification objective losses supported by the model.

Type

list

return_prob

Indicates whether the model should return probabilities for multi-class classification.

Type

bool

__init__(layer_sizes=(10,), act_name="elu", obj_name="F1S", optim="BaseGA", optim_params=None, seed=None,

verbose=False, lb=None, ub=None, mode=’single’, n_workers=None, termination=None)

Initializes the MhaElmClassifier with specified parameters.

_check_y(y)[source]

Validates the target labels and determines the number of unique labels.

create_network(X, y)[source]

Creates and initializes the classification network based on the input data and target labels.

objective_function(solution=None)[source]

Evaluates the fitness function for classification metrics based on the provided solution.

score(X, y, method='AS')[source]

Returns the selected classification metric for the given test data and labels.

scores(X, y, list_methods=('AS', 'RS'))[source]

Returns a dictionary of multiple classification metrics for the given test data and labels.

evaluate(y_true, y_pred, list_metrics=('AS', 'RS'))[source]

Evaluates the performance of predictions using a list of classification metrics.

CLS_OBJ_LOSSES = ['CEL', 'HL', 'KLDL', 'BSL']
create_network(X, y) intelelm.model.base_elm.MultiLayerELM[source]
Parameters
  • X (array-like) – The input features for training the network.

  • y (list, tuple, or np.ndarray) – The target labels for the input data. It must be 1D and will be processed to determine the number of unique labels.

evaluate(y_true, y_pred, list_metrics=('AS', 'RS'))[source]

Return the list of performance metrics on the given test data and labels.

Parameters
  • y_true (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • y_pred (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Predicted values for X.

  • list_metrics (list, default=("AS", "RS")) – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

objective_function(solution=None)[source]

Evaluates the fitness function for classification metric

Parameters

solution (np.ndarray, default=None) –

Returns

result – The fitness value

Return type

float

score(X, y, method='AS')[source]

Return the metric on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.

  • method (str, default="AS") – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

result – The result of selected metric

Return type

float

scores(X, y, list_methods=('AS', 'RS'))[source]

Return the list of metrics on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.

  • list_methods (list, default=("AS", "RS")) – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

set_predict_request(*, return_prob: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.mha_elm.MhaElmClassifier

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

return_prob (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_prob parameter in predict.

Returns

self – The updated object.

Return type

object

set_score_request(*, method: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.mha_elm.MhaElmClassifier

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for method parameter in score.

Returns

self – The updated object.

Return type

object

class intelelm.model.mha_elm.MhaElmRegressor(layer_sizes=(10,), act_name='elu', obj_name='MSE', optim='BaseGA', optim_params=None, seed=None, verbose=False, obj_weights=None, lb=None, ub=None, mode='single', n_workers=None, termination=None)[source]

Bases: intelelm.model.base_elm.BaseMhaElm, sklearn.base.RegressorMixin

A regression model based on the BaseMhaElm class, designed for optimization-based training using various optimizers and regression metrics. It supports flexible network creation and evaluation using the Permetrics library.

obj_weights

Weights for multiple objectives in multi-output regression.

Type

list, tuple, or np.ndarray, optional

__init__(layer_sizes=(10,), act_name="elu", obj_name="MSE", optim="BaseGA", optim_params=None, seed=None,

verbose=False, obj_weights=None, lb=None, ub=None, mode=’single’, n_workers=None, termination=None)

Initializes the MhaElmRegressor with specified parameters.

create_network(X, y)[source]

Creates and initializes the regression network based on the input data and target values.

objective_function(solution=None)[source]

Evaluates the fitness function for regression metrics based on the provided solution.

score(X, y, method='RMSE')[source]

Returns the selected regression metric for the given test data and labels.

scores(X, y, list_methods=('MSE', 'MAE'))[source]

Returns a dictionary of multiple regression metrics for the given test data and labels.

evaluate(y_true, y_pred, list_metrics=('MSE', 'MAE'))[source]

Evaluates the performance of predictions using a list of regression metrics.

create_network(X, y) intelelm.model.base_elm.MultiLayerELM[source]
Parameters
  • X (array-like) – The input data used to train the network.

  • y (array-like) – The target values. It should be a 1D vector or a 2D matrix. Accepted types: list, tuple, np.ndarray.

Returns

An instance of MultiLayerELM initialized with the specified parameters and objective scaler.

Return type

MultiLayerELM

Raises
  • TypeError – If y is not a list, tuple, or np.ndarray, or if y has an invalid shape that is not a 1D vector or 2D matrix, or if self.obj_weights is of an invalid type.

  • ValueError – If the length of self.obj_weights does not match the number of objectives.

evaluate(y_true, y_pred, list_metrics=('MSE', 'MAE'))[source]

Return the list of performance metrics of the prediction.

Parameters
  • y_true (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • y_pred (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Predicted values for X.

  • list_metrics (list, default=("MSE", "MAE")) – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

objective_function(solution=None)[source]

Evaluates the fitness function for regression metric

Parameters

solution (np.ndarray, default=None) –

Returns

result – The fitness value

Return type

float

score(X, y, method='RMSE')[source]

Return the metric of the prediction.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • method (str, default="RMSE") – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

result – The result of selected metric

Return type

float

scores(X, y, list_methods=('MSE', 'MAE'))[source]

Return the list of metrics of the prediction.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • list_methods (list, default=("MSE", "MAE")) – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

set_predict_request(*, return_prob: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.mha_elm.MhaElmRegressor

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

return_prob (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_prob parameter in predict.

Returns

self – The updated object.

Return type

object

set_score_request(*, method: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.mha_elm.MhaElmRegressor

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for method parameter in score.

Returns

self – The updated object.

Return type

object

intelelm.model.standard_elm module

class intelelm.model.standard_elm.ElmClassifier(layer_sizes=(10,), act_name='elu', seed=None)[source]

Bases: intelelm.model.base_elm.BaseElm, sklearn.base.ClassifierMixin

Defines the general class of Traditional ELM model for Classification problems that inherit the BaseElm and ClassifierMixin classes.

Parameters
  • layer_sizes (list of int, integers > 0) – A list of integers specifying the number of neurons in each hidden layer.

  • act_name ({"relu", "leaky_relu", "celu", "prelu", "gelu", "elu", "selu", "rrelu", "tanh", "hard_tanh", "sigmoid",) – “hard_sigmoid”, “log_sigmoid”, “silu”, “swish”, “hard_swish”, “soft_plus”, “mish”, “soft_sign”, “tanh_shrink”, “soft_shrink”, “hard_shrink”, “softmin”, “softmax”, “log_softmax” }, default=’sigmoid’ Activation function for the hidden layer.

  • seed (int, default=None) – Determines random number generation for weights and bias initialization. Pass an int for reproducible results across multiple function calls.

Examples

>>> from intelelm import Data, ElmClassifier
>>> from sklearn.datasets import make_classification
>>> X, y = make_classification(n_samples=100, random_state=1)
>>> data = Data(X, y)
>>> data.split_train_test(test_size=0.2, random_state=1)
>>> model = ElmClassifier(layer_sizes=(10, ), act_name="elu")
>>> model.fit(data.X_train, data.y_train)
>>> pred = model.predict(data.X_test)
>>> print(pred)
array([1, 0, 1, 0, 1])
CLS_OBJ_LOSSES = ['CEL', 'HL', 'KLDL', 'BSL']
create_network(X, y) intelelm.model.base_elm.MultiLayerELM[source]
Parameters
  • X (ndarray) – Input data used to train the network.

  • y (ndarray) – Target values corresponding to the input data X.

Returns

Returns an instance of the MultiLayerELM class if creation is successful, otherwise, returns None.

Return type

Optional[“MultiLayerELM”]

evaluate(y_true, y_pred, list_metrics=('AS', 'RS'))[source]

Return the list of performance metrics on the given test data and labels.

Parameters
  • y_true (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • y_pred (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Predicted values for X.

  • list_metrics (list, default=("AS", "RS")) – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

score(X, y, method='AS')[source]

Return the metric on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.

  • method (str, default="AS") – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

result – The result of selected metric

Return type

float

scores(X, y, list_methods=('AS', 'RS'))[source]

Return the list of metrics on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.

  • list_methods (list, default=("AS", "RS")) – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

set_predict_request(*, return_prob: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.standard_elm.ElmClassifier

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

return_prob (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_prob parameter in predict.

Returns

self – The updated object.

Return type

object

set_score_request(*, method: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.standard_elm.ElmClassifier

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for method parameter in score.

Returns

self – The updated object.

Return type

object

class intelelm.model.standard_elm.ElmRegressor(layer_sizes=(10,), act_name='elu', seed=None)[source]

Bases: intelelm.model.base_elm.BaseElm, sklearn.base.RegressorMixin

Defines the general class of Traditional ELM model for Regression problems that inherit the BaseElm and RegressorMixin classes. It uses Moore–Penrose inverse matrix to calculate the output.

create_network(X, y) intelelm.model.base_elm.MultiLayerELM[source]

Creates a MultiLayerELM network based on provided input data.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Target values for X.

Returns

network – An instance of MultiLayerELM configured with the specified layers and activation function.

Return type

MultiLayerELM

evaluate(y_true, y_pred, list_metrics=('MSE', 'MAE'))[source]

Return the list of performance metrics of the prediction.

Parameters
  • y_true (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • y_pred (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Predicted values for X.

  • list_metrics (list, default=("MSE", "MAE")) – You can get metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

score(X, y, method='RMSE')[source]

Return the metric of the prediction.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • method (str, default="RMSE") – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

result – The result of selected metric

Return type

float

scores(X, y, list_methods=('MSE', 'MAE'))[source]

Return the list of metrics of the prediction.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • list_methods (list, default=("MSE", "MAE")) – You can get all of the metrics from Permetrics library: https://github.com/thieu1995/permetrics

Returns

results – The results of the list metrics

Return type

dict

set_predict_request(*, return_prob: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.standard_elm.ElmRegressor

Request metadata passed to the predict method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

return_prob (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for return_prob parameter in predict.

Returns

self – The updated object.

Return type

object

set_score_request(*, method: Union[bool, None, str] = '$UNCHANGED$') intelelm.model.standard_elm.ElmRegressor

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to score if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to score.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters

method (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for method parameter in score.

Returns

self – The updated object.

Return type

object