graforvfl.shared package

graforvfl.shared.activator module

graforvfl.shared.activator.celu(x, alpha=1.0)[source]
graforvfl.shared.activator.elu(x, alpha=1)[source]
graforvfl.shared.activator.gelu(x, alpha=0.044715)[source]
graforvfl.shared.activator.hard_shrink(x, alpha=0.5)[source]
graforvfl.shared.activator.hard_sigmoid(x, lower=-2.5, upper=2.5)[source]
graforvfl.shared.activator.hard_swish(x, lower=-3.0, upper=3.0)[source]
graforvfl.shared.activator.hard_tanh(x, lower=-1.0, upper=1.0)[source]
graforvfl.shared.activator.leaky_relu(x, alpha=0.01)[source]
graforvfl.shared.activator.log_sigmoid(x)[source]
graforvfl.shared.activator.log_softmax(x)[source]
graforvfl.shared.activator.mish(x, beta=1.0)[source]
graforvfl.shared.activator.none(x)[source]
graforvfl.shared.activator.prelu(x, alpha=0.5)[source]
graforvfl.shared.activator.relu(x)[source]
graforvfl.shared.activator.rrelu(x, lower=0.125, upper=0.3333333333333333)[source]
graforvfl.shared.activator.selu(x, alpha=1.67326324, scale=1.05070098)[source]
graforvfl.shared.activator.sigmoid(x)[source]
graforvfl.shared.activator.silu(x)
graforvfl.shared.activator.soft_plus(x, beta=1.0)[source]
graforvfl.shared.activator.soft_shrink(x, alpha=0.5)[source]
graforvfl.shared.activator.soft_sign(x)[source]
graforvfl.shared.activator.softmax(x)[source]
graforvfl.shared.activator.softmin(x)[source]
graforvfl.shared.activator.swish(x)[source]
graforvfl.shared.activator.tanh(x)[source]
graforvfl.shared.activator.tanh_shrink(x)[source]

graforvfl.shared.boundary_controller module

graforvfl.shared.boundary_controller.check_bool(name: str, value: bool, bound=(True, False))[source]
graforvfl.shared.boundary_controller.check_float(name: str, value: int, bound=None)[source]
graforvfl.shared.boundary_controller.check_int(name: str, value: int, bound=None)[source]
graforvfl.shared.boundary_controller.check_str(name: str, value: str, bound=None)[source]
graforvfl.shared.boundary_controller.check_tuple_float(name: str, values: tuple, bounds=None)[source]
graforvfl.shared.boundary_controller.check_tuple_int(name: str, values: tuple, bounds=None)[source]
graforvfl.shared.boundary_controller.is_in_bound(value, bound)[source]
graforvfl.shared.boundary_controller.is_str_in_list(value: str, my_list: list)[source]

graforvfl.shared.data_processor module

class graforvfl.shared.data_processor.Data(X=None, y=None, name='Unknown')[source]

Bases: object

The structure of our supported Data class

Parameters:
  • X (np.ndarray) – The features of your data

  • y (np.ndarray) – The labels of your data

SUPPORT = {'scaler': ['standard', 'minmax', 'max-abs', 'log1p', 'loge', 'sqrt', 'sinh-arc-sinh', 'robust', 'box-cox', 'yeo-johnson']}
static encode_label(y)[source]
static scale(X, scaling_methods=('standard',), list_dict_paras=None)[source]
set_train_test(X_train=None, y_train=None, X_test=None, y_test=None)[source]

Function use to set your own X_train, y_train, X_test, y_test in case you don’t want to use our split function

Parameters:
  • X_train (np.ndarray) –

  • y_train (np.ndarray) –

  • X_test (np.ndarray) –

  • y_test (np.ndarray) –

split_train_test(test_size=0.2, train_size=None, random_state=41, shuffle=True, stratify=None, inplace=True)[source]

The wrapper of the split_train_test function in scikit-learn library.

class graforvfl.shared.data_processor.DataTransformer(scaling_methods=('standard',), list_dict_paras=None)[source]

Bases: BaseEstimator, TransformerMixin

SUPPORTED_SCALERS = {'box-cox': <class 'graforvfl.shared.scaler.BoxCoxScaler'>, 'log1p': <class 'graforvfl.shared.scaler.Log1pScaler'>, 'loge': <class 'graforvfl.shared.scaler.LogeScaler'>, 'max-abs': <class 'sklearn.preprocessing._data.MaxAbsScaler'>, 'minmax': <class 'sklearn.preprocessing._data.MinMaxScaler'>, 'robust': <class 'sklearn.preprocessing._data.RobustScaler'>, 'sinh-arc-sinh': <class 'graforvfl.shared.scaler.SinhArcSinhScaler'>, 'sqrt': <class 'graforvfl.shared.scaler.SqrtScaler'>, 'standard': <class 'sklearn.preprocessing._data.StandardScaler'>, 'yeo-johnson': <class 'graforvfl.shared.scaler.YeoJohnsonScaler'>}
fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]
class graforvfl.shared.data_processor.FeatureEngineering[source]

