Module propinfer.model
Classes
class LinReg (label_col, hyperparams=None)
-
A linear regression based model
Args
label_col
- the index of the column to be used as Label
hyperparams
:dict
ofDictConfig
- hyperperameters for the Model Accepted keywords: max_iter (default = 100), normalise (default=False)
Ancestors
Subclasses
Inherited members
class LogReg (label_col, hyperparams)
-
A logistic regression based model
Args
label_col
- the index of the column to be used as Label
hyperparams
:dict
ofDictConfig
- hyperperameters for the Model Accepted keywords: max_iter (default = 100), normalise (default=False)
Ancestors
Inherited members
class MLP (label_col, hyperparams)
-
A Multi-Layer Perceptron based model, for either regression or classification
Args
label_col
- the index of the column to be used as Label
hyperparams
:dict
ofDictConfig
- hyperperameters for the Model Accepted keywords: input_size (mandatory), n_classes (mandatory, performs regression if is 1), layers (default=[64,16]), epochs (default=20), learning_rate (default=1e-1), weight_decay (default=1e-2), batch_size (default=32), normalise (default=False)
Ancestors
Inherited members
class Model (label_col, normalise)
-
An abstract class to be extended to represent the models that will be attacked.
Args
label_col
- the index of the column to be used as Label
normalise
:bool
- whether to normalise data before fit/predict
Subclasses
Methods
def fit(self, data)
-
Fits the model according to the given data
Args
data
- DataFrame containing all useful data
Returns: Model, the model itself
def parameters(self)
-
Returns the model's parameters.
- If the model has only one layer, or is not a DNN, as a numpy array.
- If the model has multiple layers without biases, as a list of numpy arrays representing each layer.
- If the model has multiple layers with weights and biases, arrays of the corresponding weights and biases are grouped in a list, with weights going before biases.
Returns: the model's parameters
def predict(self, data)
-
Makes predictions on the given data
Args
data
- DataFrame containing all useful data
Returns: np.array containing predictions
def predict_proba(self, data)
-
Outputs prediction probability scores for the given data
Args
data
- DataFrame containing all useful data
Returns:np.array containing probability scores