profit.util.variable
Module Contents
Classes
Table of input, output and independent variables. |
|
Base class for a single variable. |
|
Sub class for input variables. |
|
Sub class for independent variables. |
|
Sub class for active learning variables. |
|
Sub class for output variables. |
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
Attributes
- profit.util.variable.EXCLUDE_FROM_HALTON = ('output', 'constant', 'uniform', 'loguniform', 'normal', 'linear', 'independent')
- class profit.util.variable.VariableGroup(samples)[source]
Table of input, output and independent variables.
- Parameters:
samples (int) – Samples of the training data.
- samples
Samples of the training data.
- Type:
int
- list
List of all variables in the order of the user entry.
- Type:
list
- property all
- Returns:
View on all variables.
Not working yet for vector output.
- property as_dict
Returns: View of all variables as a dictionary.
- property input
Returns: View of the input variables only. Also excluded are independent variables.
- property named_input
Returns: Ndarray with dtype of the input variables.
- property input_dict
Returns: Dictionary of the input variables.
- property input_list
Returns: List of input variables without independent variables.
- property kind_dict
- property output
Returns: View on the output variables only.
- property named_output
Returns: Ndarray with dtype of the output variables.
- property formatted_output
- property output_dict
Returns: Dictionary of the output variables.
- property output_list
Returns: List of output variables.
- __getitem__(item)[source]
Implements dict like behavior to get a variable by its identifier or index.
- Parameters:
item (int/str) – Index or label of variable.
- Returns:
Variable.
- add(variables)[source]
Adds a single or a list of variables to the table. If a list is added, a common n-D halton sequence is generated and the variables are transformed according to their distribution.
- Parameters:
variables (Variable/list) – Variable(s) to add.
- delete_variable(columns)[source]
Deletes one or more variables from the table.
- Parameters:
columns (int/list) – Columns of the table to remove.
- class profit.util.variable.Variable(name, kind, size, value=None, dtype=np.float64)[source]
Bases:
profit.util.base_class.CustomABC
Base class for a single variable. To create input, independent and output variables, use the cls.create() or cls.create_from_str() methods.
- name
Name of the variable.
- Type:
str
- kind
Distribution for input variables, ‘Output’ or ‘Independent’.
- Type:
str
- size
Size as (nsamples, ndim).
- Type:
tuple
- value
Data.
- Type:
ndarray
- dtype
Datatype.
- Type:
dtype
- property named_value
Returns: Ndarray with dtype.
- labels
- classmethod create_from_str(name, size, v_str)[source]
Creates a Variable instance from a string. E.g. ‘Uniform(3.4, 7.8)’
- Parameters:
name (str) – Name of the variable.
size (tuple) – Size as (nsamples, ndim).
v_str (str) – String from which the variable is constructed.
- Returns:
Variable.
- classmethod create(name, kind, size, value=None, dtype=np.float64, **kwargs)[source]
Directly creates a variable from keyword entries.
- Parameters:
name (str) – Name of the variable.
kind (str) – Distribution of input variables, ‘Output’ or ‘Independent’.
size (tuple) – Size as (nsamples, ndim).
kwargs (tuple/str) – Keyword arguments depending on the sub variables. E.g. constraints for input variables, a search distribution for active learning variables or dependent variables of outputs.
value (ndarray) – Data.
dtype (dtype) – Datatype.
- Returns:
Variable.
- class profit.util.variable.InputVariable(name, kind, size, constraints=(0, 1), value=None, dtype=np.float64)[source]
Bases:
Variable
Sub class for input variables.
- class profit.util.variable.IndependentVariable(name, kind, size, constraints=(0, 1), value=None, dtype=np.float64)[source]
Bases:
InputVariable
Sub class for independent variables.
- class profit.util.variable.ActiveLearningVariable(name, kind, size, distr='uniform', constraints=(0, 1), value=None, dtype=np.float64)[source]
Bases:
InputVariable
Sub class for active learning variables.
- class profit.util.variable.OutputVariable(name, kind, size, dependent=(), value=None, dtype=np.float64)[source]
Bases:
Variable
Sub class for output variables.
- resolve_dependent(ind)[source]
Create a
Variable
instance for the independent variables of vector outputs and setdependent
.- Parameters:
ind (profit.util.variable.IndependentVariable or list[profit.util.variable.IndependentVariable]) – Independent variables.