Bases: object

create_threshold_binary_features(X, threshold)[source]

Perform feature engineering to add binary indicator columns for values below the threshold. Add each new column right after the corresponding original column.

Args: X (numpy.ndarray): The input 2D matrix of shape (n_samples, n_features). threshold (float): The threshold value for identifying low values.

Returns: numpy.ndarray: The updated 2D matrix with binary indicator columns.

class graforvfl.shared.data_processor.TimeSeriesDifferencer(interval=1)[source]

Bases: object

difference(X)[source]
inverse_difference(diff_data)[source]
graforvfl.shared.data_processor.get_dataset(dataset_name)[source]

Helper function to retrieve the data

Parameters:

dataset_name (str) – Name of the dataset

Returns:

data – The instance of Data class, that hold X and y variables.

Return type:

Data

graforvfl.shared.randomer module

graforvfl.shared.randomer.get_correct_shape(shape)[source]
graforvfl.shared.randomer.get_generator(seed=None)[source]
graforvfl.shared.randomer.glorot_normal_initializer(shape, seed=None)[source]
graforvfl.shared.randomer.glorot_uniform_initializer(shape, seed=None)[source]
graforvfl.shared.randomer.he_normal_initializer(shape, seed=None)[source]
graforvfl.shared.randomer.he_uniform_initializer(shape, seed=None)[source]
graforvfl.shared.randomer.lecun_normal_initializer(shape, seed=None)[source]
graforvfl.shared.randomer.lecun_uniform_initializer(shape, seed=None)[source]
graforvfl.shared.randomer.orthogonal_initializer(shape, gain=1.0, seed=None)[source]
graforvfl.shared.randomer.random_normal_initializer(shape, mean=0.0, stddev=1.0, seed=None)[source]
graforvfl.shared.randomer.random_uniform_initializer(shape, minval=0.0, maxval=1.0, seed=None)[source]

graforvfl.shared.scaler module

class graforvfl.shared.scaler.BoxCoxScaler(lmbda=None)[source]

Bases: BaseEstimator, TransformerMixin

fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]
class graforvfl.shared.scaler.LabelEncoder[source]

Bases: object

Encode categorical features as integer labels.

fit(y)[source]

Fit label encoder to a given set of labels.

Parameters:

yarray-like

Labels to encode.

fit_transform(y)[source]

Fit label encoder and return encoded labels.

Parameters:

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

Returns:

y – Encoded labels.

Return type:

array-like of shape (n_samples,)

inverse_transform(y)[source]

Transform integer labels to original labels.

Parameters:

yarray-like

Encoded integer labels.

Returns:

original_labelsarray-like

Original labels.

transform(y)[source]

Transform labels to encoded integer labels.

Parameters:

yarray-like

Labels to encode.

Returns:

encoded_labelsarray-like

Encoded integer labels.

class graforvfl.shared.scaler.Log1pScaler[source]

Bases: BaseEstimator, TransformerMixin

fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]
class graforvfl.shared.scaler.LogeScaler[source]

Bases: BaseEstimator, TransformerMixin

fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]
class graforvfl.shared.scaler.ObjectiveScaler(obj_name='sigmoid', ohe_scaler=None)[source]

Bases: object

For label scaler in classification (binary and multiple classification)

inverse_transform(data)[source]
transform(data)[source]
class graforvfl.shared.scaler.SinhArcSinhScaler(epsilon=0.1, delta=1.0)[source]

Bases: BaseEstimator, TransformerMixin

fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]
class graforvfl.shared.scaler.SqrtScaler[source]

Bases: BaseEstimator, TransformerMixin

fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]
class graforvfl.shared.scaler.YeoJohnsonScaler(lmbda=None)[source]

Bases: BaseEstimator, TransformerMixin

fit(X, y=None)[source]
inverse_transform(X)[source]
transform(X)[source]

graforvfl.shared.scorer module

graforvfl.shared.scorer.get_all_classification_metrics()[source]
graforvfl.shared.scorer.get_all_regression_metrics()[source]
graforvfl.shared.scorer.get_metrics(problem, y_true, y_pred, metrics=None, testcase='test')[source]